@aztec/p2p 2.1.0-rc.2 → 2.1.0-rc.21
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/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +14 -4
- package/dest/client/factory.d.ts +1 -0
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +4 -2
- package/dest/client/interface.d.ts +1 -1
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +2 -1
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +12 -2
- package/dest/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +2 -1
- package/dest/enr/generate-enr.d.ts +1 -1
- package/dest/enr/generate-enr.d.ts.map +1 -1
- package/dest/enr/generate-enr.js +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +3 -4
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +18 -2
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +21 -7
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +5 -3
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +1 -0
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +29 -2
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +4 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +16 -4
- package/dest/services/discv5/discV5_service.d.ts +2 -2
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +2 -2
- package/dest/services/dummy_service.d.ts +1 -1
- package/dest/services/dummy_service.d.ts.map +1 -1
- 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 +9 -29
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +9 -3
- package/dest/services/service.d.ts +1 -1
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +6 -1
- package/dest/services/tx_collection/tx_collection.d.ts +2 -1
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +3 -2
- package/dest/services/tx_provider.d.ts +1 -1
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +7 -3
- package/dest/test-helpers/make-enrs.js +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +3 -2
- package/dest/versioning.d.ts +1 -1
- package/dest/versioning.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/bootstrap/bootstrap.ts +15 -4
- package/src/client/factory.ts +9 -2
- package/src/client/interface.ts +1 -1
- package/src/client/p2p_client.ts +12 -3
- package/src/config.ts +2 -0
- package/src/enr/generate-enr.ts +1 -1
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +3 -4
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +22 -2
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +24 -7
- package/src/mem_pools/attestation_pool/mocks.ts +6 -3
- package/src/msg_validators/attestation_validator/attestation_validator.ts +39 -2
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +20 -4
- package/src/services/discv5/discV5_service.ts +2 -2
- package/src/services/dummy_service.ts +1 -1
- package/src/services/libp2p/libp2p_service.ts +15 -44
- package/src/services/peer-manager/peer_manager.ts +10 -3
- package/src/services/service.ts +1 -1
- package/src/services/tx_collection/fast_tx_collection.ts +3 -1
- package/src/services/tx_collection/tx_collection.ts +3 -2
- package/src/services/tx_provider.ts +3 -2
- package/src/test-helpers/make-enrs.ts +1 -1
- package/src/test-helpers/reqresp-nodes.ts +2 -1
- package/src/versioning.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD;;GAEG;AACH,qBAAa,aAAc,YAAW,eAAe;IAKjD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,IAAI,CAAC,CAAiC;IAC9C,OAAO,CAAC,MAAM,CAAC,CAAS;gBAGd,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,eAAe,EAC1B,MAAM,yCAAgC;IAGhD;;;;OAIG;IACU,KAAK,CAAC,MAAM,EAAE,cAAc;IAmFzC;;;OAGG;IACU,IAAI;IAOjB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,YAAY;IAMpB;;;OAGG;IACI,SAAS;IAKT,MAAM;IAKN,aAAa;IAKb,eAAe;CAIvB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { OtelMetricsAdapter } from '@aztec/telemetry-client';
|
|
3
|
-
import { Discv5 } from '@chainsafe/discv5';
|
|
4
|
-
import { ENR } from '@chainsafe/enr';
|
|
5
3
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
4
|
+
import { Discv5 } from '@nethermindeth/discv5';
|
|
5
|
+
import { ENR } from '@nethermindeth/enr';
|
|
6
6
|
import { createBootnodeENRandPeerId } from '../enr/generate-enr.js';
|
|
7
|
-
import { convertToMultiaddr, getPeerIdPrivateKey } from '../util.js';
|
|
7
|
+
import { convertToMultiaddr, getPeerIdPrivateKey, getPublicIp } from '../util.js';
|
|
8
8
|
/**
|
|
9
9
|
* Encapsulates a 'Bootstrap' node, used for the purpose of assisting new joiners in acquiring peers.
|
|
10
10
|
*/ export class BootstrapNode {
|
|
@@ -24,7 +24,17 @@ import { convertToMultiaddr, getPeerIdPrivateKey } from '../util.js';
|
|
|
24
24
|
* @param config - A partial P2P configuration. No need for TCP values as well as aztec node specific values.
|
|
25
25
|
* @returns An empty promise.
|
|
26
26
|
*/ async start(config) {
|
|
27
|
-
const {
|
|
27
|
+
const { p2pPort, listenAddress, p2pBroadcastPort, queryForIp } = config;
|
|
28
|
+
let p2pIp = config.p2pIp;
|
|
29
|
+
this.logger.info(`Starting bootstrap node with config: ${JSON.stringify(config)}`);
|
|
30
|
+
if (!p2pIp) {
|
|
31
|
+
if (queryForIp) {
|
|
32
|
+
this.logger.info('Querying for public IP address...');
|
|
33
|
+
const publicIp = await getPublicIp();
|
|
34
|
+
p2pIp = publicIp;
|
|
35
|
+
this.logger.info(`Found public IP address: ${publicIp}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
28
38
|
if (!p2pIp) {
|
|
29
39
|
throw new Error('You need to provide a P2P IP address.');
|
|
30
40
|
}
|
package/dest/client/factory.d.ts
CHANGED
|
@@ -26,5 +26,6 @@ export type P2PClientDeps<T extends P2PClientType> = {
|
|
|
26
26
|
export declare const P2P_STORE_NAME = "p2p";
|
|
27
27
|
export declare const P2P_ARCHIVE_STORE_NAME = "p2p-archive";
|
|
28
28
|
export declare const P2P_PEER_STORE_NAME = "p2p-peers";
|
|
29
|
+
export declare const P2P_ATTESTATION_STORE_NAME = "p2p-attestation";
|
|
29
30
|
export declare function createP2PClient<T extends P2PClientType>(clientType: T, inputConfig: P2PConfig & DataStoreConfig & ChainConfig, archiver: L2BlockSource & ContractDataSource, proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, epochCache: EpochCacheInterface, packageVersion: string, dateProvider?: DateProvider, telemetry?: TelemetryClient, deps?: P2PClientDeps<T>): Promise<P2PClient<T>>;
|
|
30
31
|
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE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CAAC,EAAE,QAAQ,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC;AAEF,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAE5D,wBAAsB,eAAe,CAAC,CAAC,SAAS,aAAa,EAC3D,UAAU,EAAE,CAAC,EACb,WAAW,EAAE,SAAS,GAAG,eAAe,GAAG,WAAW,EACtD,QAAQ,EAAE,aAAa,GAAG,kBAAkB,EAC5C,aAAa,EAAE,6BAA6B,EAC5C,sBAAsB,EAAE,sBAAsB,EAC9C,UAAU,EAAE,mBAAmB,EAC/B,cAAc,EAAE,MAAM,EACtB,YAAY,GAAE,YAAiC,EAC/C,SAAS,GAAE,eAAsC,EACjD,IAAI,GAAE,aAAa,CAAC,CAAC,CAAM,yBAyF5B"}
|
package/dest/client/factory.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
4
4
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
5
5
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
6
6
|
import { P2PClient } from '../client/p2p_client.js';
|
|
7
|
-
import {
|
|
7
|
+
import { KvAttestationPool } from '../mem_pools/attestation_pool/kv_attestation_pool.js';
|
|
8
8
|
import { AztecKVTxPool } from '../mem_pools/tx_pool/index.js';
|
|
9
9
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
10
10
|
import { LibP2PService } from '../services/index.js';
|
|
@@ -14,6 +14,7 @@ import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerI
|
|
|
14
14
|
export const P2P_STORE_NAME = 'p2p';
|
|
15
15
|
export const P2P_ARCHIVE_STORE_NAME = 'p2p-archive';
|
|
16
16
|
export const P2P_PEER_STORE_NAME = 'p2p-peers';
|
|
17
|
+
export const P2P_ATTESTATION_STORE_NAME = 'p2p-attestation';
|
|
17
18
|
export async function createP2PClient(clientType, inputConfig, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), deps = {}) {
|
|
18
19
|
const config = await configureP2PClientAddresses({
|
|
19
20
|
...inputConfig,
|
|
@@ -26,13 +27,14 @@ export async function createP2PClient(clientType, inputConfig, archiver, proofVe
|
|
|
26
27
|
const store = deps.store ?? await createStore(P2P_STORE_NAME, 2, config, createLogger('p2p:lmdb-v2'));
|
|
27
28
|
const archive = await createStore(P2P_ARCHIVE_STORE_NAME, 1, config, createLogger('p2p-archive:lmdb-v2'));
|
|
28
29
|
const peerStore = await createStore(P2P_PEER_STORE_NAME, 1, config, createLogger('p2p-peer:lmdb-v2'));
|
|
30
|
+
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 1, config, createLogger('p2p-attestation:lmdb-v2'));
|
|
29
31
|
const l1Constants = await archiver.getL1Constants();
|
|
30
32
|
const mempools = {
|
|
31
33
|
txPool: deps.txPool ?? new AztecKVTxPool(store, archive, worldStateSynchronizer, telemetry, {
|
|
32
34
|
maxTxPoolSize: config.maxTxPoolSize,
|
|
33
35
|
archivedTxLimit: config.archivedTxLimit
|
|
34
36
|
}),
|
|
35
|
-
attestationPool: clientType === P2PClientType.Full ? deps.attestationPool ?? new
|
|
37
|
+
attestationPool: clientType === P2PClientType.Full ? deps.attestationPool ?? new KvAttestationPool(attestationStore, telemetry) : undefined
|
|
36
38
|
};
|
|
37
39
|
const p2pService = await createP2PService(config, clientType, archiver, proofVerifier, worldStateSynchronizer, epochCache, store, peerStore, mempools, deps.p2pServiceFactory, packageVersion, logger.createChild('libp2p_service'), telemetry);
|
|
38
40
|
const nodeSources = [
|
|
@@ -2,8 +2,8 @@ import type { EthAddress, L2BlockId } from '@aztec/stdlib/block';
|
|
|
2
2
|
import type { P2PApiFull } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import type { BlockProposal, P2PClientType } from '@aztec/stdlib/p2p';
|
|
4
4
|
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
|
-
import type { ENR } from '@chainsafe/enr';
|
|
6
5
|
import type { PeerId } from '@libp2p/interface';
|
|
6
|
+
import type { ENR } from '@nethermindeth/enr';
|
|
7
7
|
import type { P2PConfig } from '../config.js';
|
|
8
8
|
import type { AuthRequest, StatusMessage } from '../services/index.js';
|
|
9
9
|
import type { ReqRespSubProtocol, ReqRespSubProtocolHandler, ReqRespSubProtocolValidators } from '../services/reqresp/interface.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/client/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/client/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnD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AO,CAAC,YAAY,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,IAAI,GAAG,GAAG,SAAS,CAAC;IAE1B,+BAA+B;IAC/B,WAAW,IAAI,IAAI,CAAC;IAEpB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC,qBAAqB;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,qBAAqB,CACnB,WAAW,EAAE,kBAAkB,EAC/B,OAAO,EAAE,yBAAyB,EAClC,SAAS,CAAC,EAAE,4BAA4B,CAAC,kBAAkB,CAAC,GAC3D,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,yBAAyB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5F,4FAA4F;IAC5F,8BAA8B,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;CAC7D,CAAC"}
|
|
@@ -6,8 +6,8 @@ import { type PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
|
6
6
|
import { BlockAttestation, type BlockProposal, type P2PClientType } from '@aztec/stdlib/p2p';
|
|
7
7
|
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
8
8
|
import { type TelemetryClient, WithTracer } from '@aztec/telemetry-client';
|
|
9
|
-
import type { ENR } from '@chainsafe/enr';
|
|
10
9
|
import type { PeerId } from '@libp2p/interface';
|
|
10
|
+
import type { ENR } from '@nethermindeth/enr';
|
|
11
11
|
import { type P2PConfig } from '../config.js';
|
|
12
12
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
13
13
|
import type { AuthRequest, StatusMessage } from '../services/index.js';
|
|
@@ -83,6 +83,7 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
|
|
|
83
83
|
broadcastProposal(proposal: BlockProposal): Promise<void>;
|
|
84
84
|
getAttestationsForSlot(slot: bigint, proposalId?: string): Promise<BlockAttestation[]>;
|
|
85
85
|
addAttestations(attestations: BlockAttestation[]): Promise<void>;
|
|
86
|
+
deleteAttestation(attestation: BlockAttestation): Promise<void>;
|
|
86
87
|
registerBlockProposalHandler(handler: P2PBlockReceivedCallback): void;
|
|
87
88
|
/**
|
|
88
89
|
* Uses the batched Request Response protocol to request a set of transactions from the network.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p2p_client.d.ts","sourceRoot":"","sources":["../../src/client/p2p_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EACV,UAAU,EAGV,aAAa,EAEb,kBAAkB,EAClB,MAAM,EAEP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,KAAK,QAAQ,EAAW,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,eAAe,EAEpB,UAAU,EAGX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"p2p_client.d.ts","sourceRoot":"","sources":["../../src/client/p2p_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,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AInD;;;;;QAKI;IACS,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD;;;OAGG;IACI,OAAO;IAId;;;OAGG;IACU,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvD;;;OAGG;IACU,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1D,iEAAiE;IACpD,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInD;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAgB/C;;;;OAIG;YACW,wBAAwB;IAOtC;;;;OAIG;YACW,oBAAoB;IAyBlC,uFAAuF;YACzE,yBAAyB;IA4BvC;;;;OAIG;YACW,uBAAuB;IAsBrC;;;OAGG;YACW,mBAAmB;YA+CnB,qBAAqB;IA0BnC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAMhB,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC;;;OAGG;IACI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,yBAAyB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAGnG"}
|
|
@@ -69,7 +69,13 @@ import { P2PClientState } from './interface.js';
|
|
|
69
69
|
const constants = this.txCollection.getConstants();
|
|
70
70
|
const nextSlotTimestampSeconds = Number(getTimestampForSlot(block.slotNumber.toBigInt() + 1n, constants));
|
|
71
71
|
const deadline = new Date(nextSlotTimestampSeconds * 1000);
|
|
72
|
-
await this.
|
|
72
|
+
const parentBlock = await this.l2BlockSource.getBlockHeaderByArchive(block.payload.header.lastArchiveRoot);
|
|
73
|
+
if (!parentBlock) {
|
|
74
|
+
this.log.debug(`Cannot collect txs for proposal as parent block not found`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const blockNumber = parentBlock.getBlockNumber() + 1;
|
|
78
|
+
await this.txProvider.getTxsForBlockProposal(block, blockNumber, {
|
|
73
79
|
pinnedPeer: sender,
|
|
74
80
|
deadline
|
|
75
81
|
});
|
|
@@ -291,6 +297,11 @@ import { P2PClientState } from './interface.js';
|
|
|
291
297
|
addAttestations(attestations) {
|
|
292
298
|
return this.attestationPool?.addAttestations(attestations) ?? Promise.resolve();
|
|
293
299
|
}
|
|
300
|
+
deleteAttestation(attestation) {
|
|
301
|
+
return this.attestationPool?.deleteAttestations([
|
|
302
|
+
attestation
|
|
303
|
+
]) ?? Promise.resolve();
|
|
304
|
+
}
|
|
294
305
|
// REVIEW: https://github.com/AztecProtocol/aztec-packages/issues/7963
|
|
295
306
|
// ^ This pattern is not my favorite (md)
|
|
296
307
|
registerBlockProposalHandler(handler) {
|
|
@@ -678,7 +689,6 @@ import { P2PClientState } from './interface.js';
|
|
|
678
689
|
}
|
|
679
690
|
_ts_decorate([
|
|
680
691
|
trackSpan('p2pClient.broadcastProposal', async (proposal)=>({
|
|
681
|
-
[Attributes.BLOCK_NUMBER]: proposal.blockNumber,
|
|
682
692
|
[Attributes.SLOT_NUMBER]: proposal.slotNumber.toNumber(),
|
|
683
693
|
[Attributes.BLOCK_ARCHIVE]: proposal.archive.toString(),
|
|
684
694
|
[Attributes.P2P_ID]: (await proposal.p2pMessageIdentifier()).toString()
|
package/dest/config.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ export declare function getP2PDefaultConfig(): P2PConfig;
|
|
|
115
115
|
/**
|
|
116
116
|
* Required P2P config values for a bootstrap node.
|
|
117
117
|
*/
|
|
118
|
-
export type BootnodeConfig = Pick<P2PConfig, 'p2pIp' | 'p2pPort' | 'p2pBroadcastPort' | 'peerIdPrivateKey' | 'peerIdPrivateKeyPath' | 'bootstrapNodes' | 'listenAddress'> & Required<Pick<P2PConfig, 'p2pIp' | 'p2pPort'>> & Pick<DataStoreConfig, 'dataDirectory' | 'dataStoreMapSizeKB'> & Pick<ChainConfig, 'l1ChainId'>;
|
|
118
|
+
export type BootnodeConfig = Pick<P2PConfig, 'p2pIp' | 'p2pPort' | 'p2pBroadcastPort' | 'peerIdPrivateKey' | 'peerIdPrivateKeyPath' | 'bootstrapNodes' | 'listenAddress' | 'queryForIp'> & Required<Pick<P2PConfig, 'p2pIp' | 'p2pPort'>> & Pick<DataStoreConfig, 'dataDirectory' | 'dataStoreMapSizeKB'> & Pick<ChainConfig, 'l1ChainId'>;
|
|
119
119
|
export declare const bootnodeConfigMappings: ConfigMappingsType<Pick<{
|
|
120
120
|
l1ChainId: unknown;
|
|
121
121
|
rollupVersion: unknown;
|
|
@@ -184,7 +184,7 @@ export declare const bootnodeConfigMappings: ConfigMappingsType<Pick<{
|
|
|
184
184
|
dropTransactions: unknown;
|
|
185
185
|
dropTransactionsProbability: unknown;
|
|
186
186
|
txPoolDeleteTxsAfterReorg: unknown;
|
|
187
|
-
}, "p2pPort" | "p2pBroadcastPort" | "p2pIp" | "listenAddress" | "peerIdPrivateKey" | "peerIdPrivateKeyPath" | "bootstrapNodes" | "l1ChainId" | "dataDirectory" | "dataStoreMapSizeKB">>;
|
|
187
|
+
}, "p2pPort" | "p2pBroadcastPort" | "p2pIp" | "listenAddress" | "peerIdPrivateKey" | "peerIdPrivateKeyPath" | "bootstrapNodes" | "queryForIp" | "l1ChainId" | "dataDirectory" | "dataStoreMapSizeKB">>;
|
|
188
188
|
/**
|
|
189
189
|
* Parses a string to a list of allowed elements.
|
|
190
190
|
* Each encoded is expected to be of one of the following formats
|
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,EACvB,WAAW,EAQZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAw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AAS,EACP,OAAO,GACP,SAAS,GACT,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,GACtB,gBAAgB,GAChB,eAAe,GACf,YAAY,CACf,GACC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC,GAC9C,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAAC,GAC7D,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAgBjC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAGlC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAqC9D"}
|
package/dest/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import { type ChainConfig } from '@aztec/stdlib/config';
|
|
3
3
|
import type { ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
4
|
-
import { ENR, SignableENR } from '@chainsafe/enr';
|
|
5
4
|
import type { PeerId } from '@libp2p/interface';
|
|
6
5
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
6
|
+
import { ENR, SignableENR } from '@nethermindeth/enr';
|
|
7
7
|
export { ENR };
|
|
8
8
|
export declare function createBootnodeENRandPeerId(privateKey: string, p2pIp: string, p2pBroadcastPort: number, l1ChainId: number): Promise<{
|
|
9
9
|
enr: SignableENR;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-enr.d.ts","sourceRoot":"","sources":["../../src/enr/generate-enr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,
|
|
1
|
+
{"version":3,"file":"generate-enr.d.ts","sourceRoot":"","sources":["../../src/enr/generate-enr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMtD,OAAO,EAAE,GAAG,EAAE,CAAC;AAEf,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,GAAG,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAa/C;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,GAAG,SAAS,EACnC,YAAY,EAAE,SAAS,GAAG,SAAS,EACnC,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,MAAM,GACrB;IAAE,GAAG,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,kBAAkB,CAAA;CAAE,CAiBpD;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAYrD"}
|
package/dest/enr/generate-enr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { emptyChainConfig } from '@aztec/stdlib/config';
|
|
2
|
-
import { ENR, SignableENR } from '@chainsafe/enr';
|
|
3
2
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
3
|
+
import { ENR, SignableENR } from '@nethermindeth/enr';
|
|
4
4
|
import { AZTEC_ENR_CLIENT_VERSION_KEY, AZTEC_ENR_KEY } from '../types/index.js';
|
|
5
5
|
import { convertToMultiaddr, createLibP2PPeerIdFromPrivateKey } from '../util.js';
|
|
6
6
|
import { setAztecClientVersionEnrKey, setAztecEnrKey } from '../versioning.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation_pool_test_suite.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool_test_suite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"attestation_pool_test_suite.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool_test_suite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,eAAe,QAqWhF"}
|
|
@@ -26,7 +26,6 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
26
26
|
return signers.map((signer)=>mockAttestation(signer, slotNumber, archive));
|
|
27
27
|
};
|
|
28
28
|
const mockBlockProposal = (signer, slotNumber, archive = Fr.random())=>{
|
|
29
|
-
const blockNumber = 1;
|
|
30
29
|
const header = makeHeader(1, 2, slotNumber);
|
|
31
30
|
const payload = new ConsensusPayload(header.toPropose(), archive, header.state);
|
|
32
31
|
const hash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
|
|
@@ -35,7 +34,7 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
35
34
|
TxHash.random(),
|
|
36
35
|
TxHash.random()
|
|
37
36
|
]; // Mock tx hashes
|
|
38
|
-
return new BlockProposalClass(
|
|
37
|
+
return new BlockProposalClass(payload, signature, txHashes);
|
|
39
38
|
};
|
|
40
39
|
// We compare buffers as the objects can have cached values attached to them which are not serialised
|
|
41
40
|
// using array containing as the kv store does not respect insertion order
|
|
@@ -92,7 +91,7 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
92
91
|
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(BigInt(slotNumber), archive.toString());
|
|
93
92
|
expect(retreivedAttestations.length).toBe(1);
|
|
94
93
|
expect(retreivedAttestations[0].toBuffer()).toEqual(attestations[0].toBuffer());
|
|
95
|
-
expect(retreivedAttestations[0].getSender()
|
|
94
|
+
expect(retreivedAttestations[0].getSender()?.toString()).toEqual(signer.address.toString());
|
|
96
95
|
// Try adding them on another operation and check they are still not duplicated
|
|
97
96
|
await ap.addAttestations([
|
|
98
97
|
attestations[0]
|
|
@@ -244,7 +243,7 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
244
243
|
expect(retrievedProposal).toBeDefined();
|
|
245
244
|
// Should have the second proposal
|
|
246
245
|
expect(retrievedProposal.toBuffer()).toEqual(proposal2.toBuffer());
|
|
247
|
-
expect(retrievedProposal.getSender()
|
|
246
|
+
expect(retrievedProposal.getSender()?.toString()).toBe(signers[1].address.toString());
|
|
248
247
|
});
|
|
249
248
|
it('should handle block proposals with different slots and same archive', async ()=>{
|
|
250
249
|
const archive = Fr.random();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kv_attestation_pool.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/kv_attestation_pool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAGnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE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O,IAAI,OAAO,CAAC,OAAO,CAAC;IAOxC,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB;IAIZ,eAAe,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqChE,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAYjE,iCAAiC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAsBhG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBtD,oCAAoC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBrF,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BnE,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAahE,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAM3E"}
|
|
@@ -46,7 +46,17 @@ export class KvAttestationPool {
|
|
|
46
46
|
for (const attestation of attestations){
|
|
47
47
|
const slotNumber = attestation.payload.header.slotNumber;
|
|
48
48
|
const proposalId = attestation.archive;
|
|
49
|
-
const
|
|
49
|
+
const sender = attestation.getSender();
|
|
50
|
+
// Skip attestations with invalid signatures
|
|
51
|
+
if (!sender) {
|
|
52
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber.toBigInt()}`, {
|
|
53
|
+
signature: attestation.signature.toString(),
|
|
54
|
+
slotNumber,
|
|
55
|
+
proposalId
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const address = sender.toString();
|
|
50
60
|
await this.attestations.set(this.getAttestationKey(slotNumber, proposalId, address), attestation.toBuffer());
|
|
51
61
|
await this.proposalsForSlot.set(slotNumber.toString(), proposalId.toString());
|
|
52
62
|
await this.attestationsForProposal.set(this.getProposalKey(slotNumber, proposalId), this.getAttestationKey(slotNumber, proposalId, address));
|
|
@@ -128,7 +138,13 @@ export class KvAttestationPool {
|
|
|
128
138
|
for (const attestation of attestations){
|
|
129
139
|
const slotNumber = attestation.payload.header.slotNumber;
|
|
130
140
|
const proposalId = attestation.archive;
|
|
131
|
-
const
|
|
141
|
+
const sender = attestation.getSender();
|
|
142
|
+
// Skip attestations with invalid signatures
|
|
143
|
+
if (!sender) {
|
|
144
|
+
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber.toBigInt()}`);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const address = sender.toString();
|
|
132
148
|
const key = this.getAttestationKey(slotNumber, proposalId, address);
|
|
133
149
|
if (await this.attestations.hasAsync(key)) {
|
|
134
150
|
await this.attestations.delete(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory_attestation_pool.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/memory_attestation_pool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAGnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,qBAAa,uBAAwB,YAAW,eAAe;;IAQ3D,OAAO,CAAC,GAAG;IAPb,OAAO,CAAC,OAAO,CAAwC;IAEvD,OAAO,CAAC,YAAY,CAAgG;IACpH,OAAO,CAAC,SAAS,CAA6B;gBAG5C,SAAS,GAAE,eAAsC,EACzC,GAAG,yCAAuC;IAOpD,OAAO,CAAC,SAAS,CAIf;IA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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtD,oCAAoC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBrF,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnE,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7D,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAGxE"}
|
|
@@ -39,14 +39,23 @@ export class InMemoryAttestationPool {
|
|
|
39
39
|
// Perf: order and group by slot before insertion
|
|
40
40
|
const slotNumber = attestation.payload.header.slotNumber;
|
|
41
41
|
const proposalId = attestation.archive.toString();
|
|
42
|
-
const
|
|
42
|
+
const sender = attestation.getSender();
|
|
43
|
+
// Skip attestations with invalid signatures
|
|
44
|
+
if (!sender) {
|
|
45
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber.toBigInt()}`, {
|
|
46
|
+
signature: attestation.signature.toString(),
|
|
47
|
+
slotNumber,
|
|
48
|
+
proposalId
|
|
49
|
+
});
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
43
52
|
const slotAttestationMap = getSlotOrDefault(this.attestations, slotNumber.toBigInt());
|
|
44
53
|
const proposalAttestationMap = getProposalOrDefault(slotAttestationMap, proposalId);
|
|
45
|
-
proposalAttestationMap.set(
|
|
46
|
-
this.log.verbose(`Added attestation for slot ${slotNumber.toBigInt()} from ${
|
|
54
|
+
proposalAttestationMap.set(sender.toString(), attestation);
|
|
55
|
+
this.log.verbose(`Added attestation for slot ${slotNumber.toBigInt()} from ${sender}`, {
|
|
47
56
|
signature: attestation.signature.toString(),
|
|
48
57
|
slotNumber,
|
|
49
|
-
address,
|
|
58
|
+
address: sender,
|
|
50
59
|
proposalId
|
|
51
60
|
});
|
|
52
61
|
}
|
|
@@ -113,9 +122,14 @@ export class InMemoryAttestationPool {
|
|
|
113
122
|
const proposalId = attestation.archive.toString();
|
|
114
123
|
const proposalAttestationMap = getProposalOrDefault(slotAttestationMap, proposalId);
|
|
115
124
|
if (proposalAttestationMap) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
const sender = attestation.getSender();
|
|
126
|
+
// Skip attestations with invalid signatures
|
|
127
|
+
if (!sender) {
|
|
128
|
+
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber.toBigInt()}`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
proposalAttestationMap.delete(sender.toString());
|
|
132
|
+
this.log.debug(`Deleted attestation for slot ${slotNumber} from ${sender}`);
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAIjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,YAAY,EAA2C,MAAM,eAAe,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,YAGlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,eAAe,EACvB,OAAM,MAAU,EAChB,UAAS,EAAgB,KACxB,
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAIjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,YAAY,EAA2C,MAAM,eAAe,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,YAGlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,eAAe,EACvB,OAAM,MAAU,EAChB,UAAS,EAAgB,KACxB,gBAYF,CAAC"}
|
|
@@ -19,7 +19,9 @@ import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
|
|
|
19
19
|
// Use arbitrary numbers for all other than slot
|
|
20
20
|
const header = makeHeader(1, 2, slot);
|
|
21
21
|
const payload = new ConsensusPayload(header.toPropose(), archive, header.state);
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
const attestationHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockAttestation);
|
|
23
|
+
const attestationSignature = signer.sign(attestationHash);
|
|
24
|
+
const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
|
|
25
|
+
const proposerSignature = signer.sign(proposalHash);
|
|
26
|
+
return new BlockAttestation(payload, attestationSignature, proposerSignature);
|
|
25
27
|
};
|
|
@@ -2,6 +2,7 @@ import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
|
2
2
|
import { type BlockAttestation, type P2PValidator, PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
3
3
|
export declare class AttestationValidator implements P2PValidator<BlockAttestation> {
|
|
4
4
|
private epochCache;
|
|
5
|
+
private logger;
|
|
5
6
|
constructor(epochCache: EpochCacheInterface);
|
|
6
7
|
validate(message: BlockAttestation): Promise<PeerErrorSeverity | undefined>;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/attestation_validator/attestation_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"attestation_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/attestation_validator/attestation_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhG,qBAAa,oBAAqB,YAAW,YAAY,CAAC,gBAAgB,CAAC;IACzE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,MAAM,CAAS;gBAEX,UAAU,EAAE,mBAAmB;IAKrC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;CAwDlF"}
|
|
@@ -1,25 +1,52 @@
|
|
|
1
1
|
import { NoCommitteeError } from '@aztec/ethereum';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
3
4
|
export class AttestationValidator {
|
|
4
5
|
epochCache;
|
|
6
|
+
logger;
|
|
5
7
|
constructor(epochCache){
|
|
6
8
|
this.epochCache = epochCache;
|
|
9
|
+
this.logger = createLogger('p2p:attestation-validator');
|
|
7
10
|
}
|
|
8
11
|
async validate(message) {
|
|
12
|
+
const slotNumberBigInt = message.payload.header.slotNumber.toBigInt();
|
|
9
13
|
try {
|
|
10
|
-
const { currentSlot, nextSlot } = await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
11
|
-
const slotNumberBigInt = message.payload.header.slotNumber.toBigInt();
|
|
14
|
+
const { currentProposer, nextProposer, currentSlot, nextSlot } = await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
12
15
|
if (slotNumberBigInt !== currentSlot && slotNumberBigInt !== nextSlot) {
|
|
16
|
+
this.logger.warn(`Attestation slot ${slotNumberBigInt} is not current (${currentSlot}) or next (${nextSlot}) slot`);
|
|
13
17
|
return PeerErrorSeverity.HighToleranceError;
|
|
14
18
|
}
|
|
19
|
+
// Verify the signature is valid
|
|
15
20
|
const attester = message.getSender();
|
|
21
|
+
if (attester === undefined) {
|
|
22
|
+
this.logger.warn(`Invalid signature in attestation for slot ${slotNumberBigInt}`);
|
|
23
|
+
return PeerErrorSeverity.LowToleranceError;
|
|
24
|
+
}
|
|
25
|
+
// Verify the attester is in the committee for this slot
|
|
16
26
|
if (!await this.epochCache.isInCommittee(slotNumberBigInt, attester)) {
|
|
27
|
+
this.logger.warn(`Attester ${attester.toString()} is not in committee for slot ${slotNumberBigInt}`);
|
|
28
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
29
|
+
}
|
|
30
|
+
// Verify the proposer signature matches the expected proposer for this slot
|
|
31
|
+
const proposer = message.getProposer();
|
|
32
|
+
const expectedProposer = slotNumberBigInt === currentSlot ? currentProposer : nextProposer;
|
|
33
|
+
if (!expectedProposer) {
|
|
34
|
+
this.logger.warn(`No proposer defined for slot ${slotNumberBigInt}`);
|
|
35
|
+
return PeerErrorSeverity.HighToleranceError;
|
|
36
|
+
}
|
|
37
|
+
if (!proposer) {
|
|
38
|
+
this.logger.warn(`Invalid proposer signature in attestation for slot ${slotNumberBigInt}`);
|
|
39
|
+
return PeerErrorSeverity.LowToleranceError;
|
|
40
|
+
}
|
|
41
|
+
if (!proposer.equals(expectedProposer)) {
|
|
42
|
+
this.logger.warn(`Proposer signature mismatch in attestation. ` + `Expected ${expectedProposer?.toString() ?? 'none'} but got ${proposer.toString()} for slot ${slotNumberBigInt}`);
|
|
17
43
|
return PeerErrorSeverity.HighToleranceError;
|
|
18
44
|
}
|
|
19
45
|
return undefined;
|
|
20
46
|
} catch (e) {
|
|
21
47
|
// People shouldn't be sending us attestations if the committee doesn't exist
|
|
22
48
|
if (e instanceof NoCommitteeError) {
|
|
49
|
+
this.logger.warn(`No committee exists for attestation for slot ${slotNumberBigInt}`);
|
|
23
50
|
return PeerErrorSeverity.LowToleranceError;
|
|
24
51
|
}
|
|
25
52
|
throw e;
|
|
@@ -3,7 +3,10 @@ import { type BlockProposal, type P2PValidator, PeerErrorSeverity } from '@aztec
|
|
|
3
3
|
export declare class BlockProposalValidator implements P2PValidator<BlockProposal> {
|
|
4
4
|
private epochCache;
|
|
5
5
|
private logger;
|
|
6
|
-
|
|
6
|
+
private txsPermitted;
|
|
7
|
+
constructor(epochCache: EpochCacheInterface, opts: {
|
|
8
|
+
txsPermitted: boolean;
|
|
9
|
+
});
|
|
7
10
|
validate(block: BlockProposal): Promise<PeerErrorSeverity | undefined>;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=block_proposal_validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_proposal_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/block_proposal_validator/block_proposal_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE7F,qBAAa,sBAAuB,YAAW,YAAY,CAAC,aAAa,CAAC;IACxE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,MAAM,CAAS;
|
|
1
|
+
{"version":3,"file":"block_proposal_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/block_proposal_validator/block_proposal_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE7F,qBAAa,sBAAuB,YAAW,YAAY,CAAC,aAAa,CAAC;IACxE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAU;gBAElB,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,OAAO,CAAA;KAAE;IAMtE,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;CAuD7E"}
|
|
@@ -4,12 +4,25 @@ import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
|
4
4
|
export class BlockProposalValidator {
|
|
5
5
|
epochCache;
|
|
6
6
|
logger;
|
|
7
|
-
|
|
7
|
+
txsPermitted;
|
|
8
|
+
constructor(epochCache, opts){
|
|
8
9
|
this.epochCache = epochCache;
|
|
10
|
+
this.txsPermitted = opts.txsPermitted;
|
|
9
11
|
this.logger = createLogger('p2p:block_proposal_validator');
|
|
10
12
|
}
|
|
11
13
|
async validate(block) {
|
|
12
14
|
try {
|
|
15
|
+
// Check signature validity first - invalid signatures are a high-severity issue
|
|
16
|
+
const proposer = block.getSender();
|
|
17
|
+
if (!proposer) {
|
|
18
|
+
this.logger.debug(`Penalizing peer for block proposal with invalid signature`);
|
|
19
|
+
return PeerErrorSeverity.MidToleranceError;
|
|
20
|
+
}
|
|
21
|
+
// Check if transactions are permitted when the proposal contains transaction hashes
|
|
22
|
+
if (!this.txsPermitted && block.txHashes.length > 0) {
|
|
23
|
+
this.logger.debug(`Penalizing peer for block proposal with ${block.txHashes.length} transaction(s) when transactions are not permitted`);
|
|
24
|
+
return PeerErrorSeverity.MidToleranceError;
|
|
25
|
+
}
|
|
13
26
|
const { currentProposer, nextProposer, currentSlot, nextSlot } = await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
14
27
|
// Check that the attestation is for the current or next slot
|
|
15
28
|
const slotNumberBigInt = block.payload.header.slotNumber.toBigInt();
|
|
@@ -21,12 +34,11 @@ export class BlockProposalValidator {
|
|
|
21
34
|
return PeerErrorSeverity.HighToleranceError;
|
|
22
35
|
}
|
|
23
36
|
// Check that the block proposal is from the current or next proposer
|
|
24
|
-
const proposer = block.getSender();
|
|
25
37
|
if (slotNumberBigInt === currentSlot && currentProposer !== undefined && !proposer.equals(currentProposer)) {
|
|
26
38
|
this.logger.debug(`Penalizing peer for invalid proposer for current slot ${slotNumberBigInt}`, {
|
|
27
39
|
currentProposer,
|
|
28
40
|
nextProposer,
|
|
29
|
-
proposer
|
|
41
|
+
proposer: proposer.toString()
|
|
30
42
|
});
|
|
31
43
|
return PeerErrorSeverity.MidToleranceError;
|
|
32
44
|
}
|
|
@@ -34,7 +46,7 @@ export class BlockProposalValidator {
|
|
|
34
46
|
this.logger.debug(`Penalizing peer for invalid proposer for next slot ${slotNumberBigInt}`, {
|
|
35
47
|
currentProposer,
|
|
36
48
|
nextProposer,
|
|
37
|
-
proposer
|
|
49
|
+
proposer: proposer.toString()
|
|
38
50
|
});
|
|
39
51
|
return PeerErrorSeverity.MidToleranceError;
|
|
40
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
2
|
-
import { type IDiscv5CreateOptions } from '@chainsafe/discv5';
|
|
3
|
-
import { ENR } from '@chainsafe/enr';
|
|
4
2
|
import type { PeerId } from '@libp2p/interface';
|
|
3
|
+
import { type IDiscv5CreateOptions } from '@nethermindeth/discv5';
|
|
4
|
+
import { ENR } from '@nethermindeth/enr';
|
|
5
5
|
import EventEmitter from 'events';
|
|
6
6
|
import type { P2PConfig } from '../../config.js';
|
|
7
7
|
import { type PeerDiscoveryService, PeerDiscoveryState } from '../service.js';
|