@aztec/p2p 0.0.1-commit.29c6b1a3 → 0.0.1-commit.2eb6648a
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 +4 -3
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +4 -4
- package/dest/client/factory.d.ts +3 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +10 -7
- package/dest/client/interface.d.ts +9 -2
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +7 -4
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +24 -7
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +2 -2
- package/dest/config.d.ts +9 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +3 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +94 -87
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +411 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +2 -2
- 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 +351 -85
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -2
- package/dest/mem_pools/index.d.ts +2 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/index.js +1 -1
- package/dest/mem_pools/instrumentation.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +2 -2
- package/dest/mem_pools/interface.d.ts +3 -3
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts +2 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +43 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +103 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +47 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +119 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +90 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +89 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +10 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +11 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +131 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +63 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +91 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +70 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +20 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +63 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +19 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts +5 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +4 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +197 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +6 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +71 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +95 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts +26 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.js +70 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +99 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +332 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +55 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +156 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +69 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +748 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +3 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +7 -2
- package/dest/msg_validators/tx_validator/archive_cache.d.ts +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +5 -4
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +4 -3
- package/dest/msg_validators/tx_validator/data_validator.d.ts +3 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +4 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +3 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +4 -3
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +12 -12
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +3 -2
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +2 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +3 -3
- package/dest/msg_validators/tx_validator/size_validator.d.ts +3 -1
- package/dest/msg_validators/tx_validator/size_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/size_validator.js +4 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_permitted_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -2
- package/dest/services/data_store.d.ts +1 -1
- package/dest/services/data_store.d.ts.map +1 -1
- package/dest/services/data_store.js +10 -6
- package/dest/services/discv5/discV5_service.js +1 -1
- package/dest/services/dummy_service.d.ts +6 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +3 -0
- package/dest/services/index.d.ts +2 -1
- package/dest/services/index.d.ts.map +1 -1
- package/dest/services/index.js +1 -0
- package/dest/services/libp2p/instrumentation.d.ts +1 -1
- package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
- package/dest/services/libp2p/instrumentation.js +14 -3
- package/dest/services/libp2p/libp2p_service.d.ts +74 -33
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +309 -238
- package/dest/services/peer-manager/metrics.d.ts +2 -2
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +20 -5
- package/dest/services/peer-manager/peer_scoring.d.ts +1 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +8 -2
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +4 -4
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +9 -9
- package/dest/services/reqresp/metrics.d.ts +6 -5
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +17 -5
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +6 -4
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +17 -12
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +19 -14
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +25 -24
- package/dest/services/service.d.ts +18 -1
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +3 -3
- package/dest/services/tx_collection/config.js +3 -3
- package/dest/services/tx_collection/fast_tx_collection.d.ts +4 -5
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +10 -14
- package/dest/services/tx_collection/index.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +9 -2
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +12 -12
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +4 -5
- package/dest/services/tx_file_store/config.d.ts +18 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +26 -0
- package/dest/services/tx_file_store/index.d.ts +4 -0
- package/dest/services/tx_file_store/index.d.ts.map +1 -0
- package/dest/services/tx_file_store/index.js +3 -0
- package/dest/services/tx_file_store/instrumentation.d.ts +15 -0
- package/dest/services/tx_file_store/instrumentation.d.ts.map +1 -0
- package/dest/services/tx_file_store/instrumentation.js +29 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts +47 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -0
- package/dest/services/tx_file_store/tx_file_store.js +149 -0
- package/dest/services/tx_provider_instrumentation.d.ts +1 -1
- package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
- package/dest/services/tx_provider_instrumentation.js +5 -5
- package/dest/test-helpers/testbench-utils.d.ts +12 -16
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +34 -31
- package/dest/testbench/p2p_client_testbench_worker.js +2 -2
- package/package.json +14 -14
- package/src/bootstrap/bootstrap.ts +7 -4
- package/src/client/factory.ts +12 -13
- package/src/client/interface.ts +13 -1
- package/src/client/p2p_client.ts +32 -8
- package/src/client/test/tx_proposal_collector/README.md +4 -4
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +2 -2
- package/src/config.ts +8 -1
- package/src/mem_pools/attestation_pool/attestation_pool.ts +444 -90
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +436 -100
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/index.ts +1 -1
- package/src/mem_pools/instrumentation.ts +2 -1
- package/src/mem_pools/interface.ts +2 -2
- package/src/mem_pools/tx_pool_v2/README.md +209 -0
- package/src/mem_pools/tx_pool_v2/archive/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +120 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +147 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +118 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +111 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +23 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +164 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +74 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +101 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +86 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +72 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +11 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +227 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +161 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_bench_metrics.ts +77 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +417 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +212 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +882 -0
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +10 -4
- package/src/msg_validators/tx_validator/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +7 -8
- package/src/msg_validators/tx_validator/data_validator.ts +6 -2
- package/src/msg_validators/tx_validator/double_spend_validator.ts +4 -3
- package/src/msg_validators/tx_validator/factory.ts +46 -30
- package/src/msg_validators/tx_validator/gas_validator.ts +9 -3
- package/src/msg_validators/tx_validator/metadata_validator.ts +6 -3
- package/src/msg_validators/tx_validator/phases_validator.ts +5 -3
- package/src/msg_validators/tx_validator/size_validator.ts +6 -2
- package/src/msg_validators/tx_validator/timestamp_validator.ts +6 -3
- package/src/msg_validators/tx_validator/tx_permitted_validator.ts +8 -3
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +8 -3
- package/src/services/data_store.ts +10 -7
- package/src/services/discv5/discV5_service.ts +1 -1
- package/src/services/dummy_service.ts +6 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/instrumentation.ts +15 -2
- package/src/services/libp2p/libp2p_service.ts +324 -246
- package/src/services/peer-manager/metrics.ts +21 -4
- package/src/services/peer-manager/peer_scoring.ts +4 -1
- package/src/services/reqresp/batch-tx-requester/README.md +14 -14
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +12 -12
- package/src/services/reqresp/metrics.ts +34 -9
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +23 -14
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +30 -24
- package/src/services/service.ts +20 -0
- package/src/services/tx_collection/config.ts +6 -6
- package/src/services/tx_collection/fast_tx_collection.ts +14 -24
- package/src/services/tx_collection/index.ts +1 -1
- package/src/services/tx_collection/instrumentation.ts +11 -2
- package/src/services/tx_collection/proposal_tx_collector.ts +12 -14
- package/src/services/tx_file_store/config.ts +43 -0
- package/src/services/tx_file_store/index.ts +3 -0
- package/src/services/tx_file_store/instrumentation.ts +36 -0
- package/src/services/tx_file_store/tx_file_store.ts +173 -0
- package/src/services/tx_provider_instrumentation.ts +11 -5
- package/src/test-helpers/testbench-utils.ts +20 -39
- package/src/testbench/p2p_client_testbench_worker.ts +2 -2
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -40
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +0 -218
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -31
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +0 -180
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +0 -320
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +0 -264
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
2
|
import { type CheckpointAttestation, PeerErrorSeverity, type ValidationResult } from '@aztec/stdlib/p2p';
|
|
3
|
-
import { Attributes, Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
+
import { Attributes, Metrics, type TelemetryClient, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { AttestationPoolApi } from '../../mem_pools/attestation_pool/attestation_pool.js';
|
|
6
6
|
import { CheckpointAttestationValidator } from './attestation_validator.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,14 +18,20 @@ export class FishermanAttestationValidator extends CheckpointAttestationValidato
|
|
|
18
18
|
|
|
19
19
|
constructor(
|
|
20
20
|
epochCache: EpochCacheInterface,
|
|
21
|
-
private attestationPool:
|
|
21
|
+
private attestationPool: AttestationPoolApi,
|
|
22
22
|
telemetryClient: TelemetryClient,
|
|
23
23
|
) {
|
|
24
24
|
super(epochCache);
|
|
25
25
|
this.logger = this.logger.createChild('[FISHERMAN]');
|
|
26
26
|
|
|
27
27
|
const meter = telemetryClient.getMeter('FishermanAttestationValidator');
|
|
28
|
-
this.invalidAttestationCounter =
|
|
28
|
+
this.invalidAttestationCounter = createUpDownCounterWithDefault(
|
|
29
|
+
meter,
|
|
30
|
+
Metrics.VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT,
|
|
31
|
+
{
|
|
32
|
+
[Attributes.ERROR_TYPE]: ['base_validation_failed', 'payload_mismatch'],
|
|
33
|
+
},
|
|
34
|
+
);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
override async validate(message: CheckpointAttestation): Promise<ValidationResult> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import type { ArchiveSource } from '@aztec/p2p';
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
5
5
|
|
|
@@ -14,8 +14,8 @@ export class ArchiveCache implements ArchiveSource {
|
|
|
14
14
|
this.archives = new Map<string, bigint>();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public async getArchiveIndices(archives:
|
|
18
|
-
const toCheckDb = archives.filter(n => !this.archives.has(n.toString()));
|
|
17
|
+
public async getArchiveIndices(archives: BlockHash[]): Promise<(bigint | undefined)[]> {
|
|
18
|
+
const toCheckDb = archives.filter(n => !this.archives.has(n.toString())).map(n => n.toFr());
|
|
19
19
|
const dbHits = await this.db.findLeafIndices(MerkleTreeId.ARCHIVE, toCheckDb);
|
|
20
20
|
dbHits.forEach((x, index) => {
|
|
21
21
|
if (x !== undefined) {
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import { type AnyTx, TX_ERROR_BLOCK_HEADER, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export interface ArchiveSource {
|
|
6
|
-
getArchiveIndices: (archives:
|
|
6
|
+
getArchiveIndices: (archives: BlockHash[]) => Promise<(bigint | undefined)[]>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class BlockHeaderTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
10
|
-
#log
|
|
10
|
+
#log: Logger;
|
|
11
11
|
#archiveSource: ArchiveSource;
|
|
12
12
|
|
|
13
|
-
constructor(archiveSource: ArchiveSource) {
|
|
13
|
+
constructor(archiveSource: ArchiveSource, bindings?: LoggerBindings) {
|
|
14
14
|
this.#archiveSource = archiveSource;
|
|
15
|
+
this.#log = createLogger('p2p:tx_validator:tx_block_header', bindings);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
18
|
-
const [index] = await this.#archiveSource.getArchiveIndices([
|
|
19
|
-
(await tx.data.constants.anchorBlockHeader.hash()).toField(),
|
|
20
|
-
]);
|
|
19
|
+
const [index] = await this.#archiveSource.getArchiveIndices([await tx.data.constants.anchorBlockHeader.hash()]);
|
|
21
20
|
if (index === undefined) {
|
|
22
21
|
this.#log.verbose(`Rejecting tx ${'txHash' in tx ? tx.txHash : tx.hash} for referencing an unknown block header`);
|
|
23
22
|
return { result: 'invalid', reason: [TX_ERROR_BLOCK_HEADER] };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { computeCalldataHash } from '@aztec/stdlib/hash';
|
|
4
4
|
import {
|
|
5
5
|
TX_ERROR_CALLDATA_COUNT_MISMATCH,
|
|
@@ -16,7 +16,11 @@ import {
|
|
|
16
16
|
} from '@aztec/stdlib/tx';
|
|
17
17
|
|
|
18
18
|
export class DataTxValidator implements TxValidator<Tx> {
|
|
19
|
-
#log
|
|
19
|
+
#log: Logger;
|
|
20
|
+
|
|
21
|
+
constructor(bindings?: LoggerBindings) {
|
|
22
|
+
this.#log = createLogger('p2p:tx_validator:tx_data', bindings);
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
22
26
|
const reason =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import {
|
|
3
3
|
type AnyTx,
|
|
4
4
|
TX_ERROR_DUPLICATE_NULLIFIER_IN_TX,
|
|
@@ -13,11 +13,12 @@ export interface NullifierSource {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export class DoubleSpendTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
16
|
-
#log
|
|
16
|
+
#log: Logger;
|
|
17
17
|
#nullifierSource: NullifierSource;
|
|
18
18
|
|
|
19
|
-
constructor(nullifierSource: NullifierSource) {
|
|
19
|
+
constructor(nullifierSource: NullifierSource, bindings?: LoggerBindings) {
|
|
20
20
|
this.#nullifierSource = nullifierSource;
|
|
21
|
+
this.#log = createLogger('p2p:tx_validator:tx_double_spend', bindings);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
3
4
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
5
|
import { ProtocolContractAddress, protocolContractsHash } from '@aztec/protocol-contracts';
|
|
5
6
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
@@ -46,43 +47,53 @@ export function createTxMessageValidators(
|
|
|
46
47
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
47
48
|
txsPermitted: boolean,
|
|
48
49
|
allowedInSetup: AllowedElement[] = [],
|
|
50
|
+
bindings?: LoggerBindings,
|
|
49
51
|
): Record<string, MessageValidator>[] {
|
|
50
52
|
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
51
53
|
|
|
52
54
|
return [
|
|
53
55
|
{
|
|
54
56
|
txsPermittedValidator: {
|
|
55
|
-
validator: new TxPermittedValidator(txsPermitted),
|
|
57
|
+
validator: new TxPermittedValidator(txsPermitted, bindings),
|
|
56
58
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
57
59
|
},
|
|
58
60
|
dataValidator: {
|
|
59
|
-
validator: new DataTxValidator(),
|
|
61
|
+
validator: new DataTxValidator(bindings),
|
|
60
62
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
61
63
|
},
|
|
62
64
|
metadataValidator: {
|
|
63
|
-
validator: new MetadataTxValidator(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
validator: new MetadataTxValidator(
|
|
66
|
+
{
|
|
67
|
+
l1ChainId: new Fr(l1ChainId),
|
|
68
|
+
rollupVersion: new Fr(rollupVersion),
|
|
69
|
+
protocolContractsHash,
|
|
70
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
71
|
+
},
|
|
72
|
+
bindings,
|
|
73
|
+
),
|
|
69
74
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
70
75
|
},
|
|
71
76
|
timestampValidator: {
|
|
72
|
-
validator: new TimestampTxValidator<Tx>(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
validator: new TimestampTxValidator<Tx>(
|
|
78
|
+
{
|
|
79
|
+
timestamp,
|
|
80
|
+
blockNumber,
|
|
81
|
+
},
|
|
82
|
+
bindings,
|
|
83
|
+
),
|
|
76
84
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
77
85
|
},
|
|
78
86
|
doubleSpendValidator: {
|
|
79
|
-
validator: new DoubleSpendTxValidator(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
validator: new DoubleSpendTxValidator(
|
|
88
|
+
{
|
|
89
|
+
nullifiersExist: async (nullifiers: Buffer[]) => {
|
|
90
|
+
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
91
|
+
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
|
|
92
|
+
return indices.map(index => index !== undefined);
|
|
93
|
+
},
|
|
84
94
|
},
|
|
85
|
-
|
|
95
|
+
bindings,
|
|
96
|
+
),
|
|
86
97
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
87
98
|
},
|
|
88
99
|
gasValidator: {
|
|
@@ -90,21 +101,22 @@ export function createTxMessageValidators(
|
|
|
90
101
|
new DatabasePublicStateSource(merkleTree),
|
|
91
102
|
ProtocolContractAddress.FeeJuice,
|
|
92
103
|
gasFees,
|
|
104
|
+
bindings,
|
|
93
105
|
),
|
|
94
106
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
95
107
|
},
|
|
96
108
|
phasesValidator: {
|
|
97
|
-
validator: new PhasesTxValidator(contractDataSource, allowedInSetup, timestamp),
|
|
109
|
+
validator: new PhasesTxValidator(contractDataSource, allowedInSetup, timestamp, bindings),
|
|
98
110
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
99
111
|
},
|
|
100
112
|
blockHeaderValidator: {
|
|
101
|
-
validator: new BlockHeaderTxValidator(new ArchiveCache(merkleTree)),
|
|
113
|
+
validator: new BlockHeaderTxValidator(new ArchiveCache(merkleTree), bindings),
|
|
102
114
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
103
115
|
},
|
|
104
116
|
},
|
|
105
117
|
{
|
|
106
118
|
proofValidator: {
|
|
107
|
-
validator: new TxProofValidator(proofVerifier),
|
|
119
|
+
validator: new TxProofValidator(proofVerifier, bindings),
|
|
108
120
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
109
121
|
},
|
|
110
122
|
},
|
|
@@ -120,16 +132,20 @@ export function createTxReqRespValidator(
|
|
|
120
132
|
l1ChainId: number;
|
|
121
133
|
rollupVersion: number;
|
|
122
134
|
},
|
|
135
|
+
bindings?: LoggerBindings,
|
|
123
136
|
): TxValidator {
|
|
124
137
|
return new AggregateTxValidator(
|
|
125
|
-
new MetadataTxValidator(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
new MetadataTxValidator(
|
|
139
|
+
{
|
|
140
|
+
l1ChainId: new Fr(l1ChainId),
|
|
141
|
+
rollupVersion: new Fr(rollupVersion),
|
|
142
|
+
protocolContractsHash,
|
|
143
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
144
|
+
},
|
|
145
|
+
bindings,
|
|
146
|
+
),
|
|
147
|
+
new SizeTxValidator(bindings),
|
|
148
|
+
new DataTxValidator(bindings),
|
|
149
|
+
new TxProofValidator(verifier, bindings),
|
|
134
150
|
);
|
|
135
151
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AVM_MAX_PROCESSABLE_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { Gas, GasFees } from '@aztec/stdlib/gas';
|
|
@@ -17,12 +17,18 @@ import {
|
|
|
17
17
|
import { getFeePayerClaimAmount, getTxFeeLimit } from './fee_payer_balance.js';
|
|
18
18
|
|
|
19
19
|
export class GasTxValidator implements TxValidator<Tx> {
|
|
20
|
-
#log
|
|
20
|
+
#log: Logger;
|
|
21
21
|
#publicDataSource: PublicStateSource;
|
|
22
22
|
#feeJuiceAddress: AztecAddress;
|
|
23
23
|
#gasFees: GasFees;
|
|
24
24
|
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(
|
|
26
|
+
publicDataSource: PublicStateSource,
|
|
27
|
+
feeJuiceAddress: AztecAddress,
|
|
28
|
+
gasFees: GasFees,
|
|
29
|
+
bindings?: LoggerBindings,
|
|
30
|
+
) {
|
|
31
|
+
this.#log = createLogger('sequencer:tx_validator:tx_gas', bindings);
|
|
26
32
|
this.#publicDataSource = publicDataSource;
|
|
27
33
|
this.#feeJuiceAddress = feeJuiceAddress;
|
|
28
34
|
this.#gasFees = gasFees;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import {
|
|
4
4
|
type AnyTx,
|
|
5
5
|
TX_ERROR_INCORRECT_L1_CHAIN_ID,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@aztec/stdlib/tx';
|
|
12
12
|
|
|
13
13
|
export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
14
|
-
#log
|
|
14
|
+
#log: Logger;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
17
|
private values: {
|
|
@@ -20,7 +20,10 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
20
20
|
vkTreeRoot: Fr;
|
|
21
21
|
protocolContractsHash: Fr;
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
bindings?: LoggerBindings,
|
|
24
|
+
) {
|
|
25
|
+
this.#log = createLogger('p2p:tx_validator:tx_metadata', bindings);
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
validateTx(tx: T): Promise<TxValidationResult> {
|
|
26
29
|
const errors = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { PublicContractsDB, getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
3
3
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
@@ -14,15 +14,17 @@ import {
|
|
|
14
14
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
15
15
|
|
|
16
16
|
export class PhasesTxValidator implements TxValidator<Tx> {
|
|
17
|
-
#log
|
|
17
|
+
#log: Logger;
|
|
18
18
|
private contractsDB: PublicContractsDB;
|
|
19
19
|
|
|
20
20
|
constructor(
|
|
21
21
|
contracts: ContractDataSource,
|
|
22
22
|
private setupAllowList: AllowedElement[],
|
|
23
23
|
private timestamp: UInt64,
|
|
24
|
+
bindings?: LoggerBindings,
|
|
24
25
|
) {
|
|
25
|
-
this
|
|
26
|
+
this.#log = createLogger('sequencer:tx_validator:tx_phases', bindings);
|
|
27
|
+
this.contractsDB = new PublicContractsDB(contracts, bindings);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { MAX_TX_SIZE_KB } from '@aztec/stdlib/p2p';
|
|
3
3
|
import { Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export class SizeTxValidator implements TxValidator<Tx> {
|
|
6
|
-
#log
|
|
6
|
+
#log: Logger;
|
|
7
|
+
|
|
8
|
+
constructor(bindings?: LoggerBindings) {
|
|
9
|
+
this.#log = createLogger('p2p:tx_validator:tx_size', bindings);
|
|
10
|
+
}
|
|
7
11
|
|
|
8
12
|
validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
9
13
|
const txSize = tx.getSize();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import {
|
|
4
4
|
type AnyTx,
|
|
5
5
|
TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
11
11
|
|
|
12
12
|
export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
13
|
-
#log
|
|
13
|
+
#log: Logger;
|
|
14
14
|
|
|
15
15
|
constructor(
|
|
16
16
|
private values: {
|
|
@@ -20,7 +20,10 @@ export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
20
20
|
// Block number in which the tx is considered to be included.
|
|
21
21
|
blockNumber: BlockNumber;
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
bindings?: LoggerBindings,
|
|
24
|
+
) {
|
|
25
|
+
this.#log = createLogger('p2p:tx_validator:timestamp', bindings);
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
validateTx(tx: T): Promise<TxValidationResult> {
|
|
26
29
|
const includeByTimestamp = tx.data.includeByTimestamp;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import type { Tx, TxValidationResult, TxValidator } from '@aztec/stdlib/tx';
|
|
3
3
|
|
|
4
4
|
export class TxPermittedValidator implements TxValidator<Tx> {
|
|
5
|
-
#log
|
|
5
|
+
#log: Logger;
|
|
6
6
|
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
private permitted: boolean,
|
|
9
|
+
bindings?: LoggerBindings,
|
|
10
|
+
) {
|
|
11
|
+
this.#log = createLogger('p2p:tx_validator:tx_permitted', bindings);
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
10
15
|
if (!this.permitted) {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import { TX_ERROR_INVALID_PROOF, Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export class TxProofValidator implements TxValidator<Tx> {
|
|
6
|
-
#log
|
|
6
|
+
#log: Logger;
|
|
7
7
|
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(
|
|
9
|
+
private verifier: ClientProtocolCircuitVerifier,
|
|
10
|
+
bindings?: LoggerBindings,
|
|
11
|
+
) {
|
|
12
|
+
this.#log = createLogger('p2p:tx_validator:proof', bindings);
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
11
16
|
const result = await this.verifier.verifyProof(tx);
|
|
@@ -24,6 +24,7 @@ class KeyNotFoundError extends Error {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class AztecDatastore implements Datastore {
|
|
27
|
+
#db: AztecAsyncKVStore;
|
|
27
28
|
#memoryDatastore: Map<string, MemoryItem>;
|
|
28
29
|
#dbDatastore: AztecAsyncMap<string, Uint8Array>;
|
|
29
30
|
|
|
@@ -32,9 +33,9 @@ export class AztecDatastore implements Datastore {
|
|
|
32
33
|
private maxMemoryItems: number;
|
|
33
34
|
|
|
34
35
|
constructor(db: AztecAsyncKVStore, { maxMemoryItems } = { maxMemoryItems: 50 }) {
|
|
36
|
+
this.#db = db;
|
|
35
37
|
this.#memoryDatastore = new Map();
|
|
36
38
|
this.#dbDatastore = db.openMap('p2p_datastore');
|
|
37
|
-
|
|
38
39
|
this.maxMemoryItems = maxMemoryItems;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -106,13 +107,15 @@ export class AztecDatastore implements Datastore {
|
|
|
106
107
|
});
|
|
107
108
|
},
|
|
108
109
|
commit: async () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
await this.#db.transactionAsync(async () => {
|
|
111
|
+
for (const op of this.#batchOps) {
|
|
112
|
+
if (op.type === 'put' && op.value) {
|
|
113
|
+
await this.put(op.key, op.value);
|
|
114
|
+
} else if (op.type === 'del') {
|
|
115
|
+
await this.delete(op.key);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
|
-
}
|
|
118
|
+
});
|
|
116
119
|
this.#batchOps = []; // Clear operations after commit
|
|
117
120
|
},
|
|
118
121
|
};
|
|
@@ -87,7 +87,7 @@ export class DiscV5Service extends EventEmitter implements PeerDiscoveryService
|
|
|
87
87
|
this.packageVersion,
|
|
88
88
|
));
|
|
89
89
|
|
|
90
|
-
const metricsRegistry = new OtelMetricsAdapter(telemetry);
|
|
90
|
+
const metricsRegistry = new OtelMetricsAdapter(telemetry, this.logger.getBindings());
|
|
91
91
|
this.discv5 = Discv5.create({
|
|
92
92
|
enr: this.enr,
|
|
93
93
|
peerId,
|
|
@@ -26,6 +26,7 @@ import { ReqRespStatus } from './reqresp/status.js';
|
|
|
26
26
|
import {
|
|
27
27
|
type P2PBlockReceivedCallback,
|
|
28
28
|
type P2PCheckpointReceivedCallback,
|
|
29
|
+
type P2PDuplicateProposalCallback,
|
|
29
30
|
type P2PService,
|
|
30
31
|
type PeerDiscoveryService,
|
|
31
32
|
PeerDiscoveryState,
|
|
@@ -82,6 +83,11 @@ export class DummyP2PService implements P2PService {
|
|
|
82
83
|
*/
|
|
83
84
|
public registerCheckpointReceivedCallback(_callback: P2PCheckpointReceivedCallback) {}
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Register a callback for when a duplicate proposal is detected
|
|
88
|
+
*/
|
|
89
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {}
|
|
90
|
+
|
|
85
91
|
/**
|
|
86
92
|
* Sends a request to a peer.
|
|
87
93
|
* @param _protocol - The protocol to send the request on.
|
package/src/services/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type ObservableGauge,
|
|
9
9
|
type TelemetryClient,
|
|
10
10
|
type UpDownCounter,
|
|
11
|
+
createUpDownCounterWithDefault,
|
|
11
12
|
} from '@aztec/telemetry-client';
|
|
12
13
|
|
|
13
14
|
import { type RecordableHistogram, createHistogram } from 'node:perf_hooks';
|
|
@@ -29,11 +30,23 @@ export class P2PInstrumentation {
|
|
|
29
30
|
|
|
30
31
|
this.messageValidationDuration = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_VALIDATION_DURATION);
|
|
31
32
|
|
|
32
|
-
this.messagePrevalidationCount =
|
|
33
|
+
this.messagePrevalidationCount = createUpDownCounterWithDefault(
|
|
34
|
+
meter,
|
|
35
|
+
Metrics.P2P_GOSSIP_MESSAGE_PREVALIDATION_COUNT,
|
|
36
|
+
{
|
|
37
|
+
[Attributes.TOPIC_NAME]: [
|
|
38
|
+
TopicType.tx,
|
|
39
|
+
TopicType.block_proposal,
|
|
40
|
+
TopicType.checkpoint_proposal,
|
|
41
|
+
TopicType.checkpoint_attestation,
|
|
42
|
+
],
|
|
43
|
+
[Attributes.OK]: [true, false],
|
|
44
|
+
},
|
|
45
|
+
);
|
|
33
46
|
|
|
34
47
|
this.messageLatency = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_LATENCY);
|
|
35
48
|
|
|
36
|
-
this.txReceivedCount = meter
|
|
49
|
+
this.txReceivedCount = createUpDownCounterWithDefault(meter, Metrics.P2P_GOSSIP_TX_RECEIVED_COUNT);
|
|
37
50
|
|
|
38
51
|
this.aggLatencyMetrics = {
|
|
39
52
|
avg: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_AVG),
|