@aztec/p2p 0.0.1-commit.b2a5d0dd1 → 0.0.1-commit.b3d3157a

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.
Files changed (243) hide show
  1. package/dest/bootstrap/bootstrap.d.ts +1 -1
  2. package/dest/bootstrap/bootstrap.d.ts.map +1 -1
  3. package/dest/bootstrap/bootstrap.js +9 -1
  4. package/dest/client/factory.d.ts +3 -3
  5. package/dest/client/factory.d.ts.map +1 -1
  6. package/dest/client/factory.js +12 -9
  7. package/dest/client/interface.d.ts +6 -4
  8. package/dest/client/interface.d.ts.map +1 -1
  9. package/dest/client/p2p_client.d.ts +11 -8
  10. package/dest/client/p2p_client.d.ts.map +1 -1
  11. package/dest/client/p2p_client.js +53 -17
  12. package/dest/config.d.ts +43 -17
  13. package/dest/config.d.ts.map +1 -1
  14. package/dest/config.js +48 -8
  15. package/dest/errors/reqresp.error.d.ts +1 -20
  16. package/dest/errors/reqresp.error.d.ts.map +1 -1
  17. package/dest/errors/reqresp.error.js +0 -21
  18. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +93 -55
  19. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
  20. package/dest/mem_pools/attestation_pool/attestation_pool.js +258 -195
  21. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
  22. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
  23. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +175 -59
  24. package/dest/mem_pools/attestation_pool/mocks.d.ts +1 -1
  25. package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
  26. package/dest/mem_pools/attestation_pool/mocks.js +6 -4
  27. package/dest/mem_pools/instrumentation.d.ts +1 -1
  28. package/dest/mem_pools/instrumentation.d.ts.map +1 -1
  29. package/dest/mem_pools/instrumentation.js +17 -1
  30. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +1 -5
  31. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -1
  32. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +1 -7
  33. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
  34. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  35. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +73 -83
  36. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +5 -2
  37. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
  38. package/dest/msg_validators/attestation_validator/attestation_validator.js +18 -2
  39. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +5 -3
  40. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
  41. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +3 -4
  42. package/dest/msg_validators/clock_tolerance.d.ts +1 -1
  43. package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
  44. package/dest/msg_validators/clock_tolerance.js +13 -11
  45. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +5 -2
  46. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
  47. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +5 -2
  48. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
  49. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +8 -2
  50. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
  51. package/dest/msg_validators/proposal_validator/proposal_validator.js +28 -2
  52. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +1 -1
  53. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
  54. package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +8 -15
  55. package/dest/msg_validators/tx_validator/allowed_public_setup.js +3 -3
  56. package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts +15 -0
  57. package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts.map +1 -0
  58. package/dest/msg_validators/tx_validator/cached_tx_validator.js +19 -0
  59. package/dest/msg_validators/tx_validator/data_validator.d.ts +2 -1
  60. package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
  61. package/dest/msg_validators/tx_validator/data_validator.js +1 -0
  62. package/dest/msg_validators/tx_validator/factory.d.ts +5 -4
  63. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  64. package/dest/msg_validators/tx_validator/factory.js +11 -7
  65. package/dest/msg_validators/tx_validator/index.d.ts +3 -1
  66. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  67. package/dest/msg_validators/tx_validator/index.js +2 -0
  68. package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +2 -1
  69. package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
  70. package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -0
  71. package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts +48 -0
  72. package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts.map +1 -0
  73. package/dest/msg_validators/tx_validator/tx_validation_cache.js +68 -0
  74. package/dest/services/discv5/discV5_service.d.ts +2 -1
  75. package/dest/services/discv5/discV5_service.d.ts.map +1 -1
  76. package/dest/services/discv5/discV5_service.js +35 -8
  77. package/dest/services/dummy_service.d.ts +10 -17
  78. package/dest/services/dummy_service.d.ts.map +1 -1
  79. package/dest/services/dummy_service.js +9 -18
  80. package/dest/services/libp2p/libp2p_service.d.ts +19 -21
  81. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  82. package/dest/services/libp2p/libp2p_service.js +147 -148
  83. package/dest/services/peer-manager/peer_manager.d.ts +1 -1
  84. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  85. package/dest/services/peer-manager/peer_manager.js +1 -0
  86. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +1 -8
  87. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  88. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +35 -44
  89. package/dest/services/reqresp/batch-tx-requester/interface.d.ts +8 -5
  90. package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
  91. package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +5 -14
  92. package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -1
  93. package/dest/services/reqresp/batch-tx-requester/tx_validator.js +6 -20
  94. package/dest/services/reqresp/interface.d.ts +3 -10
  95. package/dest/services/reqresp/interface.d.ts.map +1 -1
  96. package/dest/services/reqresp/interface.js +0 -9
  97. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +4 -3
  98. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
  99. package/dest/services/reqresp/protocols/block_txs/bitvector.js +3 -2
  100. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
  101. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
  102. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +31 -28
  103. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +12 -7
  104. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
  105. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +42 -24
  106. package/dest/services/reqresp/reqresp.d.ts +5 -29
  107. package/dest/services/reqresp/reqresp.d.ts.map +1 -1
  108. package/dest/services/reqresp/reqresp.js +16 -206
  109. package/dest/services/service.d.ts +7 -13
  110. package/dest/services/service.d.ts.map +1 -1
  111. package/dest/services/tx_collection/config.d.ts +2 -23
  112. package/dest/services/tx_collection/config.d.ts.map +1 -1
  113. package/dest/services/tx_collection/config.js +2 -55
  114. package/dest/services/tx_collection/file_store_tx_collection.d.ts +12 -28
  115. package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
  116. package/dest/services/tx_collection/file_store_tx_collection.js +43 -83
  117. package/dest/services/tx_collection/index.d.ts +2 -3
  118. package/dest/services/tx_collection/index.d.ts.map +1 -1
  119. package/dest/services/tx_collection/index.js +0 -1
  120. package/dest/services/tx_collection/instrumentation.d.ts +1 -1
  121. package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
  122. package/dest/services/tx_collection/instrumentation.js +0 -2
  123. package/dest/services/tx_collection/tx_collection.d.ts +35 -51
  124. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  125. package/dest/services/tx_collection/tx_collection.js +275 -119
  126. package/dest/services/tx_collection/tx_collection_sink.d.ts +1 -1
  127. package/dest/services/tx_collection/tx_collection_sink.js +2 -2
  128. package/dest/services/tx_file_store/tx_file_store.d.ts +1 -3
  129. package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
  130. package/dest/services/tx_file_store/tx_file_store.js +4 -14
  131. package/dest/services/tx_provider.d.ts +3 -1
  132. package/dest/services/tx_provider.d.ts.map +1 -1
  133. package/dest/services/tx_provider.js +3 -0
  134. package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
  135. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  136. package/dest/test-helpers/make-test-p2p-clients.js +1 -1
  137. package/dest/test-helpers/mock-pubsub.d.ts +13 -7
  138. package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
  139. package/dest/test-helpers/mock-pubsub.js +12 -37
  140. package/dest/test-helpers/reqresp-nodes.d.ts +4 -5
  141. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  142. package/dest/test-helpers/reqresp-nodes.js +11 -15
  143. package/dest/test-helpers/test_tx_provider.d.ts +3 -1
  144. package/dest/test-helpers/test_tx_provider.d.ts.map +1 -1
  145. package/dest/test-helpers/test_tx_provider.js +3 -0
  146. package/dest/test-helpers/testbench-utils.d.ts +12 -14
  147. package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
  148. package/dest/test-helpers/testbench-utils.js +19 -14
  149. package/dest/testbench/p2p_client_testbench_worker.d.ts +3 -5
  150. package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
  151. package/dest/testbench/p2p_client_testbench_worker.js +13 -24
  152. package/dest/testbench/worker_client_manager.d.ts +3 -6
  153. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  154. package/dest/testbench/worker_client_manager.js +2 -8
  155. package/dest/util.d.ts +11 -6
  156. package/dest/util.d.ts.map +1 -1
  157. package/dest/util.js +35 -14
  158. package/dest/versioning.d.ts +3 -6
  159. package/dest/versioning.d.ts.map +1 -1
  160. package/dest/versioning.js +3 -24
  161. package/package.json +15 -14
  162. package/src/bootstrap/bootstrap.ts +9 -1
  163. package/src/client/factory.ts +20 -5
  164. package/src/client/interface.ts +6 -10
  165. package/src/client/p2p_client.ts +61 -36
  166. package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
  167. package/src/config.ts +94 -6
  168. package/src/errors/reqresp.error.ts +0 -25
  169. package/src/mem_pools/attestation_pool/attestation_pool.ts +309 -238
  170. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +198 -62
  171. package/src/mem_pools/attestation_pool/mocks.ts +13 -8
  172. package/src/mem_pools/instrumentation.ts +5 -1
  173. package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +1 -9
  174. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +73 -90
  175. package/src/msg_validators/attestation_validator/attestation_validator.ts +21 -1
  176. package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +11 -7
  177. package/src/msg_validators/clock_tolerance.ts +13 -12
  178. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +9 -2
  179. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +14 -2
  180. package/src/msg_validators/proposal_validator/proposal_validator.ts +39 -2
  181. package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -12
  182. package/src/msg_validators/tx_validator/allowed_public_setup.ts +3 -3
  183. package/src/msg_validators/tx_validator/cached_tx_validator.ts +31 -0
  184. package/src/msg_validators/tx_validator/data_validator.ts +2 -0
  185. package/src/msg_validators/tx_validator/factory.ts +15 -6
  186. package/src/msg_validators/tx_validator/index.ts +2 -0
  187. package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
  188. package/src/msg_validators/tx_validator/tx_validation_cache.ts +101 -0
  189. package/src/services/discv5/discV5_service.ts +38 -5
  190. package/src/services/dummy_service.ts +12 -43
  191. package/src/services/libp2p/libp2p_service.ts +169 -167
  192. package/src/services/peer-manager/peer_manager.ts +1 -0
  193. package/src/services/reqresp/README.md +0 -14
  194. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +39 -52
  195. package/src/services/reqresp/batch-tx-requester/interface.ts +11 -4
  196. package/src/services/reqresp/batch-tx-requester/tx_validator.ts +12 -25
  197. package/src/services/reqresp/interface.ts +2 -38
  198. package/src/services/reqresp/protocols/block_txs/bitvector.ts +3 -2
  199. package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +34 -30
  200. package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -20
  201. package/src/services/reqresp/reqresp.ts +11 -251
  202. package/src/services/service.ts +9 -30
  203. package/src/services/tx_collection/config.ts +3 -80
  204. package/src/services/tx_collection/file_store_tx_collection.ts +54 -103
  205. package/src/services/tx_collection/index.ts +1 -6
  206. package/src/services/tx_collection/instrumentation.ts +1 -7
  207. package/src/services/tx_collection/tx_collection.ts +330 -173
  208. package/src/services/tx_collection/tx_collection_sink.ts +2 -2
  209. package/src/services/tx_file_store/tx_file_store.ts +5 -17
  210. package/src/services/tx_provider.ts +5 -0
  211. package/src/test-helpers/make-test-p2p-clients.ts +1 -0
  212. package/src/test-helpers/mock-pubsub.ts +17 -60
  213. package/src/test-helpers/reqresp-nodes.ts +8 -20
  214. package/src/test-helpers/test_tx_provider.ts +5 -0
  215. package/src/test-helpers/testbench-utils.ts +23 -27
  216. package/src/testbench/p2p_client_testbench_worker.ts +16 -42
  217. package/src/testbench/worker_client_manager.ts +4 -19
  218. package/src/util.ts +32 -17
  219. package/src/versioning.ts +3 -33
  220. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +0 -2
  221. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +0 -1
  222. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +0 -318
  223. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +0 -73
  224. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +0 -1
  225. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +0 -8
  226. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +0 -64
  227. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +0 -1
  228. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +0 -151
  229. package/dest/services/tx_collection/fast_tx_collection.d.ts +0 -51
  230. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
  231. package/dest/services/tx_collection/fast_tx_collection.js +0 -311
  232. package/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -48
  233. package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +0 -1
  234. package/dest/services/tx_collection/proposal_tx_collector.js +0 -50
  235. package/dest/services/tx_collection/slow_tx_collection.d.ts +0 -57
  236. package/dest/services/tx_collection/slow_tx_collection.d.ts.map +0 -1
  237. package/dest/services/tx_collection/slow_tx_collection.js +0 -211
  238. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +0 -357
  239. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +0 -43
  240. package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +0 -161
  241. package/src/services/tx_collection/fast_tx_collection.ts +0 -361
  242. package/src/services/tx_collection/proposal_tx_collector.ts +0 -108
  243. package/src/services/tx_collection/slow_tx_collection.ts +0 -266
