@aztec/p2p 3.0.0-nightly.20251015 → 3.0.0-nightly.20251022
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 +2 -2
- 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 +5 -0
- 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.js +2 -2
- 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 +25 -2
- 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 -3
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +8 -2
- package/dest/msg_validators/tx_validator/index.d.ts +1 -0
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +1 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +0 -3
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +1 -19
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +12 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.js +32 -0
- 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 +11 -1
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +63 -21
- 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/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +34 -4
- package/dest/test-helpers/make-enrs.js +1 -1
- package/dest/test-helpers/mock-tx-helpers.d.ts +12 -0
- package/dest/test-helpers/mock-tx-helpers.d.ts.map +1 -0
- package/dest/test-helpers/mock-tx-helpers.js +19 -0
- 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 +1 -1
- 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 +2 -2
- package/src/client/factory.ts +9 -2
- package/src/client/interface.ts +1 -1
- package/src/client/p2p_client.ts +5 -1
- package/src/enr/generate-enr.ts +1 -1
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +2 -2
- 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 +35 -2
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +18 -3
- package/src/msg_validators/tx_validator/factory.ts +8 -2
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +0 -34
- package/src/msg_validators/tx_validator/timestamp_validator.ts +46 -0
- package/src/services/discv5/discV5_service.ts +2 -2
- package/src/services/dummy_service.ts +1 -1
- package/src/services/libp2p/libp2p_service.ts +85 -25
- package/src/services/peer-manager/peer_manager.ts +10 -3
- package/src/services/service.ts +1 -1
- package/src/services/tx_collection/tx_collection_sink.ts +34 -3
- package/src/test-helpers/make-enrs.ts +1 -1
- package/src/test-helpers/mock-tx-helpers.ts +24 -0
- package/src/test-helpers/reqresp-nodes.ts +1 -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,8 +1,8 @@
|
|
|
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
7
|
import { convertToMultiaddr, getPeerIdPrivateKey, getPublicIp } from '../util.js';
|
|
8
8
|
/**
|
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,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAGzF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAA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E,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,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;GAEG;AACH,oBAAY,cAAc;IACxB,IAAI,IAAA;IACJ,QAAQ,IAAA;I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AClC,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,EAA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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"}
|
|
@@ -291,6 +291,11 @@ import { P2PClientState } from './interface.js';
|
|
|
291
291
|
addAttestations(attestations) {
|
|
292
292
|
return this.attestationPool?.addAttestations(attestations) ?? Promise.resolve();
|
|
293
293
|
}
|
|
294
|
+
deleteAttestation(attestation) {
|
|
295
|
+
return this.attestationPool?.deleteAttestations([
|
|
296
|
+
attestation
|
|
297
|
+
]) ?? Promise.resolve();
|
|
298
|
+
}
|
|
294
299
|
// REVIEW: https://github.com/AztecProtocol/aztec-packages/issues/7963
|
|
295
300
|
// ^ This pattern is not my favorite (md)
|
|
296
301
|
registerBlockProposalHandler(handler) {
|
|
@@ -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';
|
|
@@ -92,7 +92,7 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
92
92
|
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(BigInt(slotNumber), archive.toString());
|
|
93
93
|
expect(retreivedAttestations.length).toBe(1);
|
|
94
94
|
expect(retreivedAttestations[0].toBuffer()).toEqual(attestations[0].toBuffer());
|
|
95
|
-
expect(retreivedAttestations[0].getSender()
|
|
95
|
+
expect(retreivedAttestations[0].getSender()?.toString()).toEqual(signer.address.toString());
|
|
96
96
|
// Try adding them on another operation and check they are still not duplicated
|
|
97
97
|
await ap.addAttestations([
|
|
98
98
|
attestations[0]
|
|
@@ -244,7 +244,7 @@ export function describeAttestationPool(getAttestationPool) {
|
|
|
244
244
|
expect(retrievedProposal).toBeDefined();
|
|
245
245
|
// Should have the second proposal
|
|
246
246
|
expect(retrievedProposal.toBuffer()).toEqual(proposal2.toBuffer());
|
|
247
|
-
expect(retrievedProposal.getSender()
|
|
247
|
+
expect(retrievedProposal.getSender()?.toString()).toBe(signers[1].address.toString());
|
|
248
248
|
});
|
|
249
249
|
it('should handle block proposals with different slots and same archive', async ()=>{
|
|
250
250
|
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;AAE7D,qBAAa,iBAAkB,YAAW,eAAe;IAYrD,OAAO,CAAC,KAAK;IAEb,OAAO,CAAC,GAAG;IAbb,OAAO,CAAC,OAAO,CAAwC;IAEvD,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,SAAS,CAGf;IACF,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,uBAAuB,CAAqC;gBAG1D,KAAK,EAAE,iBAAiB,EAChC,SAAS,GAAE,eAAsC,EACzC,GAAG,yCAAyC;IAUtD,OAAO,CAAC,SAAS,CAIf;IAEW,OAAO,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;
|
|
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,EAA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ttestationPool {
|
|
|
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,aAA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AAO,CAAC,OAAO,CAAC;IAI3B,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAQjE,iCAAiC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAWhG,eAAe,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA6C1D,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBpE,yBAAyB,CAAC,IAAI,EAAE,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 = makeL2BlockHeader(1, 2, slot);
|
|
21
21
|
const payload = new ConsensusPayload(header.toCheckpointHeader(), 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(header.globalVariables.blockNumber, 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;CAoDlF"}
|
|
@@ -1,25 +1,48 @@
|
|
|
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.equals(expectedProposer)) {
|
|
38
|
+
this.logger.warn(`Proposer signature mismatch in attestation. ` + `Expected ${expectedProposer?.toString() ?? 'none'} but got ${proposer.toString()} for slot ${slotNumberBigInt}`);
|
|
17
39
|
return PeerErrorSeverity.HighToleranceError;
|
|
18
40
|
}
|
|
19
41
|
return undefined;
|
|
20
42
|
} catch (e) {
|
|
21
43
|
// People shouldn't be sending us attestations if the committee doesn't exist
|
|
22
44
|
if (e instanceof NoCommitteeError) {
|
|
45
|
+
this.logger.warn(`No committee exists for attestation for slot ${slotNumberBigInt}`);
|
|
23
46
|
return PeerErrorSeverity.LowToleranceError;
|
|
24
47
|
}
|
|
25
48
|
throw e;
|
|
@@ -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;gBAEX,UAAU,EAAE,mBAAmB;IAKrC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;
|
|
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;gBAEX,UAAU,EAAE,mBAAmB;IAKrC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;CAwD7E"}
|
|
@@ -10,6 +10,12 @@ export class BlockProposalValidator {
|
|
|
10
10
|
}
|
|
11
11
|
async validate(block) {
|
|
12
12
|
try {
|
|
13
|
+
// Check signature validity first - invalid signatures are a high-severity issue
|
|
14
|
+
const proposer = block.getSender();
|
|
15
|
+
if (!proposer) {
|
|
16
|
+
this.logger.debug(`Penalizing peer for block proposal with invalid signature`);
|
|
17
|
+
return PeerErrorSeverity.MidToleranceError;
|
|
18
|
+
}
|
|
13
19
|
const { currentProposer, nextProposer, currentSlot, nextSlot } = await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
14
20
|
// Check that the attestation is for the current or next slot
|
|
15
21
|
const slotNumberBigInt = block.payload.header.slotNumber.toBigInt();
|
|
@@ -21,12 +27,11 @@ export class BlockProposalValidator {
|
|
|
21
27
|
return PeerErrorSeverity.HighToleranceError;
|
|
22
28
|
}
|
|
23
29
|
// Check that the block proposal is from the current or next proposer
|
|
24
|
-
const proposer = block.getSender();
|
|
25
30
|
if (slotNumberBigInt === currentSlot && currentProposer !== undefined && !proposer.equals(currentProposer)) {
|
|
26
31
|
this.logger.debug(`Penalizing peer for invalid proposer for current slot ${slotNumberBigInt}`, {
|
|
27
32
|
currentProposer,
|
|
28
33
|
nextProposer,
|
|
29
|
-
proposer
|
|
34
|
+
proposer: proposer.toString()
|
|
30
35
|
});
|
|
31
36
|
return PeerErrorSeverity.MidToleranceError;
|
|
32
37
|
}
|
|
@@ -34,10 +39,18 @@ export class BlockProposalValidator {
|
|
|
34
39
|
this.logger.debug(`Penalizing peer for invalid proposer for next slot ${slotNumberBigInt}`, {
|
|
35
40
|
currentProposer,
|
|
36
41
|
nextProposer,
|
|
37
|
-
proposer
|
|
42
|
+
proposer: proposer.toString()
|
|
38
43
|
});
|
|
39
44
|
return PeerErrorSeverity.MidToleranceError;
|
|
40
45
|
}
|
|
46
|
+
// Validate tx hashes for all txs embedded in the proposal
|
|
47
|
+
if (!(await Promise.all(block.txs?.map((tx)=>tx.validateTxHash()) ?? [])).every((v)=>v)) {
|
|
48
|
+
this.logger.warn(`Penalizing peer for invalid tx hashes in block proposal`, {
|
|
49
|
+
proposer,
|
|
50
|
+
slotNumber: slotNumberBigInt
|
|
51
|
+
});
|
|
52
|
+
return PeerErrorSeverity.LowToleranceError;
|
|
53
|
+
}
|
|
41
54
|
return undefined;
|
|
42
55
|
} catch (e) {
|
|
43
56
|
// People shouldn't be sending us block proposals if the committee doesn't exist
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAalD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE;QACT,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACjD,CAAC;IACF,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,qBAAqB,EAAE,EAAE,EACzB,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,6BAA6B,EAC5C,YAAY,EAAE,OAAO,EACrB,cAAc,GAAE,cAAc,EAAO,GACpC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,CA+DpC"}
|
|
@@ -10,6 +10,7 @@ import { DoubleSpendTxValidator } from './double_spend_validator.js';
|
|
|
10
10
|
import { GasTxValidator } from './gas_validator.js';
|
|
11
11
|
import { MetadataTxValidator } from './metadata_validator.js';
|
|
12
12
|
import { PhasesTxValidator } from './phases_validator.js';
|
|
13
|
+
import { TimestampTxValidator } from './timestamp_validator.js';
|
|
13
14
|
import { TxPermittedValidator } from './tx_permitted_validator.js';
|
|
14
15
|
import { TxProofValidator } from './tx_proof_validator.js';
|
|
15
16
|
export function createTxMessageValidators(timestamp, blockNumber, worldStateSynchronizer, gasFees, l1ChainId, rollupVersion, protocolContractsHash, contractDataSource, proofVerifier, txsPermitted, allowedInSetup = []) {
|
|
@@ -28,13 +29,18 @@ export function createTxMessageValidators(timestamp, blockNumber, worldStateSync
|
|
|
28
29
|
validator: new MetadataTxValidator({
|
|
29
30
|
l1ChainId: new Fr(l1ChainId),
|
|
30
31
|
rollupVersion: new Fr(rollupVersion),
|
|
31
|
-
timestamp,
|
|
32
|
-
blockNumber,
|
|
33
32
|
protocolContractsHash,
|
|
34
33
|
vkTreeRoot: getVKTreeRoot()
|
|
35
34
|
}),
|
|
36
35
|
severity: PeerErrorSeverity.HighToleranceError
|
|
37
36
|
},
|
|
37
|
+
timestampValidator: {
|
|
38
|
+
validator: new TimestampTxValidator({
|
|
39
|
+
timestamp,
|
|
40
|
+
blockNumber
|
|
41
|
+
}),
|
|
42
|
+
severity: PeerErrorSeverity.MidToleranceError
|
|
43
|
+
},
|
|
38
44
|
doubleSpendValidator: {
|
|
39
45
|
validator: new DoubleSpendTxValidator({
|
|
40
46
|
nullifiersExist: async (nullifiers)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { type AnyTx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
3
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
4
3
|
export declare class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
5
4
|
#private;
|
|
6
5
|
private values;
|
|
7
6
|
constructor(values: {
|
|
8
7
|
l1ChainId: Fr;
|
|
9
8
|
rollupVersion: Fr;
|
|
10
|
-
timestamp: UInt64;
|
|
11
|
-
blockNumber: number;
|
|
12
9
|
vkTreeRoot: Fr;
|
|
13
10
|
protocolContractsHash: Fr;
|
|
14
11
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/metadata_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EACL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"metadata_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/metadata_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EACL,KAAK,KAAK,EAKV,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,mBAAmB,CAAC,CAAC,SAAS,KAAK,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;;IAIvE,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE;QACd,SAAS,EAAE,EAAE,CAAC;QACd,aAAa,EAAE,EAAE,CAAC;QAClB,UAAU,EAAE,EAAE,CAAC;QACf,qBAAqB,EAAE,EAAE,CAAC;KAC3B;IAGH,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA4D/C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { TX_ERROR_INCORRECT_L1_CHAIN_ID, TX_ERROR_INCORRECT_PROTOCOL_CONTRACTS_HASH, TX_ERROR_INCORRECT_ROLLUP_VERSION, TX_ERROR_INCORRECT_VK_TREE_ROOT
|
|
2
|
+
import { TX_ERROR_INCORRECT_L1_CHAIN_ID, TX_ERROR_INCORRECT_PROTOCOL_CONTRACTS_HASH, TX_ERROR_INCORRECT_ROLLUP_VERSION, TX_ERROR_INCORRECT_VK_TREE_ROOT } from '@aztec/stdlib/tx';
|
|
3
3
|
export class MetadataTxValidator {
|
|
4
4
|
values;
|
|
5
5
|
#log;
|
|
@@ -15,9 +15,6 @@ export class MetadataTxValidator {
|
|
|
15
15
|
if (!this.#hasCorrectRollupVersion(tx)) {
|
|
16
16
|
errors.push(TX_ERROR_INCORRECT_ROLLUP_VERSION);
|
|
17
17
|
}
|
|
18
|
-
if (!this.#isValidForTimestamp(tx)) {
|
|
19
|
-
errors.push(TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP);
|
|
20
|
-
}
|
|
21
18
|
if (!this.#hasCorrectVkTreeRoot(tx)) {
|
|
22
19
|
errors.push(TX_ERROR_INCORRECT_VK_TREE_ROOT);
|
|
23
20
|
}
|
|
@@ -55,21 +52,6 @@ export class MetadataTxValidator {
|
|
|
55
52
|
return true;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
#isValidForTimestamp(tx) {
|
|
59
|
-
const includeByTimestamp = tx.data.includeByTimestamp;
|
|
60
|
-
// If building block 1, we skip the expiration check. For details on why see the `validate_include_by_timestamp`
|
|
61
|
-
// function in `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`.
|
|
62
|
-
const buildingBlock1 = this.values.blockNumber === 1;
|
|
63
|
-
if (!buildingBlock1 && includeByTimestamp < this.values.timestamp) {
|
|
64
|
-
if (tx.data.constants.anchorBlockHeader.globalVariables.blockNumber === 0) {
|
|
65
|
-
this.#log.warn(`A tx built against a genesis block failed to be included in block 1 which is the only block in which txs built against a genesis block are allowed to be included.`);
|
|
66
|
-
}
|
|
67
|
-
this.#log.verbose(`Rejecting tx ${getTxHash(tx)} for low expiration timestamp. Tx expiration timestamp: ${includeByTimestamp}, timestamp: ${this.values.timestamp}.`);
|
|
68
|
-
return false;
|
|
69
|
-
} else {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
55
|
#hasCorrectRollupVersion(tx) {
|
|
74
56
|
if (!tx.data.constants.txContext.version.equals(this.values.rollupVersion)) {
|
|
75
57
|
this.#log.verbose(`Rejecting tx ${'txHash' in tx ? tx.txHash : tx.hash} because of incorrect rollup version ${tx.data.constants.txContext.version.toNumber()} != ${this.values.rollupVersion.toNumber()}`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AnyTx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
2
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
3
|
+
export declare class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
4
|
+
#private;
|
|
5
|
+
private values;
|
|
6
|
+
constructor(values: {
|
|
7
|
+
timestamp: UInt64;
|
|
8
|
+
blockNumber: number;
|
|
9
|
+
});
|
|
10
|
+
validateTx(tx: T): Promise<TxValidationResult>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=timestamp_validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/timestamp_validator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,qBAAa,oBAAoB,CAAC,CAAC,SAAS,KAAK,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;;IAIxE,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE;QAGd,SAAS,EAAE,MAAM,CAAC;QAElB,WAAW,EAAE,MAAM,CAAC;KACrB;IAGH,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsB/C"}
|