@aztec/sequencer-client 3.0.0-nightly.20250906 → 3.0.0-nightly.20250910
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/sequencer-client.d.ts +2 -1
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +5 -2
- package/dest/publisher/sequencer-publisher.d.ts +5 -7
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +22 -33
- package/dest/sequencer/block_builder.d.ts +2 -5
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +11 -3
- package/dest/sequencer/sequencer.d.ts +4 -3
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +17 -8
- package/package.json +26 -26
- package/src/client/sequencer-client.ts +3 -1
- package/src/publisher/sequencer-publisher.ts +30 -43
- package/src/sequencer/block_builder.ts +13 -16
- package/src/sequencer/sequencer.ts +46 -23
|
@@ -21,9 +21,10 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
|
21
21
|
export declare class SequencerClient {
|
|
22
22
|
protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>;
|
|
23
23
|
protected sequencer: Sequencer;
|
|
24
|
+
protected blockBuilder: IFullNodeBlockBuilder;
|
|
24
25
|
protected validatorClient?: ValidatorClient | undefined;
|
|
25
26
|
private l1Metrics?;
|
|
26
|
-
constructor(publisherManager: PublisherManager<L1TxUtilsWithBlobs>, sequencer: Sequencer, validatorClient?: ValidatorClient | undefined, l1Metrics?: L1Metrics | undefined);
|
|
27
|
+
constructor(publisherManager: PublisherManager<L1TxUtilsWithBlobs>, sequencer: Sequencer, blockBuilder: IFullNodeBlockBuilder, validatorClient?: ValidatorClient | undefined, l1Metrics?: L1Metrics | undefined);
|
|
27
28
|
/**
|
|
28
29
|
* Initializes a new instance.
|
|
29
30
|
* @param config - Configuration for the sequencer, publis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SAAS,CAEtC;CACF"}
|
|
@@ -13,11 +13,13 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
13
13
|
*/ export class SequencerClient {
|
|
14
14
|
publisherManager;
|
|
15
15
|
sequencer;
|
|
16
|
+
blockBuilder;
|
|
16
17
|
validatorClient;
|
|
17
18
|
l1Metrics;
|
|
18
|
-
constructor(publisherManager, sequencer, validatorClient, l1Metrics){
|
|
19
|
+
constructor(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics){
|
|
19
20
|
this.publisherManager = publisherManager;
|
|
20
21
|
this.sequencer = sequencer;
|
|
22
|
+
this.blockBuilder = blockBuilder;
|
|
21
23
|
this.validatorClient = validatorClient;
|
|
22
24
|
this.l1Metrics = l1Metrics;
|
|
23
25
|
}
|
|
@@ -94,13 +96,14 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
94
96
|
maxL2BlockGas: sequencerManaLimit
|
|
95
97
|
}, telemetryClient);
|
|
96
98
|
await sequencer.init();
|
|
97
|
-
return new SequencerClient(publisherManager, sequencer, validatorClient, l1Metrics);
|
|
99
|
+
return new SequencerClient(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics);
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* Updates sequencer and validator client config.
|
|
101
103
|
* @param config - New parameters.
|
|
102
104
|
*/ updateConfig(config) {
|
|
103
105
|
this.sequencer.updateConfig(config);
|
|
106
|
+
this.blockBuilder.updateConfig(config);
|
|
104
107
|
this.validatorClient?.updateConfig(config);
|
|
105
108
|
}
|
|
106
109
|
/** Starts the sequencer. */ async start() {
|
|
@@ -4,12 +4,13 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
4
4
|
import { type EmpireSlashingProposerContract, FormattedViemError, type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type TallySlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
5
5
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
7
8
|
import type { Fr } from '@aztec/foundation/fields';
|
|
8
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
10
|
import { type ProposerSlashAction } from '@aztec/slasher';
|
|
10
|
-
import {
|
|
11
|
+
import { CommitteeAttestationsAndSigners, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
11
12
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
12
|
-
import { type ProposedBlockHeader
|
|
13
|
+
import { type ProposedBlockHeader } from '@aztec/stdlib/tx';
|
|
13
14
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
14
15
|
import { type TransactionReceipt, type TypedDataDefinition } from 'viem';
|
|
15
16
|
import type { PublisherConfig, TxSenderConfig } from './config.js';
|
|
@@ -138,10 +139,7 @@ export declare class SequencerPublisher {
|
|
|
138
139
|
* @param attestationData - The block's attestation data
|
|
139
140
|
*
|
|
140
141
|
*/
|
|
141
|
-
validateBlockForSubmission(block: L2Block,
|
|
142
|
-
digest: Buffer;
|
|
143
|
-
attestations: CommitteeAttestation[];
|
|
144
|
-
} | undefined, options: {
|
|
142
|
+
validateBlockForSubmission(block: L2Block, attestationsAndSigners: CommitteeAttestationsAndSigners, attestationsAndSignersSignature: Signature, options: {
|
|
145
143
|
forcePendingBlockNumber?: number;
|
|
146
144
|
}): Promise<bigint>;
|
|
147
145
|
private enqueueCastSignalHelper;
|
|
@@ -160,7 +158,7 @@ export declare class SequencerPublisher {
|
|
|
160
158
|
* @param block - L2 block to propose.
|
|
161
159
|
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
162
160
|
*/
|
|
163
|
-
enqueueProposeL2Block(block: L2Block,
|
|
161
|
+
enqueueProposeL2Block(block: L2Block, attestationsAndSigners: CommitteeAttestationsAndSigners, attestationsAndSignersSignature: Signature, opts?: {
|
|
164
162
|
txTimeoutAt?: Date;
|
|
165
163
|
forcePendingBlockNumber?: number;
|
|
166
164
|
}): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,KAAK,8BAA8B,EACnC,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,0BAA0B,EAE/B,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAGhB,cAAc,EACd,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EAMtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,gBAAgB,CAAC;AACrF,OAAO,
|
|
1
|
+
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,KAAK,8BAA8B,EACnC,kB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@@ -4,13 +4,13 @@ import { FormattedViemError, MULTI_CALL_3_ADDRESS, Multicall3, RollupContract, f
|
|
|
4
4
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
5
5
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
7
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
9
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
10
|
import { Timer } from '@aztec/foundation/timer';
|
|
10
11
|
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
11
12
|
import { encodeSlashConsensusVotes } from '@aztec/slasher';
|
|
12
|
-
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
13
|
-
import { ConsensusPayload, SignatureDomainSeparator, getHashedSignaturePayload } from '@aztec/stdlib/p2p';
|
|
13
|
+
import { CommitteeAttestation, CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
14
14
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
15
15
|
import pick from 'lodash.pick';
|
|
16
16
|
import { encodeFunctionData, toHex } from 'viem';
|
|
@@ -241,8 +241,9 @@ export class SequencerPublisher {
|
|
|
241
241
|
};
|
|
242
242
|
const args = [
|
|
243
243
|
header.toViem(),
|
|
244
|
-
|
|
244
|
+
CommitteeAttestationsAndSigners.empty().getPackedAttestations(),
|
|
245
245
|
[],
|
|
246
|
+
Signature.empty().toViemSignature(),
|
|
246
247
|
`0x${'0'.repeat(64)}`,
|
|
247
248
|
header.contentCommitment.blobsHash.toString(),
|
|
248
249
|
flags
|
|
@@ -347,10 +348,11 @@ export class SequencerPublisher {
|
|
|
347
348
|
reason
|
|
348
349
|
};
|
|
349
350
|
this.log.debug(`Simulating invalidate block ${block.block.number}`, logData);
|
|
351
|
+
const attestationsAndSigners = new CommitteeAttestationsAndSigners(block.attestations).getPackedAttestations();
|
|
350
352
|
if (reason === 'invalid-attestation') {
|
|
351
|
-
return this.rollupContract.buildInvalidateBadAttestationRequest(block.block.number,
|
|
353
|
+
return this.rollupContract.buildInvalidateBadAttestationRequest(block.block.number, attestationsAndSigners, committee, validationResult.invalidIndex);
|
|
352
354
|
} else if (reason === 'insufficient-attestations') {
|
|
353
|
-
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(block.block.number,
|
|
355
|
+
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(block.block.number, attestationsAndSigners, committee);
|
|
354
356
|
} else {
|
|
355
357
|
const _ = reason;
|
|
356
358
|
throw new Error(`Unknown reason for invalidation`);
|
|
@@ -364,38 +366,33 @@ export class SequencerPublisher {
|
|
|
364
366
|
* @param block - The block to propose
|
|
365
367
|
* @param attestationData - The block's attestation data
|
|
366
368
|
*
|
|
367
|
-
*/ async validateBlockForSubmission(block,
|
|
368
|
-
digest: Buffer.alloc(32),
|
|
369
|
-
attestations: []
|
|
370
|
-
}, options) {
|
|
369
|
+
*/ async validateBlockForSubmission(block, attestationsAndSigners, attestationsAndSignersSignature, options) {
|
|
371
370
|
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
372
371
|
// If we have no attestations, we still need to provide the empty attestations
|
|
373
372
|
// so that the committee is recalculated correctly
|
|
374
|
-
const ignoreSignatures =
|
|
373
|
+
const ignoreSignatures = attestationsAndSigners.attestations.length === 0;
|
|
375
374
|
if (ignoreSignatures) {
|
|
376
375
|
const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber.toBigInt());
|
|
377
376
|
if (!committee) {
|
|
378
377
|
this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
379
378
|
throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
380
379
|
}
|
|
381
|
-
|
|
380
|
+
attestationsAndSigners.attestations = committee.map((committeeMember)=>CommitteeAttestation.fromAddress(committeeMember));
|
|
382
381
|
}
|
|
383
382
|
const blobs = await Blob.getBlobsPerBlock(block.body.toBlobFields());
|
|
384
383
|
const blobInput = Blob.getPrefixedEthBlobCommitments(blobs);
|
|
385
|
-
const formattedAttestations = attestationData.attestations.map((attest)=>attest.toViem());
|
|
386
|
-
const signers = attestationData.attestations.filter((attest)=>!attest.signature.isEmpty()).map((attest)=>attest.address.toString());
|
|
387
384
|
const args = [
|
|
388
385
|
{
|
|
389
386
|
header: block.header.toPropose().toViem(),
|
|
390
387
|
archive: toHex(block.archive.root.toBuffer()),
|
|
391
388
|
stateReference: block.header.state.toViem(),
|
|
392
|
-
txHashes: block.body.txEffects.map((txEffect)=>txEffect.txHash.toString()),
|
|
393
389
|
oracleInput: {
|
|
394
390
|
feeAssetPriceModifier: 0n
|
|
395
391
|
}
|
|
396
392
|
},
|
|
397
|
-
|
|
398
|
-
|
|
393
|
+
attestationsAndSigners.getPackedAttestations(),
|
|
394
|
+
attestationsAndSigners.getSigners().map((signer)=>signer.toString()),
|
|
395
|
+
attestationsAndSignersSignature.toViemSignature(),
|
|
399
396
|
blobInput
|
|
400
397
|
];
|
|
401
398
|
await this.simulateProposeTx(args, ts, options);
|
|
@@ -566,10 +563,8 @@ export class SequencerPublisher {
|
|
|
566
563
|
*
|
|
567
564
|
* @param block - L2 block to propose.
|
|
568
565
|
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
569
|
-
*/ async enqueueProposeL2Block(block,
|
|
566
|
+
*/ async enqueueProposeL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, opts = {}) {
|
|
570
567
|
const proposedBlockHeader = block.header.toPropose();
|
|
571
|
-
const consensusPayload = ConsensusPayload.fromBlock(block);
|
|
572
|
-
const digest = getHashedSignaturePayload(consensusPayload, SignatureDomainSeparator.blockAttestation);
|
|
573
568
|
const blobs = await Blob.getBlobsPerBlock(block.body.toBlobFields());
|
|
574
569
|
const proposeTxArgs = {
|
|
575
570
|
header: proposedBlockHeader,
|
|
@@ -577,8 +572,8 @@ export class SequencerPublisher {
|
|
|
577
572
|
stateReference: block.header.state,
|
|
578
573
|
body: block.body.toBuffer(),
|
|
579
574
|
blobs,
|
|
580
|
-
|
|
581
|
-
|
|
575
|
+
attestationsAndSigners,
|
|
576
|
+
attestationsAndSignersSignature
|
|
582
577
|
};
|
|
583
578
|
let ts;
|
|
584
579
|
try {
|
|
@@ -586,12 +581,8 @@ export class SequencerPublisher {
|
|
|
586
581
|
// This means that we can avoid the simulation issues in later checks.
|
|
587
582
|
// By simulation issue, I mean the fact that the block.timestamp is equal to the last block, not the next, which
|
|
588
583
|
// make time consistency checks break.
|
|
589
|
-
const attestationData = {
|
|
590
|
-
digest: digest.toBuffer(),
|
|
591
|
-
attestations: attestations ?? []
|
|
592
|
-
};
|
|
593
584
|
// TODO(palla): Check whether we're validating twice, once here and once within addProposeTx, since we call simulateProposeTx in both places.
|
|
594
|
-
ts = await this.validateBlockForSubmission(block,
|
|
585
|
+
ts = await this.validateBlockForSubmission(block, attestationsAndSigners, attestationsAndSignersSignature, opts);
|
|
595
586
|
} catch (err) {
|
|
596
587
|
this.log.error(`Block validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
597
588
|
...block.getStats(),
|
|
@@ -733,9 +724,7 @@ export class SequencerPublisher {
|
|
|
733
724
|
});
|
|
734
725
|
throw new Error('Failed to validate blobs');
|
|
735
726
|
});
|
|
736
|
-
const
|
|
737
|
-
const txHashes = encodedData.txHashes ? encodedData.txHashes.map((txHash)=>txHash.toString()) : [];
|
|
738
|
-
const signers = encodedData.attestations?.filter((attest)=>!attest.signature.isEmpty()).map((attest)=>attest.address.toString());
|
|
727
|
+
const signers = encodedData.attestationsAndSigners.getSigners().map((signer)=>signer.toString());
|
|
739
728
|
const args = [
|
|
740
729
|
{
|
|
741
730
|
header: encodedData.header.toViem(),
|
|
@@ -744,11 +733,11 @@ export class SequencerPublisher {
|
|
|
744
733
|
oracleInput: {
|
|
745
734
|
// We are currently not modifying these. See #9963
|
|
746
735
|
feeAssetPriceModifier: 0n
|
|
747
|
-
}
|
|
748
|
-
txHashes
|
|
736
|
+
}
|
|
749
737
|
},
|
|
750
|
-
|
|
751
|
-
signers
|
|
738
|
+
encodedData.attestationsAndSigners.getPackedAttestations(),
|
|
739
|
+
signers,
|
|
740
|
+
encodedData.attestationsAndSignersSignature.toViemSignature(),
|
|
752
741
|
blobInput
|
|
753
742
|
];
|
|
754
743
|
const { rollupData, simulationResult } = await this.simulateProposeTx(args, timestamp, options);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
3
|
import { PublicProcessor } from '@aztec/simulator/server';
|
|
4
|
-
import type { ChainConfig, SequencerConfig } from '@aztec/stdlib/config';
|
|
5
4
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
6
5
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
7
|
-
import type { BuildBlockResult, IFullNodeBlockBuilder, MerkleTreeWriteOperations, PublicProcessorLimits, PublicProcessorValidator, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import type { BuildBlockResult, FullNodeBlockBuilderConfig, IFullNodeBlockBuilder, MerkleTreeWriteOperations, PublicProcessorLimits, PublicProcessorValidator, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
8
7
|
import { GlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
9
8
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
10
9
|
export declare function buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, l1ToL2Messages: Fr[], newGlobalVariables: GlobalVariables, opts: PublicProcessorLimits | undefined, worldStateFork: MerkleTreeWriteOperations, processor: PublicProcessor, validator: PublicProcessorValidator, l1Constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>, dateProvider: DateProvider, telemetryClient?: TelemetryClient): Promise<BuildBlockResult>;
|
|
11
|
-
type FullNodeBlockBuilderConfig = Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'> & Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> & Pick<SequencerConfig, 'txPublicSetupAllowList' | 'fakeProcessingDelayPerTxMs'>;
|
|
12
10
|
export declare class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
13
11
|
private config;
|
|
14
12
|
private worldState;
|
|
@@ -17,7 +15,7 @@ export declare class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
|
17
15
|
private telemetryClient;
|
|
18
16
|
constructor(config: FullNodeBlockBuilderConfig, worldState: WorldStateSynchronizer, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient?: TelemetryClient);
|
|
19
17
|
getConfig(): FullNodeBlockBuilderConfig;
|
|
20
|
-
updateConfig(config: FullNodeBlockBuilderConfig): void;
|
|
18
|
+
updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
|
|
21
19
|
makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations): Promise<{
|
|
22
20
|
processor: PublicProcessor;
|
|
23
21
|
validator: PublicProcessorValidator;
|
|
@@ -26,5 +24,4 @@ export declare class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
|
26
24
|
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, l1ToL2Messages: Fr[], globalVariables: GlobalVariables, opts: PublicProcessorLimits, suppliedFork?: MerkleTreeWriteOperations): Promise<BuildBlockResult>;
|
|
27
25
|
getFork(blockNumber: number): Promise<MerkleTreeWriteOperations>;
|
|
28
26
|
}
|
|
29
|
-
export {};
|
|
30
27
|
//# sourceMappingURL=block_builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_builder.d.ts","sourceRoot":"","sources":["../../src/sequencer/block_builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0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qB;IAE9D,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBAJf,MAAM,EAAE,0BAA0B,EAClC,UAAU,EAAE,sBAAsB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,eAAe,GAAE,eAAsC;IAG1D,SAAS,IAAI,0BAA0B;IAIvC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,0BAA0B,CAAC;IAIlD,oBAAoB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,yBAAyB;;;;YAuCrF,mBAAmB;IAU3B,UAAU,CACd,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EAC5C,cAAc,EAAE,EAAE,EAAE,EACpB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,qBAAqB,EAC3B,YAAY,CAAC,EAAE,yBAAyB,GACvC,OAAO,CAAC,gBAAgB,CAAC;IAwC5B,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAGjE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MerkleTreeId, elapsed } from '@aztec/aztec.js';
|
|
2
|
-
import { pick } from '@aztec/foundation/collection';
|
|
2
|
+
import { merge, pick } from '@aztec/foundation/collection';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
5
5
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
@@ -50,6 +50,14 @@ export async function buildBlock(pendingTxs, l1ToL2Messages, newGlobalVariables,
|
|
|
50
50
|
log.trace('Built block', res.block.header);
|
|
51
51
|
return res;
|
|
52
52
|
}
|
|
53
|
+
const FullNodeBlockBuilderConfigKeys = [
|
|
54
|
+
'l1GenesisTime',
|
|
55
|
+
'slotDuration',
|
|
56
|
+
'l1ChainId',
|
|
57
|
+
'rollupVersion',
|
|
58
|
+
'txPublicSetupAllowList',
|
|
59
|
+
'fakeProcessingDelayPerTxMs'
|
|
60
|
+
];
|
|
53
61
|
export class FullNodeBlockBuilder {
|
|
54
62
|
config;
|
|
55
63
|
worldState;
|
|
@@ -64,10 +72,10 @@ export class FullNodeBlockBuilder {
|
|
|
64
72
|
this.telemetryClient = telemetryClient;
|
|
65
73
|
}
|
|
66
74
|
getConfig() {
|
|
67
|
-
return pick(this.config,
|
|
75
|
+
return pick(this.config, ...FullNodeBlockBuilderConfigKeys);
|
|
68
76
|
}
|
|
69
77
|
updateConfig(config) {
|
|
70
|
-
this.config = config;
|
|
78
|
+
this.config = merge(this.config, pick(config, ...FullNodeBlockBuilderConfigKeys));
|
|
71
79
|
}
|
|
72
80
|
async makeBlockBuilderDeps(globalVariables, fork) {
|
|
73
81
|
const txPublicSetupAllowList = this.config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
@@ -2,16 +2,17 @@ import type { L2Block } from '@aztec/aztec.js';
|
|
|
2
2
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
3
3
|
import { type RollupContract } from '@aztec/ethereum';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
6
|
import { Fr } from '@aztec/foundation/fields';
|
|
6
7
|
import { type DateProvider } from '@aztec/foundation/timer';
|
|
7
8
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
8
9
|
import type { P2P } from '@aztec/p2p';
|
|
9
10
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
10
|
-
import type
|
|
11
|
+
import { type CommitteeAttestation, CommitteeAttestationsAndSigners, type L2BlockSource, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
11
12
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
12
13
|
import { type IFullNodeBlockBuilder, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
13
14
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
14
|
-
import { Tx
|
|
15
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
15
16
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
16
17
|
import type { ValidatorClient } from '@aztec/validator-client';
|
|
17
18
|
import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
|
|
@@ -160,7 +161,7 @@ export declare class Sequencer extends Sequencer_base {
|
|
|
160
161
|
* Publishes the L2Block to the rollup contract.
|
|
161
162
|
* @param block - The L2Block to be published.
|
|
162
163
|
*/
|
|
163
|
-
protected enqueuePublishL2Block(block: L2Block,
|
|
164
|
+
protected enqueuePublishL2Block(block: L2Block, attestationsAndSigners: CommitteeAttestationsAndSigners, attestationsAndSignersSignature: Signature, invalidateBlock: InvalidateBlockRequest | undefined, publisher: SequencerPublisher): Promise<void>;
|
|
164
165
|
/**
|
|
165
166
|
* Returns whether all dependencies have caught up.
|
|
166
167
|
* We don't check against the previous block submitted since it may have been reorg'd out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,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AI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEM,gBAAgB,IAAI,sBAAsB,GAAG,SAAS;CAG9D"}
|
|
@@ -8,10 +8,12 @@ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
|
8
8
|
import { FormattedViemError, NoCommitteeError } from '@aztec/ethereum';
|
|
9
9
|
import { omit, pick } from '@aztec/foundation/collection';
|
|
10
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
11
12
|
import { Fr } from '@aztec/foundation/fields';
|
|
12
13
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
14
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
14
15
|
import { Timer } from '@aztec/foundation/timer';
|
|
16
|
+
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
15
17
|
import { getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
16
18
|
import { Gas } from '@aztec/stdlib/gas';
|
|
17
19
|
import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
|
|
@@ -416,7 +418,12 @@ export { SequencerState };
|
|
|
416
418
|
secondsIntoSlot = this.getSecondsIntoSlot(slotNumber);
|
|
417
419
|
this.timetable.assertTimeLeft(proposedState, secondsIntoSlot);
|
|
418
420
|
}
|
|
419
|
-
|
|
421
|
+
const boringStates = [
|
|
422
|
+
SequencerState.IDLE,
|
|
423
|
+
SequencerState.SYNCHRONIZING
|
|
424
|
+
];
|
|
425
|
+
const logLevel = boringStates.includes(proposedState) && boringStates.includes(this.state) ? 'trace' : 'debug';
|
|
426
|
+
this.log[logLevel](`Transitioning from ${this.state} to ${proposedState}`, {
|
|
420
427
|
slotNumber,
|
|
421
428
|
secondsIntoSlot
|
|
422
429
|
});
|
|
@@ -510,7 +517,9 @@ export { SequencerState };
|
|
|
510
517
|
blockNumber
|
|
511
518
|
});
|
|
512
519
|
}
|
|
513
|
-
|
|
520
|
+
const attestationsAndSigners = new CommitteeAttestationsAndSigners(attestations ?? []);
|
|
521
|
+
const attestationsAndSignersSignature = this.validatorClient ? await this.validatorClient.signAttestationsAndSigners(attestationsAndSigners, proposerAddress ?? publisher.getSenderAddress()) : Signature.empty();
|
|
522
|
+
await this.enqueuePublishL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, invalidateBlock, publisher);
|
|
514
523
|
this.metrics.recordBuiltBlock(blockBuildDuration, publicGas.l2Gas);
|
|
515
524
|
return block;
|
|
516
525
|
} catch (err) {
|
|
@@ -556,32 +565,32 @@ export { SequencerState };
|
|
|
556
565
|
const attestationTimeAllowed = this.enforceTimeTable ? this.timetable.getMaxAllowedTime(SequencerState.PUBLISHING_BLOCK) : this.aztecSlotDuration;
|
|
557
566
|
this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
|
|
558
567
|
const timer = new Timer();
|
|
559
|
-
let
|
|
568
|
+
let collectedAttestationsCount = 0;
|
|
560
569
|
try {
|
|
561
570
|
const attestationDeadline = new Date(this.dateProvider.now() + attestationTimeAllowed * 1000);
|
|
562
571
|
const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
|
|
563
|
-
|
|
572
|
+
collectedAttestationsCount = attestations.length;
|
|
564
573
|
// note: the smart contract requires that the signatures are provided in the order of the committee
|
|
565
574
|
return orderAttestations(attestations, committee);
|
|
566
575
|
} catch (err) {
|
|
567
576
|
if (err && err instanceof AttestationTimeoutError) {
|
|
568
|
-
|
|
577
|
+
collectedAttestationsCount = err.collectedCount;
|
|
569
578
|
}
|
|
570
579
|
throw err;
|
|
571
580
|
} finally{
|
|
572
|
-
this.metrics.recordCollectedAttestations(
|
|
581
|
+
this.metrics.recordCollectedAttestations(collectedAttestationsCount, timer.ms());
|
|
573
582
|
}
|
|
574
583
|
}
|
|
575
584
|
/**
|
|
576
585
|
* Publishes the L2Block to the rollup contract.
|
|
577
586
|
* @param block - The L2Block to be published.
|
|
578
|
-
*/ async enqueuePublishL2Block(block,
|
|
587
|
+
*/ async enqueuePublishL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, invalidateBlock, publisher) {
|
|
579
588
|
// Publishes new block to the network and awaits the tx to be mined
|
|
580
589
|
this.setState(SequencerState.PUBLISHING_BLOCK, block.header.globalVariables.slotNumber.toBigInt());
|
|
581
590
|
// Time out tx at the end of the slot
|
|
582
591
|
const slot = block.header.globalVariables.slotNumber.toNumber();
|
|
583
592
|
const txTimeoutAt = new Date((this.getSlotStartBuildTimestamp(slot) + this.aztecSlotDuration) * 1000);
|
|
584
|
-
const enqueued = await publisher.enqueueProposeL2Block(block,
|
|
593
|
+
const enqueued = await publisher.enqueueProposeL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, {
|
|
585
594
|
txTimeoutAt,
|
|
586
595
|
forcePendingBlockNumber: invalidateBlock?.forcePendingBlockNumber
|
|
587
596
|
});
|
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.20250910",
|
|
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/noir-acvm_js": "3.0.0-nightly.
|
|
40
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
42
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
43
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
44
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
45
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
46
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
47
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
48
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
49
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
50
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
51
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
29
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250910",
|
|
30
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250910",
|
|
31
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250910",
|
|
32
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250910",
|
|
33
|
+
"@aztec/constants": "3.0.0-nightly.20250910",
|
|
34
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250910",
|
|
35
|
+
"@aztec/ethereum": "3.0.0-nightly.20250910",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20250910",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250910",
|
|
38
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20250910",
|
|
39
|
+
"@aztec/noir-acvm_js": "3.0.0-nightly.20250910",
|
|
40
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250910",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250910",
|
|
42
|
+
"@aztec/noir-types": "3.0.0-nightly.20250910",
|
|
43
|
+
"@aztec/p2p": "3.0.0-nightly.20250910",
|
|
44
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250910",
|
|
45
|
+
"@aztec/prover-client": "3.0.0-nightly.20250910",
|
|
46
|
+
"@aztec/simulator": "3.0.0-nightly.20250910",
|
|
47
|
+
"@aztec/slasher": "3.0.0-nightly.20250910",
|
|
48
|
+
"@aztec/stdlib": "3.0.0-nightly.20250910",
|
|
49
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250910",
|
|
50
|
+
"@aztec/validator-client": "3.0.0-nightly.20250910",
|
|
51
|
+
"@aztec/world-state": "3.0.0-nightly.20250910",
|
|
52
52
|
"lodash.chunk": "^4.2.0",
|
|
53
53
|
"lodash.pick": "^4.4.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "2.23.7"
|
|
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.20250910",
|
|
59
|
+
"@aztec/kv-store": "3.0.0-nightly.20250910",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -37,6 +37,7 @@ export class SequencerClient {
|
|
|
37
37
|
constructor(
|
|
38
38
|
protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>,
|
|
39
39
|
protected sequencer: Sequencer,
|
|
40
|
+
protected blockBuilder: IFullNodeBlockBuilder,
|
|
40
41
|
protected validatorClient?: ValidatorClient,
|
|
41
42
|
private l1Metrics?: L1Metrics,
|
|
42
43
|
) {}
|
|
@@ -183,7 +184,7 @@ export class SequencerClient {
|
|
|
183
184
|
|
|
184
185
|
await sequencer.init();
|
|
185
186
|
|
|
186
|
-
return new SequencerClient(publisherManager, sequencer, validatorClient, l1Metrics);
|
|
187
|
+
return new SequencerClient(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics);
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
/**
|
|
@@ -192,6 +193,7 @@ export class SequencerClient {
|
|
|
192
193
|
*/
|
|
193
194
|
public updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>) {
|
|
194
195
|
this.sequencer.updateConfig(config);
|
|
196
|
+
this.blockBuilder.updateConfig(config);
|
|
195
197
|
this.validatorClient?.updateConfig(config);
|
|
196
198
|
}
|
|
197
199
|
|
|
@@ -27,17 +27,17 @@ import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs'
|
|
|
27
27
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
28
28
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
29
29
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
30
|
+
import { Signature, type ViemSignature } from '@aztec/foundation/eth-signature';
|
|
30
31
|
import type { Fr } from '@aztec/foundation/fields';
|
|
31
32
|
import { createLogger } from '@aztec/foundation/log';
|
|
32
33
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
33
34
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
34
35
|
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
35
36
|
import { type ProposerSlashAction, encodeSlashConsensusVotes } from '@aztec/slasher';
|
|
36
|
-
import { CommitteeAttestation, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
37
|
+
import { CommitteeAttestation, CommitteeAttestationsAndSigners, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
37
38
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
38
|
-
import { ConsensusPayload, SignatureDomainSeparator, getHashedSignaturePayload } from '@aztec/stdlib/p2p';
|
|
39
39
|
import type { L1PublishBlockStats } from '@aztec/stdlib/stats';
|
|
40
|
-
import { type ProposedBlockHeader, StateReference
|
|
40
|
+
import { type ProposedBlockHeader, StateReference } from '@aztec/stdlib/tx';
|
|
41
41
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
42
42
|
|
|
43
43
|
import pick from 'lodash.pick';
|
|
@@ -56,10 +56,10 @@ type L1ProcessArgs = {
|
|
|
56
56
|
stateReference: StateReference;
|
|
57
57
|
/** L2 block blobs containing all tx effects. */
|
|
58
58
|
blobs: Blob[];
|
|
59
|
-
/** L2 block tx hashes */
|
|
60
|
-
txHashes: TxHash[];
|
|
61
59
|
/** Attestations */
|
|
62
|
-
|
|
60
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners;
|
|
61
|
+
/** Attestations and signers signature */
|
|
62
|
+
attestationsAndSignersSignature: Signature;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export enum SignalType {
|
|
@@ -346,8 +346,9 @@ export class SequencerPublisher {
|
|
|
346
346
|
|
|
347
347
|
const args = [
|
|
348
348
|
header.toViem(),
|
|
349
|
-
|
|
349
|
+
CommitteeAttestationsAndSigners.empty().getPackedAttestations(),
|
|
350
350
|
[], // no signers
|
|
351
|
+
Signature.empty().toViemSignature(),
|
|
351
352
|
`0x${'0'.repeat(64)}`, // 32 empty bytes
|
|
352
353
|
header.contentCommitment.blobsHash.toString(),
|
|
353
354
|
flags,
|
|
@@ -446,17 +447,19 @@ export class SequencerPublisher {
|
|
|
446
447
|
const logData = { ...block.block.toBlockInfo(), reason };
|
|
447
448
|
this.log.debug(`Simulating invalidate block ${block.block.number}`, logData);
|
|
448
449
|
|
|
450
|
+
const attestationsAndSigners = new CommitteeAttestationsAndSigners(block.attestations).getPackedAttestations();
|
|
451
|
+
|
|
449
452
|
if (reason === 'invalid-attestation') {
|
|
450
453
|
return this.rollupContract.buildInvalidateBadAttestationRequest(
|
|
451
454
|
block.block.number,
|
|
452
|
-
|
|
455
|
+
attestationsAndSigners,
|
|
453
456
|
committee,
|
|
454
457
|
validationResult.invalidIndex,
|
|
455
458
|
);
|
|
456
459
|
} else if (reason === 'insufficient-attestations') {
|
|
457
460
|
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(
|
|
458
461
|
block.block.number,
|
|
459
|
-
|
|
462
|
+
attestationsAndSigners,
|
|
460
463
|
committee,
|
|
461
464
|
);
|
|
462
465
|
} else {
|
|
@@ -476,24 +479,22 @@ export class SequencerPublisher {
|
|
|
476
479
|
*/
|
|
477
480
|
public async validateBlockForSubmission(
|
|
478
481
|
block: L2Block,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
attestations: [],
|
|
482
|
-
},
|
|
482
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
483
|
+
attestationsAndSignersSignature: Signature,
|
|
483
484
|
options: { forcePendingBlockNumber?: number },
|
|
484
485
|
): Promise<bigint> {
|
|
485
486
|
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
486
487
|
|
|
487
488
|
// If we have no attestations, we still need to provide the empty attestations
|
|
488
489
|
// so that the committee is recalculated correctly
|
|
489
|
-
const ignoreSignatures =
|
|
490
|
+
const ignoreSignatures = attestationsAndSigners.attestations.length === 0;
|
|
490
491
|
if (ignoreSignatures) {
|
|
491
492
|
const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber.toBigInt());
|
|
492
493
|
if (!committee) {
|
|
493
494
|
this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
494
495
|
throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
|
|
495
496
|
}
|
|
496
|
-
|
|
497
|
+
attestationsAndSigners.attestations = committee.map(committeeMember =>
|
|
497
498
|
CommitteeAttestation.fromAddress(committeeMember),
|
|
498
499
|
);
|
|
499
500
|
}
|
|
@@ -501,23 +502,18 @@ export class SequencerPublisher {
|
|
|
501
502
|
const blobs = await Blob.getBlobsPerBlock(block.body.toBlobFields());
|
|
502
503
|
const blobInput = Blob.getPrefixedEthBlobCommitments(blobs);
|
|
503
504
|
|
|
504
|
-
const formattedAttestations = attestationData.attestations.map(attest => attest.toViem());
|
|
505
|
-
const signers = attestationData.attestations
|
|
506
|
-
.filter(attest => !attest.signature.isEmpty())
|
|
507
|
-
.map(attest => attest.address.toString());
|
|
508
|
-
|
|
509
505
|
const args = [
|
|
510
506
|
{
|
|
511
507
|
header: block.header.toPropose().toViem(),
|
|
512
508
|
archive: toHex(block.archive.root.toBuffer()),
|
|
513
509
|
stateReference: block.header.state.toViem(),
|
|
514
|
-
txHashes: block.body.txEffects.map(txEffect => txEffect.txHash.toString()),
|
|
515
510
|
oracleInput: {
|
|
516
511
|
feeAssetPriceModifier: 0n,
|
|
517
512
|
},
|
|
518
513
|
},
|
|
519
|
-
|
|
520
|
-
|
|
514
|
+
attestationsAndSigners.getPackedAttestations(),
|
|
515
|
+
attestationsAndSigners.getSigners().map(signer => signer.toString()),
|
|
516
|
+
attestationsAndSignersSignature.toViemSignature(),
|
|
521
517
|
blobInput,
|
|
522
518
|
] as const;
|
|
523
519
|
|
|
@@ -766,15 +762,12 @@ export class SequencerPublisher {
|
|
|
766
762
|
*/
|
|
767
763
|
public async enqueueProposeL2Block(
|
|
768
764
|
block: L2Block,
|
|
769
|
-
|
|
770
|
-
|
|
765
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
766
|
+
attestationsAndSignersSignature: Signature,
|
|
771
767
|
opts: { txTimeoutAt?: Date; forcePendingBlockNumber?: number } = {},
|
|
772
768
|
): Promise<boolean> {
|
|
773
769
|
const proposedBlockHeader = block.header.toPropose();
|
|
774
770
|
|
|
775
|
-
const consensusPayload = ConsensusPayload.fromBlock(block);
|
|
776
|
-
const digest = getHashedSignaturePayload(consensusPayload, SignatureDomainSeparator.blockAttestation);
|
|
777
|
-
|
|
778
771
|
const blobs = await Blob.getBlobsPerBlock(block.body.toBlobFields());
|
|
779
772
|
const proposeTxArgs = {
|
|
780
773
|
header: proposedBlockHeader,
|
|
@@ -782,8 +775,8 @@ export class SequencerPublisher {
|
|
|
782
775
|
stateReference: block.header.state,
|
|
783
776
|
body: block.body.toBuffer(),
|
|
784
777
|
blobs,
|
|
785
|
-
|
|
786
|
-
|
|
778
|
+
attestationsAndSigners,
|
|
779
|
+
attestationsAndSignersSignature,
|
|
787
780
|
};
|
|
788
781
|
|
|
789
782
|
let ts: bigint;
|
|
@@ -793,9 +786,8 @@ export class SequencerPublisher {
|
|
|
793
786
|
// This means that we can avoid the simulation issues in later checks.
|
|
794
787
|
// By simulation issue, I mean the fact that the block.timestamp is equal to the last block, not the next, which
|
|
795
788
|
// make time consistency checks break.
|
|
796
|
-
const attestationData = { digest: digest.toBuffer(), attestations: attestations ?? [] };
|
|
797
789
|
// TODO(palla): Check whether we're validating twice, once here and once within addProposeTx, since we call simulateProposeTx in both places.
|
|
798
|
-
ts = await this.validateBlockForSubmission(block,
|
|
790
|
+
ts = await this.validateBlockForSubmission(block, attestationsAndSigners, attestationsAndSignersSignature, opts);
|
|
799
791
|
} catch (err: any) {
|
|
800
792
|
this.log.error(`Block validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
801
793
|
...block.getStats(),
|
|
@@ -932,12 +924,7 @@ export class SequencerPublisher {
|
|
|
932
924
|
throw new Error('Failed to validate blobs');
|
|
933
925
|
});
|
|
934
926
|
|
|
935
|
-
const
|
|
936
|
-
const txHashes = encodedData.txHashes ? encodedData.txHashes.map(txHash => txHash.toString()) : [];
|
|
937
|
-
|
|
938
|
-
const signers = encodedData.attestations
|
|
939
|
-
?.filter(attest => !attest.signature.isEmpty())
|
|
940
|
-
.map(attest => attest.address.toString());
|
|
927
|
+
const signers = encodedData.attestationsAndSigners.getSigners().map(signer => signer.toString());
|
|
941
928
|
|
|
942
929
|
const args = [
|
|
943
930
|
{
|
|
@@ -948,10 +935,10 @@ export class SequencerPublisher {
|
|
|
948
935
|
// We are currently not modifying these. See #9963
|
|
949
936
|
feeAssetPriceModifier: 0n,
|
|
950
937
|
},
|
|
951
|
-
txHashes,
|
|
952
938
|
},
|
|
953
|
-
|
|
954
|
-
signers
|
|
939
|
+
encodedData.attestationsAndSigners.getPackedAttestations(),
|
|
940
|
+
signers,
|
|
941
|
+
encodedData.attestationsAndSignersSignature.toViemSignature(),
|
|
955
942
|
blobInput,
|
|
956
943
|
] as const;
|
|
957
944
|
|
|
@@ -972,13 +959,13 @@ export class SequencerPublisher {
|
|
|
972
959
|
readonly header: ViemHeader;
|
|
973
960
|
readonly archive: `0x${string}`;
|
|
974
961
|
readonly stateReference: ViemStateReference;
|
|
975
|
-
readonly txHashes: `0x${string}`[];
|
|
976
962
|
readonly oracleInput: {
|
|
977
963
|
readonly feeAssetPriceModifier: 0n;
|
|
978
964
|
};
|
|
979
965
|
},
|
|
980
966
|
ViemCommitteeAttestations,
|
|
981
|
-
`0x${string}`[],
|
|
967
|
+
`0x${string}`[], // Signers
|
|
968
|
+
ViemSignature,
|
|
982
969
|
`0x${string}`,
|
|
983
970
|
],
|
|
984
971
|
timestamp: bigint,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MerkleTreeId, elapsed } from '@aztec/aztec.js';
|
|
2
|
-
import { pick } from '@aztec/foundation/collection';
|
|
2
|
+
import { merge, pick } from '@aztec/foundation/collection';
|
|
3
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
PublicProcessor,
|
|
14
14
|
TelemetryPublicTxSimulator,
|
|
15
15
|
} from '@aztec/simulator/server';
|
|
16
|
-
import type { ChainConfig, SequencerConfig } from '@aztec/stdlib/config';
|
|
17
16
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
18
17
|
import { type L1RollupConstants, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
19
18
|
import { Gas } from '@aztec/stdlib/gas';
|
|
20
19
|
import type {
|
|
21
20
|
BuildBlockResult,
|
|
21
|
+
FullNodeBlockBuilderConfig,
|
|
22
22
|
IFullNodeBlockBuilder,
|
|
23
23
|
MerkleTreeWriteOperations,
|
|
24
24
|
PublicProcessorLimits,
|
|
@@ -89,9 +89,14 @@ export async function buildBlock(
|
|
|
89
89
|
return res;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const FullNodeBlockBuilderConfigKeys = [
|
|
93
|
+
'l1GenesisTime',
|
|
94
|
+
'slotDuration',
|
|
95
|
+
'l1ChainId',
|
|
96
|
+
'rollupVersion',
|
|
97
|
+
'txPublicSetupAllowList',
|
|
98
|
+
'fakeProcessingDelayPerTxMs',
|
|
99
|
+
] as const;
|
|
95
100
|
|
|
96
101
|
export class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
97
102
|
constructor(
|
|
@@ -103,19 +108,11 @@ export class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
|
103
108
|
) {}
|
|
104
109
|
|
|
105
110
|
public getConfig(): FullNodeBlockBuilderConfig {
|
|
106
|
-
return pick(
|
|
107
|
-
this.config,
|
|
108
|
-
'l1GenesisTime',
|
|
109
|
-
'slotDuration',
|
|
110
|
-
'l1ChainId',
|
|
111
|
-
'rollupVersion',
|
|
112
|
-
'txPublicSetupAllowList',
|
|
113
|
-
'fakeProcessingDelayPerTxMs',
|
|
114
|
-
);
|
|
111
|
+
return pick(this.config, ...FullNodeBlockBuilderConfigKeys);
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
public updateConfig(config: FullNodeBlockBuilderConfig) {
|
|
118
|
-
this.config = config;
|
|
114
|
+
public updateConfig(config: Partial<FullNodeBlockBuilderConfig>) {
|
|
115
|
+
this.config = merge(this.config, pick(config, ...FullNodeBlockBuilderConfigKeys));
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
public async makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations) {
|
|
@@ -4,6 +4,7 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
4
4
|
import { FormattedViemError, NoCommitteeError, type RollupContract } from '@aztec/ethereum';
|
|
5
5
|
import { omit, pick } from '@aztec/foundation/collection';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
7
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
8
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
9
10
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
@@ -11,7 +12,12 @@ import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
|
11
12
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
12
13
|
import type { P2P } from '@aztec/p2p';
|
|
13
14
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
14
|
-
import
|
|
15
|
+
import {
|
|
16
|
+
type CommitteeAttestation,
|
|
17
|
+
CommitteeAttestationsAndSigners,
|
|
18
|
+
type L2BlockSource,
|
|
19
|
+
type ValidateBlockResult,
|
|
20
|
+
} from '@aztec/stdlib/block';
|
|
15
21
|
import { type L1RollupConstants, getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
16
22
|
import { Gas } from '@aztec/stdlib/gas';
|
|
17
23
|
import {
|
|
@@ -21,19 +27,11 @@ import {
|
|
|
21
27
|
type WorldStateSynchronizer,
|
|
22
28
|
} from '@aztec/stdlib/interfaces/server';
|
|
23
29
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
24
|
-
import type
|
|
25
|
-
import { orderAttestations } from '@aztec/stdlib/p2p';
|
|
30
|
+
import { type BlockProposalOptions, orderAttestations } from '@aztec/stdlib/p2p';
|
|
26
31
|
import { pickFromSchema } from '@aztec/stdlib/schemas';
|
|
27
32
|
import type { L2BlockBuiltStats } from '@aztec/stdlib/stats';
|
|
28
33
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
29
|
-
import {
|
|
30
|
-
ContentCommitment,
|
|
31
|
-
type FailedTx,
|
|
32
|
-
GlobalVariables,
|
|
33
|
-
ProposedBlockHeader,
|
|
34
|
-
Tx,
|
|
35
|
-
type TxHash,
|
|
36
|
-
} from '@aztec/stdlib/tx';
|
|
34
|
+
import { ContentCommitment, type FailedTx, GlobalVariables, ProposedBlockHeader, Tx } from '@aztec/stdlib/tx';
|
|
37
35
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
38
36
|
import { Attributes, type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
39
37
|
import type { ValidatorClient } from '@aztec/validator-client';
|
|
@@ -545,7 +543,13 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
545
543
|
this.timetable.assertTimeLeft(proposedState, secondsIntoSlot);
|
|
546
544
|
}
|
|
547
545
|
|
|
548
|
-
|
|
546
|
+
const boringStates = [SequencerState.IDLE, SequencerState.SYNCHRONIZING];
|
|
547
|
+
const logLevel =
|
|
548
|
+
boringStates.includes(proposedState) && boringStates.includes(this.state)
|
|
549
|
+
? ('trace' as const)
|
|
550
|
+
: ('debug' as const);
|
|
551
|
+
this.log[logLevel](`Transitioning from ${this.state} to ${proposedState}`, { slotNumber, secondsIntoSlot });
|
|
552
|
+
|
|
549
553
|
this.emit('state-changed', {
|
|
550
554
|
oldState: this.state,
|
|
551
555
|
newState: proposedState,
|
|
@@ -669,7 +673,21 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
669
673
|
this.log.verbose(`Collected ${attestations.length} attestations`, { blockHash, blockNumber });
|
|
670
674
|
}
|
|
671
675
|
|
|
672
|
-
|
|
676
|
+
const attestationsAndSigners = new CommitteeAttestationsAndSigners(attestations ?? []);
|
|
677
|
+
const attestationsAndSignersSignature = this.validatorClient
|
|
678
|
+
? await this.validatorClient.signAttestationsAndSigners(
|
|
679
|
+
attestationsAndSigners,
|
|
680
|
+
proposerAddress ?? publisher.getSenderAddress(),
|
|
681
|
+
)
|
|
682
|
+
: Signature.empty();
|
|
683
|
+
|
|
684
|
+
await this.enqueuePublishL2Block(
|
|
685
|
+
block,
|
|
686
|
+
attestationsAndSigners,
|
|
687
|
+
attestationsAndSignersSignature,
|
|
688
|
+
invalidateBlock,
|
|
689
|
+
publisher,
|
|
690
|
+
);
|
|
673
691
|
this.metrics.recordBuiltBlock(blockBuildDuration, publicGas.l2Gas);
|
|
674
692
|
return block;
|
|
675
693
|
} catch (err) {
|
|
@@ -745,7 +763,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
745
763
|
this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
|
|
746
764
|
|
|
747
765
|
const timer = new Timer();
|
|
748
|
-
let
|
|
766
|
+
let collectedAttestationsCount: number = 0;
|
|
749
767
|
try {
|
|
750
768
|
const attestationDeadline = new Date(this.dateProvider.now() + attestationTimeAllowed * 1000);
|
|
751
769
|
const attestations = await this.validatorClient.collectAttestations(
|
|
@@ -754,17 +772,17 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
754
772
|
attestationDeadline,
|
|
755
773
|
);
|
|
756
774
|
|
|
757
|
-
|
|
775
|
+
collectedAttestationsCount = attestations.length;
|
|
758
776
|
|
|
759
777
|
// note: the smart contract requires that the signatures are provided in the order of the committee
|
|
760
778
|
return orderAttestations(attestations, committee);
|
|
761
779
|
} catch (err) {
|
|
762
780
|
if (err && err instanceof AttestationTimeoutError) {
|
|
763
|
-
|
|
781
|
+
collectedAttestationsCount = err.collectedCount;
|
|
764
782
|
}
|
|
765
783
|
throw err;
|
|
766
784
|
} finally {
|
|
767
|
-
this.metrics.recordCollectedAttestations(
|
|
785
|
+
this.metrics.recordCollectedAttestations(collectedAttestationsCount, timer.ms());
|
|
768
786
|
}
|
|
769
787
|
}
|
|
770
788
|
|
|
@@ -777,8 +795,8 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
777
795
|
}))
|
|
778
796
|
protected async enqueuePublishL2Block(
|
|
779
797
|
block: L2Block,
|
|
780
|
-
|
|
781
|
-
|
|
798
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
799
|
+
attestationsAndSignersSignature: Signature,
|
|
782
800
|
invalidateBlock: InvalidateBlockRequest | undefined,
|
|
783
801
|
publisher: SequencerPublisher,
|
|
784
802
|
): Promise<void> {
|
|
@@ -789,10 +807,15 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
789
807
|
const slot = block.header.globalVariables.slotNumber.toNumber();
|
|
790
808
|
const txTimeoutAt = new Date((this.getSlotStartBuildTimestamp(slot) + this.aztecSlotDuration) * 1000);
|
|
791
809
|
|
|
792
|
-
const enqueued = await publisher.enqueueProposeL2Block(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
810
|
+
const enqueued = await publisher.enqueueProposeL2Block(
|
|
811
|
+
block,
|
|
812
|
+
attestationsAndSigners,
|
|
813
|
+
attestationsAndSignersSignature,
|
|
814
|
+
{
|
|
815
|
+
txTimeoutAt,
|
|
816
|
+
forcePendingBlockNumber: invalidateBlock?.forcePendingBlockNumber,
|
|
817
|
+
},
|
|
818
|
+
);
|
|
796
819
|
|
|
797
820
|
if (!enqueued) {
|
|
798
821
|
throw new Error(`Failed to enqueue publish of block ${block.number}`);
|