@@ -28,9 +28,16 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
28
28
  signers = Array.from({ length: NUMBER_OF_SIGNERS_PER_TEST }, () => Secp256k1Signer.random());
29
29
  });
30
30
 
31
+ /**
32
+ * Build attestations from each signer over the *same* signed payload (same header,
33
+ * archive, feeAssetPriceModifier). Required by the new pool, which deduplicates by
34
+ * payload hash and treats attestations from different signers as distinct entries
35
+ * only when the payload itself matches.
36
+ */
31
37
  const createCheckpointAttestationsForSlot = (slotNumber: number, archive?: Fr) => {
32
38
  const archiveToUse = archive ?? Fr.random();
33
- return signers.map(signer => mockCheckpointAttestation(signer, slotNumber, archiveToUse));
39
+ const sharedHeader = CheckpointHeader.random({ slotNumber: SlotNumber(slotNumber) });
40
+ return signers.map(signer => mockCheckpointAttestation(signer, slotNumber, archiveToUse, sharedHeader));
34
41
  };
35
42
 
36
43
  const mockBlockProposalForPool = (
@@ -59,13 +66,17 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
59
66
  it('should add attestations to pool', async () => {
60
67
  const slotNumber = 420;
61
68
  const archive = Fr.random();
62
- const attestations = signers.slice(0, -1).map(signer => mockCheckpointAttestation(signer, slotNumber, archive));
69
+ const sharedHeader = CheckpointHeader.random({ slotNumber: SlotNumber(slotNumber) });
70
+ const attestations = signers
71
+ .slice(0, -1)
72
+ .map(signer => mockCheckpointAttestation(signer, slotNumber, archive, sharedHeader));
73
+ const payloadHash = attestations[0].getPayloadHash();
63
74
 
64
75
  await ap.addOwnCheckpointAttestations(attestations);
65
76
 
66
77
  const retrievedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(
67
78
  SlotNumber(slotNumber),
68
- archive.toString(),
79
+ payloadHash,
69
80
  );
70
81
  expect(retrievedAttestations.length).toBe(attestations.length);
71
82
  compareCheckpointAttestations(retrievedAttestations, attestations);
@@ -75,11 +86,16 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
75
86
  compareCheckpointAttestations(retrievedAttestationsForSlot, attestations);
76
87
 
77
88
  // Add another one
78
- const newAttestation = mockCheckpointAttestation(signers[NUMBER_OF_SIGNERS_PER_TEST - 1], slotNumber, archive);
89
+ const newAttestation = mockCheckpointAttestation(
90
+ signers[NUMBER_OF_SIGNERS_PER_TEST - 1],
91
+ slotNumber,
92
+ archive,
93
+ sharedHeader,
94
+ );
79
95
  await ap.addOwnCheckpointAttestations([newAttestation]);
80
96
  const retrievedAttestationsAfterAdd = await ap.getCheckpointAttestationsForSlotAndProposal(
81
97
  SlotNumber(slotNumber),
82
- archive.toString(),
98
+ payloadHash,
83
99
  );
84
100
  expect(retrievedAttestationsAfterAdd.length).toBe(attestations.length + 1);
85
101
  compareCheckpointAttestations(retrievedAttestationsAfterAdd, [...attestations, newAttestation]);
@@ -92,7 +108,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
92
108
 
93
109
  const retreivedAttestationsAfterDelete = await ap.getCheckpointAttestationsForSlotAndProposal(
94
110
  SlotNumber(slotNumber),
95
- archive.toString(),
111
+ payloadHash,
96
112
  );
97
113
  expect(retreivedAttestationsAfterDelete.length).toBe(0);
98
114
  });
@@ -108,13 +124,14 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
108
124
  for (let i = 0; i < NUMBER_OF_SIGNERS_PER_TEST; i++) {
109
125
  attestations.push(mockCheckpointAttestation(signer, slotNumber, archive, header));
110
126
  }
127
+ const payloadHash = attestations[0].getPayloadHash();
111
128
 
112
129
  // Add them to store and check we end up with only one
113
130
  await ap.addOwnCheckpointAttestations(attestations);
114
131
 
115
132
  const retreivedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(
116
133
  SlotNumber(slotNumber),
117
- archive.toString(),
134
+ payloadHash,
118
135
  );
119
136
  expect(retreivedAttestations.length).toBe(1);
120
137
  expect(retreivedAttestations[0].toBuffer()).toEqual(attestations[0].toBuffer());
@@ -122,9 +139,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
122
139
 
123
140
  // Try adding them on another operation and check they are still not duplicated
124
141
  await ap.addOwnCheckpointAttestations([attestations[0]]);
125
- expect(
126
- await ap.getCheckpointAttestationsForSlotAndProposal(SlotNumber(slotNumber), archive.toString()),
127
- ).toHaveLength(1);
142
+ expect(await ap.getCheckpointAttestationsForSlotAndProposal(SlotNumber(slotNumber), payloadHash)).toHaveLength(1);
128
143
  });
