@aztec/sequencer-client 3.0.0-nightly.20251105 → 3.0.0-nightly.20251107
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/config.d.ts.map +1 -1
- package/dest/config.js +4 -0
- package/dest/sequencer/sequencer.d.ts +4 -2
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +53 -22
- package/package.json +27 -27
- package/src/config.ts +4 -0
- package/src/sequencer/sequencer.ts +69 -24
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,qBAAqB,EAAiC,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GACjD,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,GACzC,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,qBAAqB,EAAiC,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GACjD,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,GACzC,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAmHvE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CASnF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
|
package/dest/config.js
CHANGED
|
@@ -114,6 +114,10 @@ export const sequencerConfigMappings = {
|
|
|
114
114
|
description: 'Inject a fake attestation (for testing only)',
|
|
115
115
|
...booleanConfigHelper(false)
|
|
116
116
|
},
|
|
117
|
+
shuffleAttestationOrdering: {
|
|
118
|
+
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
119
|
+
...booleanConfigHelper(false)
|
|
120
|
+
},
|
|
117
121
|
...pickConfigMappings(p2pConfigMappings, [
|
|
118
122
|
'txPublicSetupAllowList'
|
|
119
123
|
])
|
|
@@ -8,7 +8,7 @@ import { type DateProvider } from '@aztec/foundation/timer';
|
|
|
8
8
|
import { type TypedEventEmitter } from '@aztec/foundation/types';
|
|
9
9
|
import type { P2P } from '@aztec/p2p';
|
|
10
10
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
11
|
-
import {
|
|
11
|
+
import { CommitteeAttestationsAndSigners, type L2BlockSource, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
12
12
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
13
13
|
import { type IFullNodeBlockBuilder, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
14
14
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
@@ -160,7 +160,9 @@ export declare class Sequencer extends Sequencer_base {
|
|
|
160
160
|
* @param proposerAddress - The address of the proposer
|
|
161
161
|
*/
|
|
162
162
|
private buildBlockAndEnqueuePublish;
|
|
163
|
-
protected collectAttestations(block: L2Block, txs: Tx[], proposerAddress: EthAddress | undefined): Promise<
|
|
163
|
+
protected collectAttestations(block: L2Block, txs: Tx[], proposerAddress: EthAddress | undefined): Promise<CommitteeAttestationsAndSigners>;
|
|
164
|
+
/** Breaks the attestations before publishing based on attack configs */
|
|
165
|
+
private manipulateAttestations;
|
|
164
166
|
/**
|
|
165
167
|
* Publishes the L2Block to the rollup contract.
|
|
166
168
|
* @param block - The L2Block to be published.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,KAAK,iBAAiB,EAAY,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,KAAK,iBAAiB,EAAY,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,g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ogger } from '@aztec/foundation/log';
|
|
|
15
15
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
16
16
|
import { Timer } from '@aztec/foundation/timer';
|
|
17
17
|
import { unfreeze } from '@aztec/foundation/types';
|
|
18
|
-
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
18
|
+
import { CommitteeAttestationsAndSigners, MaliciousCommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
19
19
|
import { getSlotAtTimestamp, getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
20
20
|
import { Gas } from '@aztec/stdlib/gas';
|
|
21
21
|
import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
|
|
@@ -477,15 +477,13 @@ export { SequencerState };
|
|
|
477
477
|
...blockStats
|
|
478
478
|
});
|
|
479
479
|
this.log.debug('Collecting attestations');
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
const attestationsAndSigners = new CommitteeAttestationsAndSigners(attestations ?? []);
|
|
488
|
-
const attestationsAndSignersSignature = this.validatorClient ? await this.validatorClient.signAttestationsAndSigners(attestationsAndSigners, proposerAddress ?? publisher.getSenderAddress()) : Signature.empty();
|
|
480
|
+
const attestationsAndSigners = await this.collectAttestations(block, usedTxs, proposerAddress);
|
|
481
|
+
this.log.verbose(`Collected ${attestationsAndSigners.attestations.length} attestations for block ${blockNumber} at slot ${slot}`, {
|
|
482
|
+
blockHash,
|
|
483
|
+
blockNumber,
|
|
484
|
+
slot
|
|
485
|
+
});
|
|
486
|
+
const attestationsAndSignersSignature = await this.validatorClient?.signAttestationsAndSigners(attestationsAndSigners, proposerAddress ?? publisher.getSenderAddress()) ?? Signature.empty();
|
|
489
487
|
await this.enqueuePublishL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, invalidateBlock, publisher);
|
|
490
488
|
this.metrics.recordBuiltBlock(blockBuildDuration, publicGas.l2Gas);
|
|
491
489
|
return block;
|
|
@@ -495,21 +493,19 @@ export { SequencerState };
|
|
|
495
493
|
}
|
|
496
494
|
}
|
|
497
495
|
async collectAttestations(block, txs, proposerAddress) {
|
|
498
|
-
const { committee } = await this.epochCache.getCommittee(block.
|
|
496
|
+
const { committee, seed, epoch } = await this.epochCache.getCommittee(block.slot);
|
|
499
497
|
// We checked above that the committee is defined, so this should never happen.
|
|
500
498
|
if (!committee) {
|
|
501
499
|
throw new Error('No committee when collecting attestations');
|
|
502
500
|
}
|
|
503
501
|
if (committee.length === 0) {
|
|
504
502
|
this.log.verbose(`Attesting committee is empty`);
|
|
505
|
-
return
|
|
503
|
+
return CommitteeAttestationsAndSigners.empty();
|
|
506
504
|
} else {
|
|
507
505
|
this.log.debug(`Attesting committee length is ${committee.length}`);
|
|
508
506
|
}
|
|
509
507
|
if (!this.validatorClient) {
|
|
510
|
-
|
|
511
|
-
this.log.error(msg);
|
|
512
|
-
throw new Error(msg);
|
|
508
|
+
throw new Error('Missing validator client: Cannot collect attestations');
|
|
513
509
|
}
|
|
514
510
|
const numberOfRequiredAttestations = Math.floor(committee.length * 2 / 3) + 1;
|
|
515
511
|
const slotNumber = block.header.globalVariables.slotNumber.toBigInt();
|
|
@@ -526,7 +522,7 @@ export { SequencerState };
|
|
|
526
522
|
if (this.config.skipCollectingAttestations) {
|
|
527
523
|
this.log.warn('Skipping attestation collection as per config (attesting with own keys only)');
|
|
528
524
|
const attestations = await this.validatorClient?.collectOwnAttestations(proposal);
|
|
529
|
-
return orderAttestations(attestations ?? [], committee);
|
|
525
|
+
return new CommitteeAttestationsAndSigners(orderAttestations(attestations ?? [], committee));
|
|
530
526
|
}
|
|
531
527
|
this.log.debug('Broadcasting block proposal to validators');
|
|
532
528
|
await this.validatorClient.broadcastBlockProposal(proposal);
|
|
@@ -540,13 +536,11 @@ export { SequencerState };
|
|
|
540
536
|
collectedAttestationsCount = attestations.length;
|
|
541
537
|
// note: the smart contract requires that the signatures are provided in the order of the committee
|
|
542
538
|
const sorted = orderAttestations(attestations, committee);
|
|
543
|
-
if
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
this.log.warn(`Injecting fake attestation in block ${block.number}`);
|
|
547
|
-
unfreeze(nonEmpty[randomIndex]).signature = Signature.random();
|
|
539
|
+
// manipulate the attestations if we've been configured to do so
|
|
540
|
+
if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
|
|
541
|
+
return this.manipulateAttestations(block, epoch, seed, committee, sorted);
|
|
548
542
|
}
|
|
549
|
-
return sorted;
|
|
543
|
+
return new CommitteeAttestationsAndSigners(sorted);
|
|
550
544
|
} catch (err) {
|
|
551
545
|
if (err && err instanceof AttestationTimeoutError) {
|
|
552
546
|
collectedAttestationsCount = err.collectedCount;
|
|
@@ -556,6 +550,43 @@ export { SequencerState };
|
|
|
556
550
|
this.metrics.recordCollectedAttestations(collectedAttestationsCount, timer.ms());
|
|
557
551
|
}
|
|
558
552
|
}
|
|
553
|
+
/** Breaks the attestations before publishing based on attack configs */ manipulateAttestations(block, epoch, seed, committee, attestations) {
|
|
554
|
+
// Compute the proposer index in the committee, since we dont want to tweak it.
|
|
555
|
+
// Otherwise, the L1 rollup contract will reject the block outright.
|
|
556
|
+
const proposerIndex = Number(this.epochCache.computeProposerIndex(block.slot, epoch, seed, BigInt(committee.length)));
|
|
557
|
+
if (this.config.injectFakeAttestation) {
|
|
558
|
+
// Find non-empty attestations that are not from the proposer
|
|
559
|
+
const nonProposerIndices = [];
|
|
560
|
+
for(let i = 0; i < attestations.length; i++){
|
|
561
|
+
if (!attestations[i].signature.isEmpty() && i !== proposerIndex) {
|
|
562
|
+
nonProposerIndices.push(i);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (nonProposerIndices.length > 0) {
|
|
566
|
+
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
567
|
+
this.log.warn(`Injecting fake attestation in block ${block.number} at index ${targetIndex}`);
|
|
568
|
+
unfreeze(attestations[targetIndex]).signature = Signature.random();
|
|
569
|
+
}
|
|
570
|
+
return new CommitteeAttestationsAndSigners(attestations);
|
|
571
|
+
}
|
|
572
|
+
if (this.config.shuffleAttestationOrdering) {
|
|
573
|
+
this.log.warn(`Shuffling attestation ordering in block ${block.number} (proposer index ${proposerIndex})`);
|
|
574
|
+
const shuffled = [
|
|
575
|
+
...attestations
|
|
576
|
+
];
|
|
577
|
+
const [i, j] = [
|
|
578
|
+
(proposerIndex + 1) % shuffled.length,
|
|
579
|
+
(proposerIndex + 2) % shuffled.length
|
|
580
|
+
];
|
|
581
|
+
const valueI = shuffled[i];
|
|
582
|
+
const valueJ = shuffled[j];
|
|
583
|
+
shuffled[i] = valueJ;
|
|
584
|
+
shuffled[j] = valueI;
|
|
585
|
+
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
586
|
+
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
587
|
+
}
|
|
588
|
+
return new CommitteeAttestationsAndSigners(attestations);
|
|
589
|
+
}
|
|
559
590
|
/**
|
|
560
591
|
* Publishes the L2Block to the rollup contract.
|
|
561
592
|
* @param block - The L2Block to be published.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251107",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
30
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
31
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
32
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
33
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
34
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
35
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
38
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
39
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
40
|
-
"@aztec/noir-acvm_js": "3.0.0-nightly.
|
|
41
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
43
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
44
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
45
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
46
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
47
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
48
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
49
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
50
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
51
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
52
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
29
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251107",
|
|
30
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251107",
|
|
31
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251107",
|
|
32
|
+
"@aztec/blob-sink": "3.0.0-nightly.20251107",
|
|
33
|
+
"@aztec/constants": "3.0.0-nightly.20251107",
|
|
34
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20251107",
|
|
35
|
+
"@aztec/ethereum": "3.0.0-nightly.20251107",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20251107",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251107",
|
|
38
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251107",
|
|
39
|
+
"@aztec/node-keystore": "3.0.0-nightly.20251107",
|
|
40
|
+
"@aztec/noir-acvm_js": "3.0.0-nightly.20251107",
|
|
41
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251107",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251107",
|
|
43
|
+
"@aztec/noir-types": "3.0.0-nightly.20251107",
|
|
44
|
+
"@aztec/p2p": "3.0.0-nightly.20251107",
|
|
45
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251107",
|
|
46
|
+
"@aztec/prover-client": "3.0.0-nightly.20251107",
|
|
47
|
+
"@aztec/simulator": "3.0.0-nightly.20251107",
|
|
48
|
+
"@aztec/slasher": "3.0.0-nightly.20251107",
|
|
49
|
+
"@aztec/stdlib": "3.0.0-nightly.20251107",
|
|
50
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251107",
|
|
51
|
+
"@aztec/validator-client": "3.0.0-nightly.20251107",
|
|
52
|
+
"@aztec/world-state": "3.0.0-nightly.20251107",
|
|
53
53
|
"lodash.chunk": "^4.2.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
59
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
58
|
+
"@aztec/archiver": "3.0.0-nightly.20251107",
|
|
59
|
+
"@aztec/kv-store": "3.0.0-nightly.20251107",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
package/src/config.ts
CHANGED
|
@@ -153,6 +153,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
153
153
|
description: 'Inject a fake attestation (for testing only)',
|
|
154
154
|
...booleanConfigHelper(false),
|
|
155
155
|
},
|
|
156
|
+
shuffleAttestationOrdering: {
|
|
157
|
+
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
158
|
+
...booleanConfigHelper(false),
|
|
159
|
+
},
|
|
156
160
|
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
|
|
157
161
|
};
|
|
158
162
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
CommitteeAttestation,
|
|
18
18
|
CommitteeAttestationsAndSigners,
|
|
19
19
|
type L2BlockSource,
|
|
20
|
+
MaliciousCommitteeAttestationsAndSigners,
|
|
20
21
|
type ValidateBlockResult,
|
|
21
22
|
} from '@aztec/stdlib/block';
|
|
22
23
|
import { type L1RollupConstants, getSlotAtTimestamp, getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
@@ -631,18 +632,17 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
631
632
|
);
|
|
632
633
|
|
|
633
634
|
this.log.debug('Collecting attestations');
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
635
|
+
const attestationsAndSigners = await this.collectAttestations(block, usedTxs, proposerAddress);
|
|
636
|
+
this.log.verbose(
|
|
637
|
+
`Collected ${attestationsAndSigners.attestations.length} attestations for block ${blockNumber} at slot ${slot}`,
|
|
638
|
+
{ blockHash, blockNumber, slot },
|
|
639
|
+
);
|
|
638
640
|
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
)
|
|
645
|
-
: Signature.empty();
|
|
641
|
+
const attestationsAndSignersSignature =
|
|
642
|
+
(await this.validatorClient?.signAttestationsAndSigners(
|
|
643
|
+
attestationsAndSigners,
|
|
644
|
+
proposerAddress ?? publisher.getSenderAddress(),
|
|
645
|
+
)) ?? Signature.empty();
|
|
646
646
|
|
|
647
647
|
await this.enqueuePublishL2Block(
|
|
648
648
|
block,
|
|
@@ -668,8 +668,8 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
668
668
|
block: L2Block,
|
|
669
669
|
txs: Tx[],
|
|
670
670
|
proposerAddress: EthAddress | undefined,
|
|
671
|
-
): Promise<
|
|
672
|
-
const { committee } = await this.epochCache.getCommittee(block.
|
|
671
|
+
): Promise<CommitteeAttestationsAndSigners> {
|
|
672
|
+
const { committee, seed, epoch } = await this.epochCache.getCommittee(block.slot);
|
|
673
673
|
|
|
674
674
|
// We checked above that the committee is defined, so this should never happen.
|
|
675
675
|
if (!committee) {
|
|
@@ -678,15 +678,13 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
678
678
|
|
|
679
679
|
if (committee.length === 0) {
|
|
680
680
|
this.log.verbose(`Attesting committee is empty`);
|
|
681
|
-
return
|
|
681
|
+
return CommitteeAttestationsAndSigners.empty();
|
|
682
682
|
} else {
|
|
683
683
|
this.log.debug(`Attesting committee length is ${committee.length}`);
|
|
684
684
|
}
|
|
685
685
|
|
|
686
686
|
if (!this.validatorClient) {
|
|
687
|
-
|
|
688
|
-
this.log.error(msg);
|
|
689
|
-
throw new Error(msg);
|
|
687
|
+
throw new Error('Missing validator client: Cannot collect attestations');
|
|
690
688
|
}
|
|
691
689
|
|
|
692
690
|
const numberOfRequiredAttestations = Math.floor((committee.length * 2) / 3) + 1;
|
|
@@ -716,7 +714,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
716
714
|
if (this.config.skipCollectingAttestations) {
|
|
717
715
|
this.log.warn('Skipping attestation collection as per config (attesting with own keys only)');
|
|
718
716
|
const attestations = await this.validatorClient?.collectOwnAttestations(proposal);
|
|
719
|
-
return orderAttestations(attestations ?? [], committee);
|
|
717
|
+
return new CommitteeAttestationsAndSigners(orderAttestations(attestations ?? [], committee));
|
|
720
718
|
}
|
|
721
719
|
|
|
722
720
|
this.log.debug('Broadcasting block proposal to validators');
|
|
@@ -742,13 +740,13 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
742
740
|
|
|
743
741
|
// note: the smart contract requires that the signatures are provided in the order of the committee
|
|
744
742
|
const sorted = orderAttestations(attestations, committee);
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
this.
|
|
749
|
-
unfreeze(nonEmpty[randomIndex]).signature = Signature.random();
|
|
743
|
+
|
|
744
|
+
// manipulate the attestations if we've been configured to do so
|
|
745
|
+
if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
|
|
746
|
+
return this.manipulateAttestations(block, epoch, seed, committee, sorted);
|
|
750
747
|
}
|
|
751
|
-
|
|
748
|
+
|
|
749
|
+
return new CommitteeAttestationsAndSigners(sorted);
|
|
752
750
|
} catch (err) {
|
|
753
751
|
if (err && err instanceof AttestationTimeoutError) {
|
|
754
752
|
collectedAttestationsCount = err.collectedCount;
|
|
@@ -759,6 +757,53 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
759
757
|
}
|
|
760
758
|
}
|
|
761
759
|
|
|
760
|
+
/** Breaks the attestations before publishing based on attack configs */
|
|
761
|
+
private manipulateAttestations(
|
|
762
|
+
block: L2Block,
|
|
763
|
+
epoch: bigint,
|
|
764
|
+
seed: bigint,
|
|
765
|
+
committee: EthAddress[],
|
|
766
|
+
attestations: CommitteeAttestation[],
|
|
767
|
+
) {
|
|
768
|
+
// Compute the proposer index in the committee, since we dont want to tweak it.
|
|
769
|
+
// Otherwise, the L1 rollup contract will reject the block outright.
|
|
770
|
+
const proposerIndex = Number(
|
|
771
|
+
this.epochCache.computeProposerIndex(block.slot, epoch, seed, BigInt(committee.length)),
|
|
772
|
+
);
|
|
773
|
+
|
|
774
|
+
if (this.config.injectFakeAttestation) {
|
|
775
|
+
// Find non-empty attestations that are not from the proposer
|
|
776
|
+
const nonProposerIndices: number[] = [];
|
|
777
|
+
for (let i = 0; i < attestations.length; i++) {
|
|
778
|
+
if (!attestations[i].signature.isEmpty() && i !== proposerIndex) {
|
|
779
|
+
nonProposerIndices.push(i);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
if (nonProposerIndices.length > 0) {
|
|
783
|
+
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
784
|
+
this.log.warn(`Injecting fake attestation in block ${block.number} at index ${targetIndex}`);
|
|
785
|
+
unfreeze(attestations[targetIndex]).signature = Signature.random();
|
|
786
|
+
}
|
|
787
|
+
return new CommitteeAttestationsAndSigners(attestations);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
if (this.config.shuffleAttestationOrdering) {
|
|
791
|
+
this.log.warn(`Shuffling attestation ordering in block ${block.number} (proposer index ${proposerIndex})`);
|
|
792
|
+
|
|
793
|
+
const shuffled = [...attestations];
|
|
794
|
+
const [i, j] = [(proposerIndex + 1) % shuffled.length, (proposerIndex + 2) % shuffled.length];
|
|
795
|
+
const valueI = shuffled[i];
|
|
796
|
+
const valueJ = shuffled[j];
|
|
797
|
+
shuffled[i] = valueJ;
|
|
798
|
+
shuffled[j] = valueI;
|
|
799
|
+
|
|
800
|
+
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
801
|
+
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return new CommitteeAttestationsAndSigners(attestations);
|
|
805
|
+
}
|
|
806
|
+
|
|
762
807
|
/**
|
|
763
808
|
* Publishes the L2Block to the rollup contract.
|
|
764
809
|
* @param block - The L2Block to be published.
|