@aztec/p2p 0.77.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config.d.ts +2 -7
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +3 -8
- package/dest/services/libp2p/libp2p_service.d.ts +1 -1
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +11 -14
- package/package.json +10 -10
- package/src/config.ts +4 -14
- package/src/services/libp2p/libp2p_service.ts +11 -15
package/dest/config.d.ts
CHANGED
|
@@ -58,10 +58,6 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
|
|
|
58
58
|
bootstrapNodeEnrVersionCheck: boolean;
|
|
59
59
|
/** Whether to consider any configured bootnodes as full peers, e.g. for transaction gossiping */
|
|
60
60
|
bootstrapNodesAsFullPeers: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Protocol identifier for transaction gossiping.
|
|
63
|
-
*/
|
|
64
|
-
transactionProtocol: string;
|
|
65
61
|
/**
|
|
66
62
|
* The maximum number of peers (a peer count above this will cause the node to refuse connection attempts)
|
|
67
63
|
*/
|
|
@@ -109,7 +105,7 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
|
|
|
109
105
|
/**
|
|
110
106
|
* The 'age' (in # of L2 blocks) of a processed tx after which we heavily penalize a peer for re-sending it.
|
|
111
107
|
*/
|
|
112
|
-
|
|
108
|
+
doubleSpendSeverePeerPenaltyWindow: number;
|
|
113
109
|
/**
|
|
114
110
|
* The weight of the tx topic for the gossipsub protocol. This determines how much the score for this specific topic contributes to the overall peer score.
|
|
115
111
|
*/
|
|
@@ -162,7 +158,6 @@ export declare const bootnodeConfigMappings: ConfigMappingsType<Pick<{
|
|
|
162
158
|
bootstrapNodes: unknown;
|
|
163
159
|
bootstrapNodeEnrVersionCheck: unknown;
|
|
164
160
|
bootstrapNodesAsFullPeers: unknown;
|
|
165
|
-
transactionProtocol: unknown;
|
|
166
161
|
maxPeerCount: unknown;
|
|
167
162
|
queryForIp: unknown;
|
|
168
163
|
keepProvenTxsInPoolFor: unknown;
|
|
@@ -175,7 +170,7 @@ export declare const bootnodeConfigMappings: ConfigMappingsType<Pick<{
|
|
|
175
170
|
gossipsubFloodPublish: unknown;
|
|
176
171
|
gossipsubMcacheLength: unknown;
|
|
177
172
|
gossipsubMcacheGossip: unknown;
|
|
178
|
-
|
|
173
|
+
doubleSpendSeverePeerPenaltyWindow: unknown;
|
|
179
174
|
gossipsubTxTopicWeight: unknown;
|
|
180
175
|
gossipsubTxInvalidMessageDeliveriesWeight: unknown;
|
|
181
176
|
gossipsubTxInvalidMessageDeliveriesDecay: unknown;
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,8BAA8B,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,gBAAgB,EAAE,WAAW;IAC9D;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CA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,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,GAC7C,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAAC,GAC7D,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAYjC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6IAGlC,CAAC"}
|
package/dest/config.js
CHANGED
|
@@ -65,11 +65,6 @@ export const p2pConfigMappings = {
|
|
|
65
65
|
description: 'Whether to consider our configured bootnodes as full peers',
|
|
66
66
|
...booleanConfigHelper(false)
|
|
67
67
|
},
|
|
68
|
-
transactionProtocol: {
|
|
69
|
-
env: 'P2P_TX_PROTOCOL',
|
|
70
|
-
description: 'Protocol identifier for transaction gossiping.',
|
|
71
|
-
defaultValue: '/aztec/0.1.0'
|
|
72
|
-
},
|
|
73
68
|
maxPeerCount: {
|
|
74
69
|
env: 'P2P_MAX_PEERS',
|
|
75
70
|
description: 'The maximum number of peers to connect to.',
|
|
@@ -113,7 +108,7 @@ export const p2pConfigMappings = {
|
|
|
113
108
|
gossipsubDLazy: {
|
|
114
109
|
env: 'P2P_GOSSIPSUB_DLAZY',
|
|
115
110
|
description: 'The Dlazy parameter for the gossipsub protocol.',
|
|
116
|
-
...numberConfigHelper(
|
|
111
|
+
...numberConfigHelper(8)
|
|
117
112
|
},
|
|
118
113
|
gossipsubFloodPublish: {
|
|
119
114
|
env: 'P2P_GOSSIPSUB_FLOOD_PUBLISH',
|
|
@@ -155,8 +150,8 @@ export const p2pConfigMappings = {
|
|
|
155
150
|
50
|
|
156
151
|
]
|
|
157
152
|
},
|
|
158
|
-
|
|
159
|
-
env: '
|
|
153
|
+
doubleSpendSeverePeerPenaltyWindow: {
|
|
154
|
+
env: 'P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW',
|
|
160
155
|
description: 'The "age" (in L2 blocks) of a tx after which we heavily penalize a peer for sending it.',
|
|
161
156
|
...numberConfigHelper(30)
|
|
162
157
|
},
|
|
@@ -162,7 +162,7 @@ export declare class LibP2PService<T extends P2PClientType> extends WithTracer i
|
|
|
162
162
|
* @param tx - The tx that failed the double spend validator.
|
|
163
163
|
* @param blockNumber - The block number of the tx.
|
|
164
164
|
* @param peerId - The peer ID of the peer that sent the tx.
|
|
165
|
-
* @returns
|
|
165
|
+
* @returns Severity
|
|
166
166
|
*/
|
|
167
167
|
private handleDoubleSpendFailure;
|
|
168
168
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p_service.d.ts","sourceRoot":"","sources":["../../../src/services/libp2p/libp2p_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,6BAA6B,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACvH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,UAAU,EACf,aAAa,EAKd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAkC,KAAK,eAAe,EAAE,UAAU,EAAa,MAAM,yBAAyB,CAAC;AAEtH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAa1C,OAAO,EAAgB,KAAK,MAAM,EAAwB,MAAM,mBAAmB,CAAC;AAEpF,OAAO,iBAAiB,CAAC;AAKzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAS7D,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,eAAe,CAAC;AAMtE,OAAO,EAAmC,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGnH,OA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OAKG;IAOU,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjG;;;;;OAKG;IAIU,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAUnF,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;YAI7B,WAAW;YAcX,UAAU;CAYzB"}
|
|
@@ -75,7 +75,7 @@ import { ReqResp } from '../reqresp/reqresp.js';
|
|
|
75
75
|
this.attestationValidator = new AttestationValidator(epochCache);
|
|
76
76
|
this.blockProposalValidator = new BlockProposalValidator(epochCache);
|
|
77
77
|
this.blockReceivedCallback = async (block)=>{
|
|
78
|
-
this.logger.
|
|
78
|
+
this.logger.debug(`Handler not yet registered: Block received callback not set. Received block for slot ${block.slotNumber.toNumber()} from peer.`, {
|
|
79
79
|
p2pMessageIdentifier: await block.p2pMessageIdentifier()
|
|
80
80
|
});
|
|
81
81
|
return undefined;
|
|
@@ -509,13 +509,11 @@ import { ReqResp } from '../reqresp/reqresp.js';
|
|
|
509
509
|
if (outcome.allPassed) {
|
|
510
510
|
return true;
|
|
511
511
|
}
|
|
512
|
-
const { name
|
|
512
|
+
const { name } = outcome.failure;
|
|
513
|
+
let { severity } = outcome.failure;
|
|
513
514
|
// Double spend validator has a special case handler
|
|
514
515
|
if (name === 'doubleSpendValidator') {
|
|
515
|
-
|
|
516
|
-
if (isValid) {
|
|
517
|
-
return true;
|
|
518
|
-
}
|
|
516
|
+
severity = await this.handleDoubleSpendFailure(tx, blockNumber);
|
|
519
517
|
}
|
|
520
518
|
this.peerManager.penalizePeer(peerId, severity);
|
|
521
519
|
return false;
|
|
@@ -597,24 +595,23 @@ import { ReqResp } from '../reqresp/reqresp.js';
|
|
|
597
595
|
* @param tx - The tx that failed the double spend validator.
|
|
598
596
|
* @param blockNumber - The block number of the tx.
|
|
599
597
|
* @param peerId - The peer ID of the peer that sent the tx.
|
|
600
|
-
* @returns
|
|
601
|
-
*/ async handleDoubleSpendFailure(tx, blockNumber
|
|
602
|
-
if (blockNumber <= this.config.
|
|
603
|
-
return
|
|
598
|
+
* @returns Severity
|
|
599
|
+
*/ async handleDoubleSpendFailure(tx, blockNumber) {
|
|
600
|
+
if (blockNumber <= this.config.doubleSpendSeverePeerPenaltyWindow) {
|
|
601
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
604
602
|
}
|
|
605
603
|
const snapshotValidator = new DoubleSpendTxValidator({
|
|
606
604
|
nullifiersExist: async (nullifiers)=>{
|
|
607
|
-
const merkleTree = this.worldStateSynchronizer.getSnapshot(blockNumber - this.config.
|
|
605
|
+
const merkleTree = this.worldStateSynchronizer.getSnapshot(blockNumber - this.config.doubleSpendSeverePeerPenaltyWindow);
|
|
608
606
|
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
|
|
609
607
|
return indices.map((index)=>index !== undefined);
|
|
610
608
|
}
|
|
611
609
|
});
|
|
612
610
|
const validSnapshot = await snapshotValidator.validateTx(tx);
|
|
613
611
|
if (validSnapshot.result !== 'valid') {
|
|
614
|
-
|
|
615
|
-
return false;
|
|
612
|
+
return PeerErrorSeverity.LowToleranceError;
|
|
616
613
|
}
|
|
617
|
-
return
|
|
614
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
618
615
|
}
|
|
619
616
|
/**
|
|
620
617
|
* Validate an attestation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/constants": "0.
|
|
69
|
-
"@aztec/epoch-cache": "0.
|
|
70
|
-
"@aztec/foundation": "0.
|
|
71
|
-
"@aztec/kv-store": "0.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
73
|
-
"@aztec/protocol-contracts": "0.
|
|
74
|
-
"@aztec/stdlib": "0.
|
|
75
|
-
"@aztec/telemetry-client": "0.
|
|
68
|
+
"@aztec/constants": "0.78.0",
|
|
69
|
+
"@aztec/epoch-cache": "0.78.0",
|
|
70
|
+
"@aztec/foundation": "0.78.0",
|
|
71
|
+
"@aztec/kv-store": "0.78.0",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.78.0",
|
|
73
|
+
"@aztec/protocol-contracts": "0.78.0",
|
|
74
|
+
"@aztec/stdlib": "0.78.0",
|
|
75
|
+
"@aztec/telemetry-client": "0.78.0",
|
|
76
76
|
"@chainsafe/discv5": "9.0.0",
|
|
77
77
|
"@chainsafe/enr": "3.0.0",
|
|
78
78
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"xxhash-wasm": "^1.1.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@aztec/archiver": "0.
|
|
104
|
+
"@aztec/archiver": "0.78.0",
|
|
105
105
|
"@jest/globals": "^29.5.0",
|
|
106
106
|
"@types/jest": "^29.5.0",
|
|
107
107
|
"@types/node": "^18.14.6",
|
package/src/config.ts
CHANGED
|
@@ -81,11 +81,6 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
|
|
|
81
81
|
/** Whether to consider any configured bootnodes as full peers, e.g. for transaction gossiping */
|
|
82
82
|
bootstrapNodesAsFullPeers: boolean;
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* Protocol identifier for transaction gossiping.
|
|
86
|
-
*/
|
|
87
|
-
transactionProtocol: string;
|
|
88
|
-
|
|
89
84
|
/**
|
|
90
85
|
* The maximum number of peers (a peer count above this will cause the node to refuse connection attempts)
|
|
91
86
|
*/
|
|
@@ -145,7 +140,7 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
|
|
|
145
140
|
/**
|
|
146
141
|
* The 'age' (in # of L2 blocks) of a processed tx after which we heavily penalize a peer for re-sending it.
|
|
147
142
|
*/
|
|
148
|
-
|
|
143
|
+
doubleSpendSeverePeerPenaltyWindow: number;
|
|
149
144
|
|
|
150
145
|
/**
|
|
151
146
|
* The weight of the tx topic for the gossipsub protocol. This determines how much the score for this specific topic contributes to the overall peer score.
|
|
@@ -236,11 +231,6 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
236
231
|
description: 'Whether to consider our configured bootnodes as full peers',
|
|
237
232
|
...booleanConfigHelper(false),
|
|
238
233
|
},
|
|
239
|
-
transactionProtocol: {
|
|
240
|
-
env: 'P2P_TX_PROTOCOL',
|
|
241
|
-
description: 'Protocol identifier for transaction gossiping.',
|
|
242
|
-
defaultValue: '/aztec/0.1.0',
|
|
243
|
-
},
|
|
244
234
|
maxPeerCount: {
|
|
245
235
|
env: 'P2P_MAX_PEERS',
|
|
246
236
|
description: 'The maximum number of peers to connect to.',
|
|
@@ -286,7 +276,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
286
276
|
gossipsubDLazy: {
|
|
287
277
|
env: 'P2P_GOSSIPSUB_DLAZY',
|
|
288
278
|
description: 'The Dlazy parameter for the gossipsub protocol.',
|
|
289
|
-
...numberConfigHelper(
|
|
279
|
+
...numberConfigHelper(8),
|
|
290
280
|
},
|
|
291
281
|
gossipsubFloodPublish: {
|
|
292
282
|
env: 'P2P_GOSSIPSUB_FLOOD_PUBLISH',
|
|
@@ -325,8 +315,8 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
325
315
|
'The values for the peer scoring system. Passed as a comma separated list of values in order: low, mid, high tolerance errors.',
|
|
326
316
|
defaultValue: [2, 10, 50],
|
|
327
317
|
},
|
|
328
|
-
|
|
329
|
-
env: '
|
|
318
|
+
doubleSpendSeverePeerPenaltyWindow: {
|
|
319
|
+
env: 'P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW',
|
|
330
320
|
description: 'The "age" (in L2 blocks) of a tx after which we heavily penalize a peer for sending it.',
|
|
331
321
|
...numberConfigHelper(30),
|
|
332
322
|
},
|
|
@@ -137,7 +137,7 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
|
|
|
137
137
|
this.blockProposalValidator = new BlockProposalValidator(epochCache);
|
|
138
138
|
|
|
139
139
|
this.blockReceivedCallback = async (block: BlockProposal): Promise<BlockAttestation | undefined> => {
|
|
140
|
-
this.logger.
|
|
140
|
+
this.logger.debug(
|
|
141
141
|
`Handler not yet registered: Block received callback not set. Received block for slot ${block.slotNumber.toNumber()} from peer.`,
|
|
142
142
|
{ p2pMessageIdentifier: await block.p2pMessageIdentifier() },
|
|
143
143
|
);
|
|
@@ -679,15 +679,12 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
|
|
|
679
679
|
if (outcome.allPassed) {
|
|
680
680
|
return true;
|
|
681
681
|
}
|
|
682
|
-
|
|
683
|
-
|
|
682
|
+
const { name } = outcome.failure;
|
|
683
|
+
let { severity } = outcome.failure;
|
|
684
684
|
|
|
685
685
|
// Double spend validator has a special case handler
|
|
686
686
|
if (name === 'doubleSpendValidator') {
|
|
687
|
-
|
|
688
|
-
if (isValid) {
|
|
689
|
-
return true;
|
|
690
|
-
}
|
|
687
|
+
severity = await this.handleDoubleSpendFailure(tx, blockNumber);
|
|
691
688
|
}
|
|
692
689
|
|
|
693
690
|
this.peerManager.penalizePeer(peerId, severity);
|
|
@@ -775,17 +772,17 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
|
|
|
775
772
|
* @param tx - The tx that failed the double spend validator.
|
|
776
773
|
* @param blockNumber - The block number of the tx.
|
|
777
774
|
* @param peerId - The peer ID of the peer that sent the tx.
|
|
778
|
-
* @returns
|
|
775
|
+
* @returns Severity
|
|
779
776
|
*/
|
|
780
|
-
private async handleDoubleSpendFailure(tx: Tx, blockNumber: number
|
|
781
|
-
if (blockNumber <= this.config.
|
|
782
|
-
return
|
|
777
|
+
private async handleDoubleSpendFailure(tx: Tx, blockNumber: number): Promise<PeerErrorSeverity> {
|
|
778
|
+
if (blockNumber <= this.config.doubleSpendSeverePeerPenaltyWindow) {
|
|
779
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
783
780
|
}
|
|
784
781
|
|
|
785
782
|
const snapshotValidator = new DoubleSpendTxValidator({
|
|
786
783
|
nullifiersExist: async (nullifiers: Buffer[]) => {
|
|
787
784
|
const merkleTree = this.worldStateSynchronizer.getSnapshot(
|
|
788
|
-
blockNumber - this.config.
|
|
785
|
+
blockNumber - this.config.doubleSpendSeverePeerPenaltyWindow,
|
|
789
786
|
);
|
|
790
787
|
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
|
|
791
788
|
return indices.map(index => index !== undefined);
|
|
@@ -794,11 +791,10 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
|
|
|
794
791
|
|
|
795
792
|
const validSnapshot = await snapshotValidator.validateTx(tx);
|
|
796
793
|
if (validSnapshot.result !== 'valid') {
|
|
797
|
-
|
|
798
|
-
return false;
|
|
794
|
+
return PeerErrorSeverity.LowToleranceError;
|
|
799
795
|
}
|
|
800
796
|
|
|
801
|
-
return
|
|
797
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
802
798
|
}
|
|
803
799
|
|
|
804
800
|
/**
|