@aztec/p2p 3.0.0-nightly.20251128 → 3.0.0-nightly.20251201.2
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/client/p2p_client.d.ts +3 -2
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +5 -4
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +7 -6
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +33 -32
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +9 -8
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +19 -20
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +9 -8
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +12 -10
- package/dest/mem_pools/attestation_pool/mocks.js +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +11 -11
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +1 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +8 -8
- package/dest/services/libp2p/libp2p_service.d.ts +1 -1
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +14 -13
- package/dest/testbench/p2p_client_testbench_worker.js +5 -5
- package/package.json +14 -14
- package/src/client/p2p_client.ts +6 -5
- package/src/mem_pools/attestation_pool/attestation_pool.ts +6 -5
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +45 -32
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +28 -29
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +26 -22
- package/src/mem_pools/attestation_pool/mocks.ts +1 -1
- package/src/msg_validators/attestation_validator/attestation_validator.ts +11 -13
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +1 -1
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +8 -8
- package/src/services/libp2p/libp2p_service.ts +14 -13
- package/src/services/tx_collection/slow_tx_collection.ts +2 -2
- package/src/testbench/p2p_client_testbench_worker.ts +5 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Secp256k1Signer } from '@aztec/foundation/crypto';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
|
|
@@ -42,7 +43,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
42
43
|
|
|
43
44
|
const mockBlockProposal = (signer: Secp256k1Signer, slotNumber: number, archive: Fr = Fr.random()): BlockProposal => {
|
|
44
45
|
const header = makeL2BlockHeader(1, 2, slotNumber);
|
|
45
|
-
const payload = new ConsensusPayload(header.toCheckpointHeader(), archive
|
|
46
|
+
const payload = new ConsensusPayload(header.toCheckpointHeader(), archive);
|
|
46
47
|
|
|
47
48
|
const hash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockProposal);
|
|
48
49
|
const signature = signer.sign(hash);
|
|
@@ -68,7 +69,10 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
68
69
|
|
|
69
70
|
await ap.addAttestations(attestations);
|
|
70
71
|
|
|
71
|
-
const retrievedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
72
|
+
const retrievedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
73
|
+
SlotNumber(slotNumber),
|
|
74
|
+
archive.toString(),
|
|
75
|
+
);
|
|
72
76
|
expect(retrievedAttestations.length).toBe(attestations.length);
|
|
73
77
|
compareAttestations(retrievedAttestations, attestations);
|
|
74
78
|
|
|
@@ -77,7 +81,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
77
81
|
expect(await ap.hasAttestation(attestation)).toBe(true);
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
const retrievedAttestationsForSlot = await ap.getAttestationsForSlot(
|
|
84
|
+
const retrievedAttestationsForSlot = await ap.getAttestationsForSlot(SlotNumber(slotNumber));
|
|
81
85
|
expect(retrievedAttestationsForSlot.length).toBe(attestations.length);
|
|
82
86
|
compareAttestations(retrievedAttestationsForSlot, attestations);
|
|
83
87
|
|
|
@@ -85,21 +89,21 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
85
89
|
const newAttestation = mockAttestation(signers[NUMBER_OF_SIGNERS_PER_TEST - 1], slotNumber, archive);
|
|
86
90
|
await ap.addAttestations([newAttestation]);
|
|
87
91
|
const retrievedAttestationsAfterAdd = await ap.getAttestationsForSlotAndProposal(
|
|
88
|
-
|
|
92
|
+
SlotNumber(slotNumber),
|
|
89
93
|
archive.toString(),
|
|
90
94
|
);
|
|
91
95
|
expect(retrievedAttestationsAfterAdd.length).toBe(attestations.length + 1);
|
|
92
96
|
compareAttestations(retrievedAttestationsAfterAdd, [...attestations, newAttestation]);
|
|
93
97
|
expect(await ap.hasAttestation(newAttestation)).toBe(true);
|
|
94
|
-
const retrievedAttestationsForSlotAfterAdd = await ap.getAttestationsForSlot(
|
|
98
|
+
const retrievedAttestationsForSlotAfterAdd = await ap.getAttestationsForSlot(SlotNumber(slotNumber));
|
|
95
99
|
expect(retrievedAttestationsForSlotAfterAdd.length).toBe(attestations.length + 1);
|
|
96
100
|
compareAttestations(retrievedAttestationsForSlotAfterAdd, [...attestations, newAttestation]);
|
|
97
101
|
|
|
98
102
|
// Delete by slot
|
|
99
|
-
await ap.deleteAttestationsForSlot(
|
|
103
|
+
await ap.deleteAttestationsForSlot(SlotNumber(slotNumber));
|
|
100
104
|
|
|
101
105
|
const retreivedAttestationsAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
102
|
-
|
|
106
|
+
SlotNumber(slotNumber),
|
|
103
107
|
archive.toString(),
|
|
104
108
|
);
|
|
105
109
|
expect(retreivedAttestationsAfterDelete.length).toBe(0);
|
|
@@ -124,14 +128,17 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
124
128
|
// Add them to store and check we end up with only one
|
|
125
129
|
await ap.addAttestations(attestations);
|
|
126
130
|
|
|
127
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
131
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
132
|
+
SlotNumber(slotNumber),
|
|
133
|
+
archive.toString(),
|
|
134
|
+
);
|
|
128
135
|
expect(retreivedAttestations.length).toBe(1);
|
|
129
136
|
expect(retreivedAttestations[0].toBuffer()).toEqual(attestations[0].toBuffer());
|
|
130
137
|
expect(retreivedAttestations[0].getSender()?.toString()).toEqual(signer.address.toString());
|
|
131
138
|
|
|
132
139
|
// Try adding them on another operation and check they are still not duplicated
|
|
133
140
|
await ap.addAttestations([attestations[0]]);
|
|
134
|
-
expect(await ap.getAttestationsForSlotAndProposal(
|
|
141
|
+
expect(await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), archive.toString())).toHaveLength(1);
|
|
135
142
|
});
|
|
136
143
|
|
|
137
144
|
it('should store attestations by differing slot', async () => {
|
|
@@ -144,7 +151,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
144
151
|
const slot = attestation.payload.header.slotNumber;
|
|
145
152
|
const archive = attestation.archive.toString();
|
|
146
153
|
|
|
147
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(slot
|
|
154
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(slot, archive);
|
|
148
155
|
expect(retreivedAttestations.length).toBe(1);
|
|
149
156
|
expect(retreivedAttestations[0].toBuffer()).toEqual(attestation.toBuffer());
|
|
150
157
|
expect(retreivedAttestations[0].payload.header.slotNumber).toEqual(slot);
|
|
@@ -162,7 +169,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
162
169
|
const slot = attestation.payload.header.slotNumber;
|
|
163
170
|
const proposalId = attestation.archive.toString();
|
|
164
171
|
|
|
165
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(slot
|
|
172
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(slot, proposalId);
|
|
166
173
|
expect(retreivedAttestations.length).toBe(1);
|
|
167
174
|
expect(retreivedAttestations[0].toBuffer()).toEqual(attestation.toBuffer());
|
|
168
175
|
expect(retreivedAttestations[0].payload.header.slotNumber).toEqual(slot);
|
|
@@ -177,7 +184,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
177
184
|
|
|
178
185
|
await ap.addAttestations(attestations);
|
|
179
186
|
|
|
180
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
187
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
181
188
|
expect(retreivedAttestations.length).toBe(NUMBER_OF_SIGNERS_PER_TEST);
|
|
182
189
|
compareAttestations(retreivedAttestations, attestations);
|
|
183
190
|
|
|
@@ -188,7 +195,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
188
195
|
|
|
189
196
|
await ap.deleteAttestations(attestations);
|
|
190
197
|
|
|
191
|
-
const gottenAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
198
|
+
const gottenAfterDelete = await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
192
199
|
expect(gottenAfterDelete.length).toBe(0);
|
|
193
200
|
|
|
194
201
|
// Check hasAttestation after deletion
|
|
@@ -205,13 +212,16 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
205
212
|
|
|
206
213
|
await ap.addAttestations(attestations);
|
|
207
214
|
|
|
208
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
215
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
209
216
|
expect(retreivedAttestations.length).toBe(NUMBER_OF_SIGNERS_PER_TEST);
|
|
210
217
|
compareAttestations(retreivedAttestations, attestations);
|
|
211
218
|
|
|
212
|
-
await ap.deleteAttestationsForSlot(
|
|
219
|
+
await ap.deleteAttestationsForSlot(SlotNumber(slotNumber));
|
|
213
220
|
|
|
214
|
-
const retreivedAttestationsAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
221
|
+
const retreivedAttestationsAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
222
|
+
SlotNumber(slotNumber),
|
|
223
|
+
proposalId,
|
|
224
|
+
);
|
|
215
225
|
expect(retreivedAttestationsAfterDelete.length).toBe(0);
|
|
216
226
|
});
|
|
217
227
|
|
|
@@ -229,17 +239,20 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
229
239
|
await ap.addAttestations(attestations);
|
|
230
240
|
await ap.addAttestations(attestations2);
|
|
231
241
|
|
|
232
|
-
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
242
|
+
const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
233
243
|
expect(retreivedAttestations.length).toBe(NUMBER_OF_SIGNERS_PER_TEST);
|
|
234
244
|
compareAttestations(retreivedAttestations, attestations);
|
|
235
245
|
|
|
236
|
-
await ap.deleteAttestationsForSlotAndProposal(
|
|
246
|
+
await ap.deleteAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
237
247
|
|
|
238
|
-
const retreivedAttestationsAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
248
|
+
const retreivedAttestationsAfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
249
|
+
SlotNumber(slotNumber),
|
|
250
|
+
proposalId,
|
|
251
|
+
);
|
|
239
252
|
expect(retreivedAttestationsAfterDelete.length).toBe(0);
|
|
240
253
|
|
|
241
254
|
const retreivedAttestationsAfterDeleteForOtherProposal = await ap.getAttestationsForSlotAndProposal(
|
|
242
|
-
|
|
255
|
+
SlotNumber(slotNumber),
|
|
243
256
|
proposalId2,
|
|
244
257
|
);
|
|
245
258
|
expect(retreivedAttestationsAfterDeleteForOtherProposal.length).toBe(NUMBER_OF_SIGNERS_PER_TEST);
|
|
@@ -255,22 +268,22 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
255
268
|
|
|
256
269
|
await ap.addAttestations(attestations);
|
|
257
270
|
|
|
258
|
-
const attestationsForSlot1 = await ap.getAttestationsForSlotAndProposal(
|
|
271
|
+
const attestationsForSlot1 = await ap.getAttestationsForSlotAndProposal(SlotNumber(1), proposalId);
|
|
259
272
|
expect(attestationsForSlot1.length).toBe(signers.length);
|
|
260
273
|
|
|
261
274
|
const deleteAttestationsSpy = jest.spyOn(ap, 'deleteAttestationsForSlot');
|
|
262
275
|
|
|
263
|
-
await ap.deleteAttestationsOlderThan(
|
|
276
|
+
await ap.deleteAttestationsOlderThan(SlotNumber(73));
|
|
264
277
|
|
|
265
|
-
const attestationsForSlot1AfterDelete = await ap.getAttestationsForSlotAndProposal(
|
|
278
|
+
const attestationsForSlot1AfterDelete = await ap.getAttestationsForSlotAndProposal(SlotNumber(1), proposalId);
|
|
266
279
|
expect(attestationsForSlot1AfterDelete.length).toBe(0);
|
|
267
280
|
|
|
268
281
|
expect(deleteAttestationsSpy).toHaveBeenCalledTimes(5);
|
|
269
|
-
expect(deleteAttestationsSpy).toHaveBeenCalledWith(
|
|
270
|
-
expect(deleteAttestationsSpy).toHaveBeenCalledWith(
|
|
271
|
-
expect(deleteAttestationsSpy).toHaveBeenCalledWith(
|
|
272
|
-
expect(deleteAttestationsSpy).toHaveBeenCalledWith(
|
|
273
|
-
expect(deleteAttestationsSpy).toHaveBeenCalledWith(
|
|
282
|
+
expect(deleteAttestationsSpy).toHaveBeenCalledWith(SlotNumber(1));
|
|
283
|
+
expect(deleteAttestationsSpy).toHaveBeenCalledWith(SlotNumber(2));
|
|
284
|
+
expect(deleteAttestationsSpy).toHaveBeenCalledWith(SlotNumber(3));
|
|
285
|
+
expect(deleteAttestationsSpy).toHaveBeenCalledWith(SlotNumber(69));
|
|
286
|
+
expect(deleteAttestationsSpy).toHaveBeenCalledWith(SlotNumber(72));
|
|
274
287
|
});
|
|
275
288
|
|
|
276
289
|
describe('BlockProposal in attestation pool', () => {
|
|
@@ -334,7 +347,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
334
347
|
const retrievedProposal = await ap.getBlockProposal(proposalId);
|
|
335
348
|
expect(retrievedProposal).toBeDefined();
|
|
336
349
|
expect(retrievedProposal!.toBuffer()).toEqual(proposal2.toBuffer());
|
|
337
|
-
expect(retrievedProposal!.slotNumber
|
|
350
|
+
expect(retrievedProposal!.slotNumber).toBe(SlotNumber(200));
|
|
338
351
|
});
|
|
339
352
|
|
|
340
353
|
it('should delete block proposal when deleting attestations for slot and proposal', async () => {
|
|
@@ -354,7 +367,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
354
367
|
expect(await ap.hasBlockProposal(proposalId)).toBe(true);
|
|
355
368
|
|
|
356
369
|
// Delete attestations for slot and proposal
|
|
357
|
-
await ap.deleteAttestationsForSlotAndProposal(
|
|
370
|
+
await ap.deleteAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
358
371
|
|
|
359
372
|
// Proposal should be deleted
|
|
360
373
|
retrievedProposal = await ap.getBlockProposal(proposalId);
|
|
@@ -377,7 +390,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
377
390
|
expect(await ap.hasBlockProposal(proposal)).toBe(true);
|
|
378
391
|
|
|
379
392
|
// Delete attestations for slot
|
|
380
|
-
await ap.deleteAttestationsForSlot(
|
|
393
|
+
await ap.deleteAttestationsForSlot(SlotNumber(slotNumber));
|
|
381
394
|
|
|
382
395
|
// Proposal should be deleted
|
|
383
396
|
retrievedProposal = await ap.getBlockProposal(proposalId);
|
|
@@ -400,7 +413,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
400
413
|
|
|
401
414
|
// Retrieve both proposal and attestations
|
|
402
415
|
const retrievedProposal = await ap.getBlockProposal(proposalId);
|
|
403
|
-
const retrievedAttestations = await ap.getAttestationsForSlotAndProposal(
|
|
416
|
+
const retrievedAttestations = await ap.getAttestationsForSlotAndProposal(SlotNumber(slotNumber), proposalId);
|
|
404
417
|
|
|
405
418
|
expect(retrievedProposal).toBeDefined();
|
|
406
419
|
expect(retrievedProposal).toEqual(proposal);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { toArray } from '@aztec/foundation/iterable';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -20,7 +21,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
20
21
|
/* proposal.payload.archive */ string,
|
|
21
22
|
/* buffer representation of proposal */ Buffer
|
|
22
23
|
>;
|
|
23
|
-
private proposalsForSlot: AztecAsyncMultiMap<
|
|
24
|
+
private proposalsForSlot: AztecAsyncMultiMap<number, string>;
|
|
24
25
|
private attestationsForProposal: AztecAsyncMultiMap<string, string>;
|
|
25
26
|
|
|
26
27
|
constructor(
|
|
@@ -74,7 +75,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
74
75
|
|
|
75
76
|
// Skip attestations with invalid signatures
|
|
76
77
|
if (!sender) {
|
|
77
|
-
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber
|
|
78
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber}`, {
|
|
78
79
|
signature: attestation.signature.toString(),
|
|
79
80
|
slotNumber,
|
|
80
81
|
proposalId,
|
|
@@ -86,13 +87,13 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
86
87
|
|
|
87
88
|
await this.attestations.set(this.getAttestationKey(slotNumber, proposalId, address), attestation.toBuffer());
|
|
88
89
|
|
|
89
|
-
await this.proposalsForSlot.set(slotNumber
|
|
90
|
+
await this.proposalsForSlot.set(slotNumber, proposalId.toString());
|
|
90
91
|
await this.attestationsForProposal.set(
|
|
91
92
|
this.getProposalKey(slotNumber, proposalId),
|
|
92
93
|
this.getAttestationKey(slotNumber, proposalId, address),
|
|
93
94
|
);
|
|
94
95
|
|
|
95
|
-
this.log.verbose(`Added attestation for slot ${slotNumber
|
|
96
|
+
this.log.verbose(`Added attestation for slot ${slotNumber} from ${address}`, {
|
|
96
97
|
signature: attestation.signature.toString(),
|
|
97
98
|
slotNumber,
|
|
98
99
|
address,
|
|
@@ -102,9 +103,8 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
public async getAttestationsForSlot(slot:
|
|
106
|
-
const
|
|
107
|
-
const proposalIds = await toArray(this.proposalsForSlot.getValuesAsync(slotFr.toString()));
|
|
106
|
+
public async getAttestationsForSlot(slot: SlotNumber): Promise<BlockAttestation[]> {
|
|
107
|
+
const proposalIds = await toArray(this.proposalsForSlot.getValuesAsync(slot));
|
|
108
108
|
const attestations: BlockAttestation[] = [];
|
|
109
109
|
|
|
110
110
|
for (const proposalId of proposalIds) {
|
|
@@ -114,7 +114,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
114
114
|
return attestations;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
public async getAttestationsForSlotAndProposal(slot:
|
|
117
|
+
public async getAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<BlockAttestation[]> {
|
|
118
118
|
const attestationIds = await toArray(
|
|
119
119
|
this.attestationsForProposal.getValuesAsync(this.getProposalKey(slot, proposalId)),
|
|
120
120
|
);
|
|
@@ -136,21 +136,20 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
136
136
|
return attestations;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
public async deleteAttestationsOlderThan(oldestSlot:
|
|
140
|
-
const olderThan = await toArray(this.proposalsForSlot.keysAsync({ end:
|
|
139
|
+
public async deleteAttestationsOlderThan(oldestSlot: SlotNumber): Promise<void> {
|
|
140
|
+
const olderThan = await toArray(this.proposalsForSlot.keysAsync({ end: oldestSlot }));
|
|
141
141
|
for (const oldSlot of olderThan) {
|
|
142
|
-
await this.deleteAttestationsForSlot(
|
|
142
|
+
await this.deleteAttestationsForSlot(SlotNumber(oldSlot));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
public async deleteAttestationsForSlot(slot:
|
|
147
|
-
const slotFr = new Fr(slot);
|
|
146
|
+
public async deleteAttestationsForSlot(slot: SlotNumber): Promise<void> {
|
|
148
147
|
let numberOfAttestations = 0;
|
|
149
148
|
await this.store.transactionAsync(async () => {
|
|
150
|
-
const proposalIds = await toArray(this.proposalsForSlot.getValuesAsync(
|
|
149
|
+
const proposalIds = await toArray(this.proposalsForSlot.getValuesAsync(slot));
|
|
151
150
|
for (const proposalId of proposalIds) {
|
|
152
151
|
const attestations = await toArray(
|
|
153
|
-
this.attestationsForProposal.getValuesAsync(this.getProposalKey(
|
|
152
|
+
this.attestationsForProposal.getValuesAsync(this.getProposalKey(slot, proposalId)),
|
|
154
153
|
);
|
|
155
154
|
|
|
156
155
|
numberOfAttestations += attestations.length;
|
|
@@ -159,17 +158,19 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
await this.proposals.delete(proposalId);
|
|
162
|
-
await this.attestationsForProposal.delete(this.getProposalKey(
|
|
161
|
+
await this.attestationsForProposal.delete(this.getProposalKey(slot, proposalId));
|
|
163
162
|
}
|
|
164
163
|
|
|
164
|
+
// Delete from proposalsForSlot
|
|
165
|
+
await this.proposalsForSlot.delete(slot);
|
|
166
|
+
|
|
165
167
|
this.log.verbose(`Removed ${numberOfAttestations} attestations for slot ${slot}`);
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
public async deleteAttestationsForSlotAndProposal(slot:
|
|
171
|
+
public async deleteAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<void> {
|
|
170
172
|
let numberOfAttestations = 0;
|
|
171
173
|
await this.store.transactionAsync(async () => {
|
|
172
|
-
const slotString = new Fr(slot).toString();
|
|
173
174
|
const attestations = await toArray(
|
|
174
175
|
this.attestationsForProposal.getValuesAsync(this.getProposalKey(slot, proposalId)),
|
|
175
176
|
);
|
|
@@ -180,8 +181,8 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
await this.proposals.delete(proposalId);
|
|
183
|
-
await this.proposalsForSlot.deleteValue(
|
|
184
|
-
await this.attestationsForProposal.delete(this.getProposalKey(
|
|
184
|
+
await this.proposalsForSlot.deleteValue(slot, proposalId);
|
|
185
|
+
await this.attestationsForProposal.delete(this.getProposalKey(slot, proposalId));
|
|
185
186
|
|
|
186
187
|
this.log.verbose(`Removed ${numberOfAttestations} attestations for slot ${slot} and proposal ${proposalId}`);
|
|
187
188
|
});
|
|
@@ -196,7 +197,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
196
197
|
|
|
197
198
|
// Skip attestations with invalid signatures
|
|
198
199
|
if (!sender) {
|
|
199
|
-
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber
|
|
200
|
+
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber}`);
|
|
200
201
|
continue;
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -253,7 +254,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
253
254
|
|
|
254
255
|
public async addBlockProposal(blockProposal: BlockProposal): Promise<void> {
|
|
255
256
|
await this.store.transactionAsync(async () => {
|
|
256
|
-
const slotKey = blockProposal.slotNumber
|
|
257
|
+
const slotKey = blockProposal.slotNumber;
|
|
257
258
|
const proposalId = blockProposal.archive.toString();
|
|
258
259
|
|
|
259
260
|
if (!(await this.canAddProposal(blockProposal))) {
|
|
@@ -268,21 +269,19 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
268
269
|
});
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
public async hasReachedProposalCap(slot:
|
|
272
|
-
const
|
|
273
|
-
const uniqueProposalCount = await this.proposalsForSlot.getValueCountAsync(slotKey);
|
|
272
|
+
public async hasReachedProposalCap(slot: SlotNumber): Promise<boolean> {
|
|
273
|
+
const uniqueProposalCount = await this.proposalsForSlot.getValueCountAsync(slot);
|
|
274
274
|
return uniqueProposalCount >= MAX_PROPOSALS_PER_SLOT;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
public async hasReachedAttestationCap(slot:
|
|
277
|
+
public async hasReachedAttestationCap(slot: SlotNumber, proposalId: string, committeeSize: number): Promise<boolean> {
|
|
278
278
|
const limit = committeeSize + ATTESTATION_CAP_BUFFER;
|
|
279
279
|
return (await this.attestationsForProposal.getValueCountAsync(this.getProposalKey(slot, proposalId))) >= limit;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
public async canAddProposal(block: BlockProposal): Promise<boolean> {
|
|
283
283
|
return (
|
|
284
|
-
(await this.proposals.hasAsync(block.archive.toString())) ||
|
|
285
|
-
!(await this.hasReachedProposalCap(block.slotNumber.toBigInt()))
|
|
284
|
+
(await this.proposals.hasAsync(block.archive.toString())) || !(await this.hasReachedProposalCap(block.slotNumber))
|
|
286
285
|
);
|
|
287
286
|
}
|
|
288
287
|
|
|
@@ -290,7 +289,7 @@ export class KvAttestationPool implements AttestationPool {
|
|
|
290
289
|
return (
|
|
291
290
|
(await this.hasAttestation(attestation)) ||
|
|
292
291
|
!(await this.hasReachedAttestationCap(
|
|
293
|
-
attestation.payload.header.slotNumber
|
|
292
|
+
attestation.payload.header.slotNumber,
|
|
294
293
|
attestation.archive.toString(),
|
|
295
294
|
committeeSize,
|
|
296
295
|
))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
4
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -9,7 +10,11 @@ import { ATTESTATION_CAP_BUFFER, MAX_PROPOSALS_PER_SLOT } from './kv_attestation
|
|
|
9
10
|
export class InMemoryAttestationPool implements AttestationPool {
|
|
10
11
|
private metrics: PoolInstrumentation<BlockAttestation>;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
14
|
+
private attestations: Map<
|
|
15
|
+
/*slot=*/ SlotNumber,
|
|
16
|
+
Map</*proposalId*/ string, Map</*address=*/ string, BlockAttestation>>
|
|
17
|
+
>;
|
|
13
18
|
private proposals: Map<string, BlockProposal>;
|
|
14
19
|
|
|
15
20
|
constructor(
|
|
@@ -31,7 +36,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
31
36
|
return Promise.resolve(this.attestations.size === 0);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
public getAttestationsForSlot(slot:
|
|
39
|
+
public getAttestationsForSlot(slot: SlotNumber): Promise<BlockAttestation[]> {
|
|
35
40
|
return Promise.resolve(
|
|
36
41
|
Array.from(this.attestations.get(slot)?.values() ?? []).flatMap(proposalAttestationMap =>
|
|
37
42
|
Array.from(proposalAttestationMap.values()),
|
|
@@ -39,7 +44,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
39
44
|
);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
public getAttestationsForSlotAndProposal(slot:
|
|
47
|
+
public getAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<BlockAttestation[]> {
|
|
43
48
|
const slotAttestationMap = this.attestations.get(slot);
|
|
44
49
|
if (slotAttestationMap) {
|
|
45
50
|
const proposalAttestationMap = slotAttestationMap.get(proposalId);
|
|
@@ -60,7 +65,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
60
65
|
|
|
61
66
|
// Skip attestations with invalid signatures
|
|
62
67
|
if (!sender) {
|
|
63
|
-
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber
|
|
68
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slotNumber}`, {
|
|
64
69
|
signature: attestation.signature.toString(),
|
|
65
70
|
slotNumber,
|
|
66
71
|
proposalId,
|
|
@@ -68,11 +73,11 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
68
73
|
continue;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
const slotAttestationMap = getSlotOrDefault(this.attestations, slotNumber
|
|
76
|
+
const slotAttestationMap = getSlotOrDefault(this.attestations, slotNumber);
|
|
72
77
|
const proposalAttestationMap = getProposalOrDefault(slotAttestationMap, proposalId);
|
|
73
78
|
proposalAttestationMap.set(sender.toString(), attestation);
|
|
74
79
|
|
|
75
|
-
this.log.verbose(`Added attestation for slot ${slotNumber
|
|
80
|
+
this.log.verbose(`Added attestation for slot ${slotNumber} from ${sender}`, {
|
|
76
81
|
signature: attestation.signature.toString(),
|
|
77
82
|
slotNumber,
|
|
78
83
|
address: sender,
|
|
@@ -83,7 +88,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
83
88
|
return Promise.resolve();
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
#getNumberOfAttestationsInSlot(slot:
|
|
91
|
+
#getNumberOfAttestationsInSlot(slot: SlotNumber): number {
|
|
87
92
|
let total = 0;
|
|
88
93
|
const slotAttestationMap = getSlotOrDefault(this.attestations, slot);
|
|
89
94
|
|
|
@@ -95,7 +100,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
95
100
|
return total;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
public async deleteAttestationsOlderThan(oldestSlot:
|
|
103
|
+
public async deleteAttestationsOlderThan(oldestSlot: SlotNumber): Promise<void> {
|
|
99
104
|
const olderThan = [];
|
|
100
105
|
|
|
101
106
|
// Entries are iterated in insertion order, so we can break as soon as we find a slot that is older than the oldestSlot.
|
|
@@ -116,7 +121,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
116
121
|
return Promise.resolve();
|
|
117
122
|
}
|
|
118
123
|
|
|
119
|
-
public deleteAttestationsForSlot(slot:
|
|
124
|
+
public deleteAttestationsForSlot(slot: SlotNumber): Promise<void> {
|
|
120
125
|
// We count the number of attestations we are removing
|
|
121
126
|
const numberOfAttestations = this.#getNumberOfAttestationsInSlot(slot);
|
|
122
127
|
const proposalIdsToDelete = this.attestations.get(slot)?.keys();
|
|
@@ -134,7 +139,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
134
139
|
return Promise.resolve();
|
|
135
140
|
}
|
|
136
141
|
|
|
137
|
-
public deleteAttestationsForSlotAndProposal(slot:
|
|
142
|
+
public deleteAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<void> {
|
|
138
143
|
const slotAttestationMap = getSlotOrDefault(this.attestations, slot);
|
|
139
144
|
if (slotAttestationMap) {
|
|
140
145
|
if (slotAttestationMap.has(proposalId)) {
|
|
@@ -153,7 +158,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
153
158
|
public deleteAttestations(attestations: BlockAttestation[]): Promise<void> {
|
|
154
159
|
for (const attestation of attestations) {
|
|
155
160
|
const slotNumber = attestation.payload.header.slotNumber;
|
|
156
|
-
const slotAttestationMap = this.attestations.get(slotNumber
|
|
161
|
+
const slotAttestationMap = this.attestations.get(slotNumber);
|
|
157
162
|
if (slotAttestationMap) {
|
|
158
163
|
const proposalId = attestation.archive.toString();
|
|
159
164
|
const proposalAttestationMap = getProposalOrDefault(slotAttestationMap, proposalId);
|
|
@@ -162,7 +167,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
162
167
|
|
|
163
168
|
// Skip attestations with invalid signatures
|
|
164
169
|
if (!sender) {
|
|
165
|
-
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber
|
|
170
|
+
this.log.warn(`Skipping deletion of attestation with invalid signature for slot ${slotNumber}`);
|
|
166
171
|
continue;
|
|
167
172
|
}
|
|
168
173
|
|
|
@@ -184,7 +189,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
184
189
|
return Promise.resolve(false);
|
|
185
190
|
}
|
|
186
191
|
|
|
187
|
-
const slotAttestationMap = this.attestations.get(slotNumber
|
|
192
|
+
const slotAttestationMap = this.attestations.get(slotNumber);
|
|
188
193
|
if (!slotAttestationMap) {
|
|
189
194
|
return Promise.resolve(false);
|
|
190
195
|
}
|
|
@@ -200,7 +205,7 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
200
205
|
public addBlockProposal(blockProposal: BlockProposal): Promise<void> {
|
|
201
206
|
// We initialize slot-proposal mapping if it does not exist
|
|
202
207
|
// This is important to ensure we can delete this proposal if there were not attestations for it
|
|
203
|
-
const slotProposalMapping = getSlotOrDefault(this.attestations, blockProposal.slotNumber
|
|
208
|
+
const slotProposalMapping = getSlotOrDefault(this.attestations, blockProposal.slotNumber);
|
|
204
209
|
slotProposalMapping.set(blockProposal.payload.archive.toString(), new Map<string, BlockAttestation>());
|
|
205
210
|
|
|
206
211
|
this.proposals.set(blockProposal.payload.archive.toString(), blockProposal);
|
|
@@ -216,27 +221,25 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
216
221
|
return Promise.resolve(this.proposals.has(id));
|
|
217
222
|
}
|
|
218
223
|
|
|
219
|
-
public hasReachedProposalCap(slot:
|
|
224
|
+
public hasReachedProposalCap(slot: SlotNumber): Promise<boolean> {
|
|
220
225
|
const slotAttestationMap = this.attestations.get(slot);
|
|
221
226
|
const proposalCount = slotAttestationMap?.size ?? 0;
|
|
222
227
|
return Promise.resolve(proposalCount >= MAX_PROPOSALS_PER_SLOT);
|
|
223
228
|
}
|
|
224
229
|
|
|
225
|
-
public hasReachedAttestationCap(slot:
|
|
230
|
+
public hasReachedAttestationCap(slot: SlotNumber, proposalId: string, committeeSize: number): Promise<boolean> {
|
|
226
231
|
const limit = committeeSize + ATTESTATION_CAP_BUFFER;
|
|
227
232
|
const count = this.attestations.get(slot)?.get(proposalId)?.size ?? 0;
|
|
228
233
|
return Promise.resolve(limit <= 0 || count >= limit);
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
public async canAddProposal(block: BlockProposal): Promise<boolean> {
|
|
232
|
-
return (
|
|
233
|
-
this.proposals.has(block.archive.toString()) || !(await this.hasReachedProposalCap(block.slotNumber.toBigInt()))
|
|
234
|
-
);
|
|
237
|
+
return this.proposals.has(block.archive.toString()) || !(await this.hasReachedProposalCap(block.slotNumber));
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
public async canAddAttestation(attestation: BlockAttestation, committeeSize: number): Promise<boolean> {
|
|
238
241
|
const sender = attestation.getSender();
|
|
239
|
-
const slot = attestation.payload.header.slotNumber
|
|
242
|
+
const slot = attestation.payload.header.slotNumber;
|
|
240
243
|
const pid = attestation.archive.toString();
|
|
241
244
|
return (
|
|
242
245
|
!!sender &&
|
|
@@ -255,8 +258,9 @@ export class InMemoryAttestationPool implements AttestationPool {
|
|
|
255
258
|
* @returns The slot mapping
|
|
256
259
|
*/
|
|
257
260
|
function getSlotOrDefault(
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
262
|
+
map: Map<SlotNumber, Map<string, Map<string, BlockAttestation>>>,
|
|
263
|
+
slot: SlotNumber,
|
|
260
264
|
): Map<string, Map<string, BlockAttestation>> {
|
|
261
265
|
if (!map.has(slot)) {
|
|
262
266
|
map.set(slot, new Map<string, Map<string, BlockAttestation>>());
|
|
@@ -33,7 +33,7 @@ export const mockAttestation = (
|
|
|
33
33
|
): BlockAttestation => {
|
|
34
34
|
// Use arbitrary numbers for all other than slot
|
|
35
35
|
const header = makeL2BlockHeader(1, 2, slot);
|
|
36
|
-
const payload = new ConsensusPayload(header.toCheckpointHeader(), archive
|
|
36
|
+
const payload = new ConsensusPayload(header.toCheckpointHeader(), archive);
|
|
37
37
|
|
|
38
38
|
const attestationHash = getHashedSignaturePayloadEthSignedMessage(payload, SignatureDomainSeparator.blockAttestation);
|
|
39
39
|
const attestationSignature = signer.sign(attestationHash);
|
|
@@ -13,47 +13,45 @@ export class AttestationValidator implements P2PValidator<BlockAttestation> {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async validate(message: BlockAttestation): Promise<PeerErrorSeverity | undefined> {
|
|
16
|
-
const
|
|
16
|
+
const slotNumber = message.payload.header.slotNumber;
|
|
17
17
|
|
|
18
18
|
try {
|
|
19
19
|
const { currentProposer, nextProposer, currentSlot, nextSlot } =
|
|
20
20
|
await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
21
21
|
|
|
22
|
-
if (
|
|
23
|
-
this.logger.warn(
|
|
24
|
-
`Attestation slot ${slotNumberBigInt} is not current (${currentSlot}) or next (${nextSlot}) slot`,
|
|
25
|
-
);
|
|
22
|
+
if (slotNumber !== currentSlot && slotNumber !== nextSlot) {
|
|
23
|
+
this.logger.warn(`Attestation slot ${slotNumber} is not current (${currentSlot}) or next (${nextSlot}) slot`);
|
|
26
24
|
return PeerErrorSeverity.HighToleranceError;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
// Verify the signature is valid
|
|
30
28
|
const attester = message.getSender();
|
|
31
29
|
if (attester === undefined) {
|
|
32
|
-
this.logger.warn(`Invalid signature in attestation for slot ${
|
|
30
|
+
this.logger.warn(`Invalid signature in attestation for slot ${slotNumber}`);
|
|
33
31
|
return PeerErrorSeverity.LowToleranceError;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
// Verify the attester is in the committee for this slot
|
|
37
|
-
if (!(await this.epochCache.isInCommittee(
|
|
38
|
-
this.logger.warn(`Attester ${attester.toString()} is not in committee for slot ${
|
|
35
|
+
if (!(await this.epochCache.isInCommittee(slotNumber, attester))) {
|
|
36
|
+
this.logger.warn(`Attester ${attester.toString()} is not in committee for slot ${slotNumber}`);
|
|
39
37
|
return PeerErrorSeverity.HighToleranceError;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
// Verify the proposer signature matches the expected proposer for this slot
|
|
43
41
|
const proposer = message.getProposer();
|
|
44
|
-
const expectedProposer =
|
|
42
|
+
const expectedProposer = slotNumber === currentSlot ? currentProposer : nextProposer;
|
|
45
43
|
if (!expectedProposer) {
|
|
46
|
-
this.logger.warn(`No proposer defined for slot ${
|
|
44
|
+
this.logger.warn(`No proposer defined for slot ${slotNumber}`);
|
|
47
45
|
return PeerErrorSeverity.HighToleranceError;
|
|
48
46
|
}
|
|
49
47
|
if (!proposer) {
|
|
50
|
-
this.logger.warn(`Invalid proposer signature in attestation for slot ${
|
|
48
|
+
this.logger.warn(`Invalid proposer signature in attestation for slot ${slotNumber}`);
|
|
51
49
|
return PeerErrorSeverity.LowToleranceError;
|
|
52
50
|
}
|
|
53
51
|
if (!proposer.equals(expectedProposer)) {
|
|
54
52
|
this.logger.warn(
|
|
55
53
|
`Proposer signature mismatch in attestation. ` +
|
|
56
|
-
`Expected ${expectedProposer?.toString() ?? 'none'} but got ${proposer.toString()} for slot ${
|
|
54
|
+
`Expected ${expectedProposer?.toString() ?? 'none'} but got ${proposer.toString()} for slot ${slotNumber}`,
|
|
57
55
|
);
|
|
58
56
|
return PeerErrorSeverity.HighToleranceError;
|
|
59
57
|
}
|
|
@@ -62,7 +60,7 @@ export class AttestationValidator implements P2PValidator<BlockAttestation> {
|
|
|
62
60
|
} catch (e) {
|
|
63
61
|
// People shouldn't be sending us attestations if the committee doesn't exist
|
|
64
62
|
if (e instanceof NoCommitteeError) {
|
|
65
|
-
this.logger.warn(`No committee exists for attestation for slot ${
|
|
63
|
+
this.logger.warn(`No committee exists for attestation for slot ${slotNumber}`);
|
|
66
64
|
return PeerErrorSeverity.LowToleranceError;
|
|
67
65
|
}
|
|
68
66
|
throw e;
|
|
@@ -43,7 +43,7 @@ export class FishermanAttestationValidator extends AttestationValidator {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// fisherman validation: verify attestation payload matches proposal payload
|
|
46
|
-
const slotNumberBigInt = message.payload.header.slotNumber
|
|
46
|
+
const slotNumberBigInt = message.payload.header.slotNumber;
|
|
47
47
|
const attester = message.getSender();
|
|
48
48
|
const proposer = message.getProposer();
|
|
49
49
|
|