129
144
 
130
145
  it('should store attestations by differing slot', async () => {
@@ -135,9 +150,9 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
135
150
 
136
151
  for (const attestation of attestations) {
137
152
  const slot = attestation.payload.header.slotNumber;
138
- const archive = attestation.archive.toString();
153
+ const payloadHash = attestation.getPayloadHash();
139
154
 
140
- const retreivedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(slot, archive);
155
+ const retreivedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(slot, payloadHash);
141
156
  expect(retreivedAttestations.length).toBe(1);
142
157
  expect(retreivedAttestations[0].toBuffer()).toEqual(attestation.toBuffer());
143
158
  expect(retreivedAttestations[0].payload.header.slotNumber).toEqual(slot);
@@ -153,9 +168,9 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
153
168
 
154
169
  for (const attestation of attestations) {
155
170
  const slot = attestation.payload.header.slotNumber;
156
- const proposalId = attestation.archive.toString();
171
+ const payloadHash = attestation.getPayloadHash();
157
172
 
158
- const retreivedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(slot, proposalId);
173
+ const retreivedAttestations = await ap.getCheckpointAttestationsForSlotAndProposal(slot, payloadHash);
159
174
  expect(retreivedAttestations.length).toBe(1);
160
175
  expect(retreivedAttestations[0].toBuffer()).toEqual(attestation.toBuffer());
161
176
  expect(retreivedAttestations[0].payload.header.slotNumber).toEqual(slot);
@@ -164,21 +179,25 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
164
179
 
165
180
  it('should delete attestations older than a given slot', async () => {
166
181
  const slotNumbers = [1, 2, 3, 69, 72, 74, 88, 420];
167
- const attestations = (
168
- await Promise.all(slotNumbers.map(slotNumber => createCheckpointAttestationsForSlot(slotNumber)))
169
- ).flat();
170
- const proposalId = attestations[0].archive.toString();
182
+ const attestationsPerSlot = await Promise.all(
183
+ slotNumbers.map(slotNumber => createCheckpointAttestationsForSlot(slotNumber)),
184
+ );
185
+ const attestations = attestationsPerSlot.flat();
186
+ const payloadHashForSlot1 = attestationsPerSlot[0][0].getPayloadHash();
171
187
 
172
188
  await ap.addOwnCheckpointAttestations(attestations);
173
189
 
174
- const attestationsForSlot1 = await ap.getCheckpointAttestationsForSlotAndProposal(SlotNumber(1), proposalId);
190
+ const attestationsForSlot1 = await ap.getCheckpointAttestationsForSlotAndProposal(
191
+ SlotNumber(1),
192
+ payloadHashForSlot1,
193
+ );
175
194
  expect(attestationsForSlot1.length).toBe(signers.length);
176
195
 
177
196
  await ap.deleteOlderThan(SlotNumber(73));
178
197
 
179
198
  const attestationsForSlot1AfterDelete = await ap.getCheckpointAttestationsForSlotAndProposal(
180
199
  SlotNumber(1),
181
- proposalId,
200
+ payloadHashForSlot1,
182
201
  );
183
202
  expect(attestationsForSlot1AfterDelete.length).toBe(0);
184
203
  });
@@ -189,7 +208,6 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
189
208
  const slotNumber = 420;
190
209
  const archive = Fr.random();
191
210
  const proposal = await mockBlockProposalForPool(signers[0], slotNumber, archive);
192
- const proposalId = proposal.archive.toString();
193
211
 
194
212
  const result = await ap.tryAddBlockProposal(proposal);
195
213
 
@@ -197,7 +215,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
197
215
  expect(result.alreadyExists).toBe(false);
198
216
  expect(result.count).toBe(1);
199
217
 
200
- const retrievedProposal = await ap.getBlockProposal(proposalId);
218
+ const retrievedProposal = await ap.getBlockProposalByArchive(proposal.archive.toString());
201
219
 
202
220
  expect(retrievedProposal).toBeDefined();
203
221
  expect(retrievedProposal!).toEqual(proposal);
@@ -205,33 +223,68 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
205
223
 
206
224
  it('should return undefined for non-existent block proposal', async () => {
207
225
  const nonExistentId = Fr.random().toString();
208
- const retrievedProposal = await ap.getBlockProposal(nonExistentId);
226
+ const retrievedProposal = await ap.getBlockProposalByArchive(nonExistentId);
209
227
  expect(retrievedProposal).toBeUndefined();
210
228
  });
211
229
 
212
- it('should return alreadyExists when adding proposal with same id', async () => {
230
+ it('should return alreadyExists when re-adding the same signed payload', async () => {
213
231
  const slotNumber = 420;
214
232
  const archive = Fr.random();
215
- const proposal1 = await mockBlockProposalForPool(signers[0], slotNumber, archive);
216
- const proposalId = proposal1.archive.toString();
233
+ const proposal = await mockBlockProposalForPool(signers[0], slotNumber, archive);
217
234
 
218
- const result1 = await ap.tryAddBlockProposal(proposal1);
235
+ const result1 = await ap.tryAddBlockProposal(proposal);
219
236
  expect(result1.added).toBe(true);
220
237
  expect(result1.alreadyExists).toBe(false);
221
238
 
222
- // Create a new proposal with same archive but different signer
223
- const proposal2 = await mockBlockProposalForPool(signers[1], slotNumber, archive);
224
-
225
- const result2 = await ap.tryAddBlockProposal(proposal2);
239
+ // Re-broadcasting the exact same proposal yields alreadyExists.
240
+ const result2 = await ap.tryAddBlockProposal(proposal);
226
241
  expect(result2.added).toBe(false);
227
242
  expect(result2.alreadyExists).toBe(true);
228
243
 
229
- // Should still have the first proposal
230
- const retrievedProposal = await ap.getBlockProposal(proposalId);
244
+ const retrievedProposal = await ap.getBlockProposalByArchive(proposal.archive.toString());
231
245
  expect(retrievedProposal).toBeDefined();
232
- expect(retrievedProposal!.toBuffer()).toEqual(proposal1.toBuffer());
246
+ expect(retrievedProposal!.toBuffer()).toEqual(proposal.toBuffer());
233
247
  expect(retrievedProposal!.getSender()?.toString()).toBe(signers[0].address.toString());
234
248
  });
249
+
250
+ it('should retain an exact duplicate block proposal only once', async () => {
251
+ const slotNumber = 420;
252
+ const proposal = await mockBlockProposalForPool(signers[0], slotNumber);
253
+
254
+ await ap.tryAddBlockProposal(proposal);
255
+ await ap.tryAddBlockProposal(proposal);
256
+
257
+ const proposals = await ap.getProposalsForSlot(SlotNumber(slotNumber));
258
+ expect(proposals.blockProposals.map(proposal => proposal.toBuffer())).toEqual([
259
+ proposal.withoutSignedTxs().toBuffer(),
260
+ ]);
261
+ });
262
+
263
+ it('should retain all accepted block proposals at a position', async () => {
264
+ const slotNumber = 420;
265
+ const blockHeader = makeBlockHeader(1, { slotNumber: SlotNumber(slotNumber) });
266
+ const proposal1 = await makeBlockProposal({
267
+ signer: signers[0],
268
+ blockHeader,
269
+ archiveRoot: Fr.random(),
270
+ indexWithinCheckpoint: IndexWithinCheckpoint(1),
271
+ });
272
+ const proposal2 = await makeBlockProposal({
273
+ signer: signers[0],
274
+ blockHeader,
275
+ archiveRoot: Fr.random(),
276
+ indexWithinCheckpoint: IndexWithinCheckpoint(1),
277
+ });
278
+
279
+ await ap.tryAddBlockProposal(proposal1);
280
+ await ap.tryAddBlockProposal(proposal2);
281
+
282
+ const proposals = await ap.getProposalsForSlot(SlotNumber(slotNumber));
283
+ expect(proposals.blockProposals.map(proposal => proposal.toBuffer())).toEqual(
284
+ expect.arrayContaining([proposal1.withoutSignedTxs().toBuffer(), proposal2.withoutSignedTxs().toBuffer()]),
285
+ );
286
+ expect(await ap.getBlockProposalByArchive(proposal2.archive.toString())).toBeDefined();
287
+ });
235
288
  });
236
289
 
237
290
  describe('CheckpointProposal in attestation pool', () => {
@@ -239,12 +292,13 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
239
292
  signer: Secp256k1Signer,
240
293
  slotNumber: number,
241
294
  archive: Fr = Fr.random(),
295
+ checkpointHeader?: CheckpointHeader,
242
296
  ): Promise<CheckpointProposalCore> => {
243
- const checkpointHeader = makeCheckpointHeader(1, { slotNumber: SlotNumber(slotNumber) });
297
+ const headerToUse = checkpointHeader ?? makeCheckpointHeader(1, { slotNumber: SlotNumber(slotNumber) });
244
298
  const blockHeader = makeBlockHeader(1);
245
299
  const proposal = await makeCheckpointProposal({
246
300
  signer,
247
- checkpointHeader,
301
+ checkpointHeader: headerToUse,
248
302
  archiveRoot: archive,
249
303
  lastBlock: { blockHeader },
250
304
  });
@@ -256,7 +310,6 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
256
310
  const slotNumber = 420;
257
311
  const archive = Fr.random();
258
312
  const proposal = await mockCheckpointProposalForPool(signers[0], slotNumber, archive);
259
- const proposalId = proposal.archive.toString();
260
313
 
261
314
  const result = await ap.tryAddCheckpointProposal(proposal);
262
315
 
@@ -264,7 +317,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
264
317
  expect(result.alreadyExists).toBe(false);
265
318
  expect(result.count).toBe(1);
266
319
 
267
- const retrievedProposal = await ap.getCheckpointProposal(proposalId);
320
+ const retrievedProposal = await ap.getCheckpointProposal(SlotNumber(slotNumber));
268
321
 
269
322
  expect(retrievedProposal).toBeDefined();
270
323
  expect(retrievedProposal!.toBuffer()).toEqual(proposal.toBuffer());
@@ -281,54 +334,136 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
281
334
  archiveRoot: archive,
282
335
  // No lastBlock
283
336
  });
284
- const proposalId = proposal.archive.toString();
285
337
 
286
338
  // Add the checkpoint core - block extraction is now caller responsibility
287
339
  await ap.tryAddCheckpointProposal(proposal.toCore());
288
340
 
289
341
  // The checkpoint proposal should be stored
290
- const retrievedCheckpointProposal = await ap.getCheckpointProposal(proposalId);
342
+ const retrievedCheckpointProposal = await ap.getCheckpointProposal(SlotNumber(slotNumber));
291
343
  expect(retrievedCheckpointProposal).toBeDefined();
292
344
 
293
345
  // No block proposal was extracted (it had none anyway)
294
- const retrievedBlockProposal = await ap.getBlockProposal(proposalId);
346
+ const retrievedBlockProposal = await ap.getBlockProposalByArchive(proposal.archive.toString());
295
347
  expect(retrievedBlockProposal).toBeUndefined();
296
348
  });
297
349
 
298
350
  it('should return undefined for non-existent checkpoint proposal', async () => {
299
- const nonExistentId = Fr.random().toString();
300
- const retrievedProposal = await ap.getCheckpointProposal(nonExistentId);
351
+ const retrievedProposal = await ap.getCheckpointProposal(SlotNumber(99999));
301
352
  expect(retrievedProposal).toBeUndefined();
302
353
  });
303
354
 
304
- it('should return alreadyExists when adding proposal with same id', async () => {
355
+ it('should return alreadyExists when re-adding the same signed payload', async () => {
305
356
  const slotNumber = 420;
306
357
  const archive = Fr.random();
307
- const proposal1 = await mockCheckpointProposalForPool(signers[0], slotNumber, archive);
308
- const proposalId = proposal1.archive.toString();
358
+ const proposal = await mockCheckpointProposalForPool(signers[0], slotNumber, archive);
309
359
 
310
- const result1 = await ap.tryAddCheckpointProposal(proposal1);
360
+ const result1 = await ap.tryAddCheckpointProposal(proposal);
311
361
  expect(result1.added).toBe(true);
312
362
  expect(result1.alreadyExists).toBe(false);
313
363
 
314
- // Create a new proposal with same archive but different signer
315
- const proposal2 = await mockCheckpointProposalForPool(signers[1], slotNumber, archive);
316
-
317
- const result2 = await ap.tryAddCheckpointProposal(proposal2);
364
+ // Re-broadcasting the exact same signed payload yields alreadyExists.
365
+ const result2 = await ap.tryAddCheckpointProposal(proposal);
318
366
  expect(result2.added).toBe(false);
319
367
  expect(result2.alreadyExists).toBe(true);
320
368
 
321
- // Should still have the first proposal
322
- const retrievedProposal = await ap.getCheckpointProposal(proposalId);
369
+ // Should still have the first proposal stored at the slot
370
+ const retrievedProposal = await ap.getCheckpointProposal(SlotNumber(slotNumber));
323
371
  expect(retrievedProposal).toBeDefined();
324
- expect(retrievedProposal!.toBuffer()).toEqual(proposal1.toBuffer());
372
+ expect(retrievedProposal!.toBuffer()).toEqual(proposal.toBuffer());
325
373
  expect(retrievedProposal!.getSender()?.toString()).toBe(signers[0].address.toString());
326
374
  });
327
375
 
376
+ it('should treat distinct payloads at the same slot as equivocations (count = 2)', async () => {
377
+ const slotNumber = 420;
378
+ // Two proposals at the same slot but with different headers (distinct payloads).
379
+ const proposal1 = await mockCheckpointProposalForPool(signers[0], slotNumber, Fr.random());
380
+ const proposal2 = await mockCheckpointProposalForPool(signers[0], slotNumber, Fr.random());
381
+
382
+ const result1 = await ap.tryAddCheckpointProposal(proposal1);
383
+ expect(result1.added).toBe(true);
384
+ expect(result1.count).toBe(1);
385
+
386
+ const result2 = await ap.tryAddCheckpointProposal(proposal2);
387
+ // The second distinct payload is tracked as an equivocation, count goes to 2,
388
+ // and both accepted payloads are retained by payload hash.
389
+ expect(result2.added).toBe(true);
390
+ expect(result2.alreadyExists).toBe(false);
391
+ expect(result2.count).toBe(2);
392
+
393
+ const retrievedProposal = await ap.getCheckpointProposal(SlotNumber(slotNumber));
394
+ const expectedProposal = [proposal1, proposal2].sort((a, b) =>
395
+ a.getPayloadHash().localeCompare(b.getPayloadHash()),
396
+ )[0];
397
+ expect(retrievedProposal!.toBuffer()).toEqual(expectedProposal.toBuffer());
398
+
399
+ const proposals = await ap.getProposalsForSlot(SlotNumber(slotNumber));
400
+ expect(proposals.checkpointProposals.map(proposal => proposal.toBuffer())).toEqual(
401
+ expect.arrayContaining([proposal1.toBuffer(), proposal2.toBuffer()]),
402
+ );
403
+ });
404
+
405
+ it('should detect equivocation when only feeAssetPriceModifier differs', async () => {
406
+ const slotNumber = 420;
407
+ const archive = Fr.random();
408
+ // Same checkpoint header + archive, but two different feeAssetPriceModifier values.
409
+ // This is the audit-finding scenario: archive collides but the signed payload differs.
410
+ const sharedHeader = makeCheckpointHeader(1, { slotNumber: SlotNumber(slotNumber) });
411
+ const proposalA = await makeCheckpointProposal({
412
+ signer: signers[0],
413
+ checkpointHeader: sharedHeader,
414
+ archiveRoot: archive,
415
+ feeAssetPriceModifier: 50n,
416
+ });
417
+ const proposalB = await makeCheckpointProposal({
418
+ signer: signers[0],
419
+ checkpointHeader: sharedHeader,
420
+ archiveRoot: archive,
421
+ feeAssetPriceModifier: -50n,
422
+ });
423
+
424
+ const result1 = await ap.tryAddCheckpointProposal(proposalA.toCore());
425
+ expect(result1.count).toBe(1);
426
+
427
+ const result2 = await ap.tryAddCheckpointProposal(proposalB.toCore());
428
+ // The fix: archive collision no longer hides the equivocation; payload-hash dedup
429
+ // sees the distinct feeMod and bumps `count` to 2 so libp2p can fire the slash callback.
430
+ expect(result2.added).toBe(true);
431
+ expect(result2.alreadyExists).toBe(false);
432
+ expect(result2.count).toBe(2);
433
+ });
434
+
435
+ it('should delete retained proposals older than a given slot', async () => {
436
+ const oldSlot = 100;
437
+ const newSlot = 200;
438
+ const oldBlock = await mockBlockProposalForPool(signers[0], oldSlot);
439
+ const newBlock = await mockBlockProposalForPool(signers[1], newSlot);
440
+ const oldCheckpoint = await mockCheckpointProposalForPool(signers[0], oldSlot);
441
+ const newCheckpoint = await mockCheckpointProposalForPool(signers[1], newSlot);
442
+
443
+ await ap.tryAddBlockProposal(oldBlock);
444
+ await ap.tryAddBlockProposal(newBlock);
445
+ await ap.tryAddCheckpointProposal(oldCheckpoint);
446
+ await ap.tryAddCheckpointProposal(newCheckpoint);
447
+
448
+ await ap.deleteOlderThan(SlotNumber(newSlot));
449
+
450
+ expect(await ap.getProposalsForSlot(SlotNumber(oldSlot))).toEqual({
451
+ blockProposals: [],
452
+ checkpointProposals: [],
453
+ });
454
+ const newProposals = await ap.getProposalsForSlot(SlotNumber(newSlot));
455
+ expect(newProposals.blockProposals.map(proposal => proposal.toBuffer())).toContainEqual(
456
+ newBlock.withoutSignedTxs().toBuffer(),
457
+ );
458
+ expect(newProposals.checkpointProposals.map(proposal => proposal.toBuffer())).toContainEqual(
459
+ newCheckpoint.toBuffer(),
460
+ );
461
+ });
462
+
328
463
  it('should return added=false when exceeding capacity', async () => {
329
464
  const slotNumber = 420;
330
465
 
331
- // Add MAX_CHECKPOINT_PROPOSALS_PER_SLOT proposals
466
+ // Add MAX_CHECKPOINT_PROPOSALS_PER_SLOT distinct proposals.
332
467
  for (let i = 0; i < MAX_CHECKPOINT_PROPOSALS_PER_SLOT; i++) {
333
468
  const proposal = await mockCheckpointProposalForPool(signers[i % NUMBER_OF_SIGNERS_PER_TEST], slotNumber);
334
469
  const result = await ap.tryAddCheckpointProposal(proposal);
@@ -336,7 +471,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
336
471
  expect(result.count).toBe(i + 1);
337
472
  }
338
473
 
339
- // The next proposal should not be added
474
+ // The next proposal should not be added.
340
475
  const extraProposal = await mockCheckpointProposalForPool(signers[0], slotNumber);
341
476
  const result = await ap.tryAddCheckpointProposal(extraProposal);
342
477
  expect(result.added).toBe(false);
@@ -571,17 +706,17 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
571
706
  await ap.tryAddBlockProposal(newProposal);
572
707
 
573
708
  // Verify both proposals exist
574
- expect(await ap.getBlockProposal(oldProposal.archive.toString())).toBeDefined();
575
- expect(await ap.getBlockProposal(newProposal.archive.toString())).toBeDefined();
709
+ expect(await ap.getBlockProposalByArchive(oldProposal.archive.toString())).toBeDefined();
710
+ expect(await ap.getBlockProposalByArchive(newProposal.archive.toString())).toBeDefined();
576
711
 
577
712
  // Delete slots older than newSlot (should delete oldSlot)
578
713
  await ap.deleteOlderThan(SlotNumber(newSlot));
579
714
 
580
715
  // Old proposal should be deleted from storage
581
- expect(await ap.getBlockProposal(oldProposal.archive.toString())).toBeUndefined();
716
+ expect(await ap.getBlockProposalByArchive(oldProposal.archive.toString())).toBeUndefined();
582
717
 
583
718
  // New proposal should still exist
584
- expect(await ap.getBlockProposal(newProposal.archive.toString())).toBeDefined();
719
+ expect(await ap.getBlockProposalByArchive(newProposal.archive.toString())).toBeDefined();
585
720
  });
586
721
  });
587
722
 
@@ -590,12 +725,13 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
590
725
  signer: Secp256k1Signer,
591
726
  slotNumber: number,
592
727
  archive: Fr = Fr.random(),
728
+ checkpointHeader?: CheckpointHeader,
593
729
  ): Promise<CheckpointProposalCore> => {
594
- const checkpointHeader = makeCheckpointHeader(1, { slotNumber: SlotNumber(slotNumber) });
730
+ const headerToUse = checkpointHeader ?? makeCheckpointHeader(1, { slotNumber: SlotNumber(slotNumber) });
595
731
  const blockHeader = makeBlockHeader(1);
596
732
  const proposal = await makeCheckpointProposal({
597
733
  signer,
598
- checkpointHeader,
734
+ checkpointHeader: headerToUse,
599
735
  archiveRoot: archive,
600
736
  lastBlock: { blockHeader },
601
737
  });
@@ -3,11 +3,12 @@ import type { Secp256k1Signer } from '@aztec/foundation/crypto/secp256k1-signer'
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import {
5
5
  CheckpointAttestation,
6
+ CheckpointProposal,
6
7
  ConsensusPayload,
7
- SignatureDomainSeparator,
8
- getHashedSignaturePayloadEthSignedMessage,
8
+ getHashedSignaturePayloadTypedData,
9
9
  } from '@aztec/stdlib/p2p';
10
10
  import { CheckpointHeader } from '@aztec/stdlib/rollup';
11
+ import { TEST_COORDINATION_SIGNATURE_CONTEXT } from '@aztec/stdlib/testing';
11
12
 
12
13
  import { type LocalAccount, generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
13
14
 
@@ -37,15 +38,19 @@ export const mockCheckpointAttestation = (
37
38
  feeAssetPriceModifier: bigint = 0n,
38
39
  ): CheckpointAttestation => {
39
40
  header = header ?? CheckpointHeader.random({ slotNumber: SlotNumber(slot) });
40
- const payload = new ConsensusPayload(header, archive, feeAssetPriceModifier);
41
+ const payload = new ConsensusPayload(header, archive, feeAssetPriceModifier, TEST_COORDINATION_SIGNATURE_CONTEXT);
41
42
 
42
- const attestationHash = getHashedSignaturePayloadEthSignedMessage(
43
- payload,
44
- SignatureDomainSeparator.checkpointAttestation,
45
- );
43
+ const attestationHash = getHashedSignaturePayloadTypedData(payload);
46
44
  const attestationSignature = signer.sign(attestationHash);
47
45
 
48
- const proposalHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.checkpointProposal);
46
+ const proposal = new CheckpointProposal(
47
+ header,
48
+ archive,
49
+ feeAssetPriceModifier,
50
+ attestationSignature,
51
+ TEST_COORDINATION_SIGNATURE_CONTEXT,
52
+ );
53
+ const proposalHash = getHashedSignaturePayloadTypedData(proposal);
49
54
  const proposerSignature = signer.sign(proposalHash);
50
55
 
51
56
  return new CheckpointAttestation(payload, attestationSignature, proposerSignature);
@@ -100,7 +100,11 @@ export class PoolInstrumentation<PoolObject extends Gossipable> {
100
100
 
101
101
  this.addObjectCounter = createUpDownCounterWithDefault(this.meter, metricsLabels.itemsAdded);
102
102
 
103
- this.minedDelay = this.meter.createHistogram(metricsLabels.itemMinedDelay);
103
+ this.minedDelay = this.meter.createHistogram(metricsLabels.itemMinedDelay, {
104
+ advice: {
105
+ explicitBucketBoundaries: [100, 500, 1000, 5000, 10000, 30000, 60000, 300000, 600000, 1800000, 3600000],
106
+ },
107
+ });
104
108
 
105
109
  this.meter.addBatchObservableCallback(this.observeStats, [this.objectsInMempool]);
106
110
  }
@@ -1,6 +1,5 @@
1
1
  import { type Logger, createLogger } from '@aztec/foundation/log';
2
2
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
3
- import { ChonkProof } from '@aztec/stdlib/proofs';
4
3
  import { Tx, TxHash } from '@aztec/stdlib/tx';
5
4
 
6
5
  /**
@@ -70,7 +69,7 @@ export class TxArchive {
70
69
  }
71
70
 
72
71
  // Archive the transaction with stripped proof
73
- const archivedTx = this.stripProof(tx);
72
+ const archivedTx = tx.withoutProof();
74
73
  const txHash = tx.getTxHash().toString();
75
74
  await this.#txs.set(txHash, archivedTx.toBuffer());
76
75
  await this.#indices.set(headIdx, txHash);
@@ -101,13 +100,6 @@ export class TxArchive {
101
100
  return head - tail;
102
101
  }
103
102
 
104
- /**
105
- * Strips the proof from a transaction for archival.
106
- */
107
- private stripProof(tx: Tx): Tx {
108
- return new Tx(tx.txHash, tx.data, ChonkProof.empty(), tx.contractClassLogFields, tx.publicFunctionCalldata);
109
- }
110
-
111
103
  private async getHeadIndex(): Promise<number> {
112
104
  const entry = await this.#indices.entriesAsync({ limit: 1, reverse: true }).next();
113
105
  return (entry.value?.[0] ?? -1) + 1;