@aztec/sequencer-client 0.87.2 → 0.87.3-nightly.20250529
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 +3 -0
- package/dest/global_variable_builder/global_builder.d.ts +4 -1
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +14 -2
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/publisher/sequencer-publisher.d.ts +4 -4
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +14 -6
- package/dest/sequencer/sequencer.d.ts +5 -12
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +26 -34
- package/dest/sequencer/utils.d.ts +2 -2
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +6 -4
- package/package.json +26 -25
- package/src/client/sequencer-client.ts +5 -1
- package/src/global_variable_builder/global_builder.ts +16 -2
- package/src/index.ts +1 -2
- package/src/publisher/sequencer-publisher.ts +22 -13
- package/src/sequencer/sequencer.ts +32 -42
- package/src/sequencer/utils.ts +14 -6
- package/dest/slasher/factory.d.ts +0 -7
- package/dest/slasher/factory.d.ts.map +0 -1
- package/dest/slasher/factory.js +0 -8
- package/dest/slasher/index.d.ts +0 -3
- package/dest/slasher/index.d.ts.map +0 -1
- package/dest/slasher/index.js +0 -2
- package/dest/slasher/slasher_client.d.ts +0 -75
- package/dest/slasher/slasher_client.d.ts.map +0 -1
- package/dest/slasher/slasher_client.js +0 -135
- package/src/slasher/factory.ts +0 -15
- package/src/slasher/index.ts +0 -2
- package/src/slasher/slasher_client.ts +0 -199
|
@@ -4,6 +4,7 @@ import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
6
|
import type { P2P } from '@aztec/p2p';
|
|
7
|
+
import type { SlasherClient } from '@aztec/slasher';
|
|
7
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
9
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
10
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
@@ -14,7 +15,6 @@ import type { ValidatorClient } from '@aztec/validator-client';
|
|
|
14
15
|
import type { SequencerClientConfig } from '../config.js';
|
|
15
16
|
import { SequencerPublisher } from '../publisher/index.js';
|
|
16
17
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
17
|
-
import type { SlasherClient } from '../slasher/index.js';
|
|
18
18
|
/**
|
|
19
19
|
* Encapsulates the full sequencer and publisher.
|
|
20
20
|
*/
|
|
@@ -64,6 +64,7 @@ export declare class SequencerClient {
|
|
|
64
64
|
* Restarts the sequencer after being stopped.
|
|
65
65
|
*/
|
|
66
66
|
restart(): void;
|
|
67
|
+
getSequencer(): Sequencer;
|
|
67
68
|
get coinbase(): EthAddress;
|
|
68
69
|
get feeRecipient(): AztecAddress;
|
|
69
70
|
get forwarderAddress(): EthAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,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AS;IAIhC,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,gBAAgB,IAAI,UAAU,CAEjC;IAED,IAAI,gBAAgB,IAAI,UAAU,GAAG,SAAS,CAE7C;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
|
|
@@ -10,6 +10,8 @@ import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
12
12
|
private log;
|
|
13
|
+
private currentBaseFees;
|
|
14
|
+
private currentL1BlockNumber;
|
|
13
15
|
private readonly rollupContract;
|
|
14
16
|
private readonly publicClient;
|
|
15
17
|
private readonly ethereumSlotDuration;
|
|
@@ -18,8 +20,9 @@ export declare class GlobalVariableBuilder implements GlobalVariableBuilderInter
|
|
|
18
20
|
constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
|
|
19
21
|
/**
|
|
20
22
|
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
21
|
-
* @returns Base fees for the
|
|
23
|
+
* @returns Base fees for the next block
|
|
22
24
|
*/
|
|
25
|
+
private computeCurrentBaseFees;
|
|
23
26
|
getCurrentBaseFees(): Promise<GasFees>;
|
|
24
27
|
getGlobalConstantVariables(): Promise<Pick<GlobalVariables, 'chainId' | 'version'>>;
|
|
25
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EA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BpF;;;OAGG;YACW,sBAAsB;IAavB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAYtC,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAUhG;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC;CA6B5B"}
|
|
@@ -8,6 +8,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
8
8
|
* Simple global variables builder.
|
|
9
9
|
*/ export class GlobalVariableBuilder {
|
|
10
10
|
log = createLogger('sequencer:global_variable_builder');
|
|
11
|
+
currentBaseFees = Promise.resolve(new GasFees(Fr.ZERO, Fr.ZERO));
|
|
12
|
+
currentL1BlockNumber = undefined;
|
|
11
13
|
rollupContract;
|
|
12
14
|
publicClient;
|
|
13
15
|
ethereumSlotDuration;
|
|
@@ -26,8 +28,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
29
|
-
* @returns Base fees for the
|
|
30
|
-
*/ async
|
|
31
|
+
* @returns Base fees for the next block
|
|
32
|
+
*/ async computeCurrentBaseFees() {
|
|
31
33
|
// Since this might be called in the middle of a slot where a block might have been published,
|
|
32
34
|
// we need to fetch the last block written, and estimate the earliest timestamp for the next block.
|
|
33
35
|
// The timestamp of that last block will act as a lower bound for the next block.
|
|
@@ -37,6 +39,16 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
37
39
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
38
40
|
return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
|
|
39
41
|
}
|
|
42
|
+
async getCurrentBaseFees() {
|
|
43
|
+
// Get the current block number
|
|
44
|
+
const blockNumber = await this.publicClient.getBlockNumber();
|
|
45
|
+
// If the L1 block number has changed then chain a new promise to get the current base fees
|
|
46
|
+
if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
|
|
47
|
+
this.currentL1BlockNumber = blockNumber;
|
|
48
|
+
this.currentBaseFees = this.currentBaseFees.then(()=>this.computeCurrentBaseFees());
|
|
49
|
+
}
|
|
50
|
+
return this.currentBaseFees;
|
|
51
|
+
}
|
|
40
52
|
async getGlobalConstantVariables() {
|
|
41
53
|
if (!this.chainId) {
|
|
42
54
|
this.chainId = new Fr(this.publicClient.chain.id);
|
package/dest/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from './client/index.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './publisher/index.js';
|
|
4
|
-
export * from './tx_validator/tx_validator_factory.js';
|
|
5
|
-
export * from './slasher/index.js';
|
|
6
4
|
export { Sequencer, SequencerState } from './sequencer/index.js';
|
|
5
|
+
export * from './tx_validator/tx_validator_factory.js';
|
|
7
6
|
export * from './global_variable_builder/index.js';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,cAAc,wCAAwC,CAAC;AAIvD,cAAc,oCAAoC,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './client/index.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './publisher/index.js';
|
|
4
|
-
export * from './tx_validator/tx_validator_factory.js';
|
|
5
|
-
export * from './slasher/index.js';
|
|
6
4
|
export { Sequencer, SequencerState } from './sequencer/index.js';
|
|
5
|
+
export * from './tx_validator/tx_validator_factory.js';
|
|
7
6
|
// Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
|
|
8
7
|
// ISSUE(#9832)
|
|
9
8
|
export * from './global_variable_builder/index.js';
|
|
@@ -5,7 +5,7 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
5
5
|
import { type ForwarderContract, type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type SlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
6
6
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
7
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
|
-
import
|
|
8
|
+
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
9
9
|
import { type ProposedBlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
10
10
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
11
11
|
import { type TransactionReceipt } from 'viem';
|
|
@@ -32,7 +32,7 @@ interface RequestWithExpiry {
|
|
|
32
32
|
export declare class SequencerPublisher {
|
|
33
33
|
private interrupted;
|
|
34
34
|
private metrics;
|
|
35
|
-
|
|
35
|
+
epochCache: EpochCache;
|
|
36
36
|
private forwarderContract;
|
|
37
37
|
protected governanceLog: import("@aztec/foundation/log").Logger;
|
|
38
38
|
protected governanceProposerAddress?: EthAddress;
|
|
@@ -108,7 +108,7 @@ export declare class SequencerPublisher {
|
|
|
108
108
|
*/
|
|
109
109
|
validateBlockForSubmission(header: ProposedBlockHeader, attestationData?: {
|
|
110
110
|
digest: Buffer;
|
|
111
|
-
|
|
111
|
+
attestations: CommitteeAttestation[];
|
|
112
112
|
}): Promise<bigint>;
|
|
113
113
|
getCurrentEpochCommittee(): Promise<EthAddress[]>;
|
|
114
114
|
private enqueueCastVoteHelper;
|
|
@@ -127,7 +127,7 @@ export declare class SequencerPublisher {
|
|
|
127
127
|
* @param block - L2 block to propose.
|
|
128
128
|
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
129
129
|
*/
|
|
130
|
-
enqueueProposeL2Block(block: L2Block, attestations?:
|
|
130
|
+
enqueueProposeL2Block(block: L2Block, attestations?: CommitteeAttestation[], txHashes?: TxHash[], opts?: {
|
|
131
131
|
txTimeoutAt?: Date;
|
|
132
132
|
}): Promise<boolean>;
|
|
133
133
|
/**
|
|
@@ -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;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,0BAA0B,EAE/B,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"sequencer-publisher.d.ts","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C;IA+BnB;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;YAKA,gBAAgB;YAkGhB,YAAY;IAoE1B;;;;;;;OAOG;IACH,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlF"}
|
|
@@ -6,6 +6,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
7
|
import { Timer } from '@aztec/foundation/timer';
|
|
8
8
|
import { ForwarderAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
9
|
+
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
9
10
|
import { ConsensusPayload, SignatureDomainSeparator, getHashedSignaturePayload } from '@aztec/stdlib/p2p';
|
|
10
11
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
11
12
|
import pick from 'lodash.pick';
|
|
@@ -186,17 +187,24 @@ export class SequencerPublisher {
|
|
|
186
187
|
*
|
|
187
188
|
*/ async validateBlockForSubmission(header, attestationData = {
|
|
188
189
|
digest: Buffer.alloc(32),
|
|
189
|
-
|
|
190
|
+
attestations: []
|
|
190
191
|
}) {
|
|
191
192
|
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
192
|
-
|
|
193
|
+
// If we have no attestations, we still need to provide the empty attestations
|
|
194
|
+
// so that the committee is recalculated correctly
|
|
195
|
+
const ignoreSignatures = attestationData.attestations.length === 0;
|
|
196
|
+
if (ignoreSignatures) {
|
|
197
|
+
const committee = await this.epochCache.getCommittee(header.slotNumber.toBigInt());
|
|
198
|
+
attestationData.attestations = committee.committee.map((committeeMember)=>CommitteeAttestation.fromAddress(committeeMember));
|
|
199
|
+
}
|
|
200
|
+
const formattedAttestations = attestationData.attestations.map((attest)=>attest.toViem());
|
|
193
201
|
const flags = {
|
|
194
202
|
ignoreDA: true,
|
|
195
|
-
ignoreSignatures
|
|
203
|
+
ignoreSignatures
|
|
196
204
|
};
|
|
197
205
|
const args = [
|
|
198
206
|
toHex(header.toBuffer()),
|
|
199
|
-
|
|
207
|
+
formattedAttestations,
|
|
200
208
|
toHex(attestationData.digest),
|
|
201
209
|
ts,
|
|
202
210
|
toHex(header.contentCommitment.blobsHash),
|
|
@@ -304,7 +312,7 @@ export class SequencerPublisher {
|
|
|
304
312
|
// make time consistency checks break.
|
|
305
313
|
const ts = await this.validateBlockForSubmission(proposedBlockHeader, {
|
|
306
314
|
digest: digest.toBuffer(),
|
|
307
|
-
|
|
315
|
+
attestations: attestations ?? []
|
|
308
316
|
});
|
|
309
317
|
this.log.debug(`Submitting propose transaction`);
|
|
310
318
|
await this.addProposeTx(block, proposeTxArgs, opts, ts);
|
|
@@ -351,7 +359,7 @@ export class SequencerPublisher {
|
|
|
351
359
|
});
|
|
352
360
|
throw new Error('Failed to validate blobs');
|
|
353
361
|
});
|
|
354
|
-
const attestations = encodedData.attestations ? encodedData.attestations.map((attest)=>attest.
|
|
362
|
+
const attestations = encodedData.attestations ? encodedData.attestations.map((attest)=>attest.toViem()) : [];
|
|
355
363
|
const txHashes = encodedData.txHashes ? encodedData.txHashes.map((txHash)=>txHash.toString()) : [];
|
|
356
364
|
const args = [
|
|
357
365
|
{
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type L2Block } from '@aztec/aztec.js';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
4
|
import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
6
5
|
import type { P2P } from '@aztec/p2p';
|
|
7
6
|
import type { BlockBuilderFactory } from '@aztec/prover-client/block-builder';
|
|
8
7
|
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
8
|
+
import type { SlasherClient } from '@aztec/slasher';
|
|
9
9
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
10
|
+
import type { CommitteeAttestation, L2BlockSource } from '@aztec/stdlib/block';
|
|
11
11
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
12
12
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
13
13
|
import { Gas } from '@aztec/stdlib/gas';
|
|
@@ -18,7 +18,6 @@ import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
|
18
18
|
import type { ValidatorClient } from '@aztec/validator-client';
|
|
19
19
|
import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
|
|
20
20
|
import { type SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
21
|
-
import type { SlasherClient } from '../slasher/slasher_client.js';
|
|
22
21
|
import type { SequencerConfig } from './config.js';
|
|
23
22
|
import { SequencerTimetable } from './timetable.js';
|
|
24
23
|
import { SequencerState } from './utils.js';
|
|
@@ -108,13 +107,6 @@ export declare class Sequencer {
|
|
|
108
107
|
protected doRealWork(): Promise<void>;
|
|
109
108
|
protected work(): Promise<void>;
|
|
110
109
|
getForwarderAddress(): EthAddress;
|
|
111
|
-
/**
|
|
112
|
-
* Checks if we can propose at the next block and returns the slot number if we can.
|
|
113
|
-
* @param tipArchive - The archive of the previous block.
|
|
114
|
-
* @param proposalBlockNumber - The block number of the proposal.
|
|
115
|
-
* @returns The slot number if we can propose at the next block, otherwise undefined.
|
|
116
|
-
*/
|
|
117
|
-
slotForProposal(tipArchive: Buffer, proposalBlockNumber: bigint): Promise<bigint | undefined>;
|
|
118
110
|
/**
|
|
119
111
|
* Sets the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
120
112
|
* @param proposedState - The new state to transition to.
|
|
@@ -174,12 +166,12 @@ export declare class Sequencer {
|
|
|
174
166
|
* @param proposalHeader - The partial header constructed for the proposal
|
|
175
167
|
*/
|
|
176
168
|
private buildBlockAndEnqueuePublish;
|
|
177
|
-
protected collectAttestations(block: L2Block, txs: Tx[]): Promise<
|
|
169
|
+
protected collectAttestations(block: L2Block, txs: Tx[]): Promise<CommitteeAttestation[] | undefined>;
|
|
178
170
|
/**
|
|
179
171
|
* Publishes the L2Block to the rollup contract.
|
|
180
172
|
* @param block - The L2Block to be published.
|
|
181
173
|
*/
|
|
182
|
-
protected enqueuePublishL2Block(block: L2Block, attestations?:
|
|
174
|
+
protected enqueuePublishL2Block(block: L2Block, attestations?: CommitteeAttestation[], txHashes?: TxHash[]): Promise<void>;
|
|
183
175
|
/**
|
|
184
176
|
* Returns whether all dependencies have caught up.
|
|
185
177
|
* We don't check against the previous block submitted since it may have been reorg'd out.
|
|
@@ -195,5 +187,6 @@ export declare class Sequencer {
|
|
|
195
187
|
get coinbase(): EthAddress;
|
|
196
188
|
get feeRecipient(): AztecAddress;
|
|
197
189
|
get maxL2BlockGas(): number | undefined;
|
|
190
|
+
getSlasherClient(): SlasherClient;
|
|
198
191
|
}
|
|
199
192
|
//# sourceMappingURL=sequencer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,iBAAiB,CAAC;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,iBAAiB,CAAC;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAW,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE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AAC,EAAE,CAAC,EAC5C,IAAI,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO;;;;;;;;;;IAavC;;;;;;;;OAQG;YAIW,2BAA2B;cAkEzB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,GAAG,SAAS,CAAC;IAqD3G;;;OAGG;cAIa,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,oBAAoB,EAAE,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;OAIG;cACa,WAAW,IAAI,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IA+CxF,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAK1B,IAAI,iBAAiB,WAEpB;IAED,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEM,gBAAgB,IAAI,aAAa;CAGzC"}
|
|
@@ -6,6 +6,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
6
6
|
}
|
|
7
7
|
import { retryUntil } from '@aztec/aztec.js';
|
|
8
8
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
9
|
+
import { FormattedViemError } from '@aztec/ethereum';
|
|
9
10
|
import { omit } from '@aztec/foundation/collection';
|
|
10
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
12
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -182,7 +183,7 @@ export { SequencerState };
|
|
|
182
183
|
this.metrics.stop();
|
|
183
184
|
await this.validatorClient?.stop();
|
|
184
185
|
await this.runningPromise?.stop();
|
|
185
|
-
this.slasherClient.stop();
|
|
186
|
+
await this.slasherClient.stop();
|
|
186
187
|
this.publisher.interrupt();
|
|
187
188
|
this.setState(SequencerState.STOPPED, 0n, true);
|
|
188
189
|
this.l1Metrics.stop();
|
|
@@ -226,10 +227,16 @@ export { SequencerState };
|
|
|
226
227
|
const newBlockNumber = chainTip.blockNumber + 1;
|
|
227
228
|
// If we cannot find a tip archive, assume genesis.
|
|
228
229
|
const chainTipArchive = chainTip.archive;
|
|
229
|
-
const slot =
|
|
230
|
+
const { slot } = this.publisher.epochCache.getEpochAndSlotInNextSlot();
|
|
230
231
|
this.metrics.observeSlotChange(slot, this.publisher.getSenderAddress().toString());
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
const proposerInNextSlot = await this.publisher.epochCache.getProposerInNextSlot();
|
|
233
|
+
// If get proposer in next slot is undefined, then there is no proposer set, and it is in free for all (sandbox) so we continue
|
|
234
|
+
// If we calculate a proposer in the next slot, and it is not us, then stop
|
|
235
|
+
if (proposerInNextSlot !== undefined && !proposerInNextSlot.equals(this.validatorClient.getValidatorAddress())) {
|
|
236
|
+
this.log.debug(`Cannot propose block ${newBlockNumber}`, {
|
|
237
|
+
us: this.validatorClient.getValidatorAddress(),
|
|
238
|
+
proposer: proposerInNextSlot
|
|
239
|
+
});
|
|
233
240
|
return;
|
|
234
241
|
}
|
|
235
242
|
this.log.debug(`Can propose block ${newBlockNumber} at slot ${slot}`);
|
|
@@ -257,10 +264,15 @@ export { SequencerState };
|
|
|
257
264
|
// and also we may need to fetch more if we don't have enough valid txs.
|
|
258
265
|
const pendingTxs = this.p2pClient.iteratePendingTxs();
|
|
259
266
|
await this.buildBlockAndEnqueuePublish(pendingTxs, proposalHeader, newGlobalVariables).catch((err)=>{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
267
|
+
if (err instanceof FormattedViemError) {
|
|
268
|
+
this.log.verbose(`Unable to build/enqueue block ${err.message}`);
|
|
269
|
+
return;
|
|
270
|
+
} else {
|
|
271
|
+
this.log.error(`Error building/enqueuing block`, err, {
|
|
272
|
+
blockNumber: newBlockNumber,
|
|
273
|
+
slot
|
|
274
|
+
});
|
|
275
|
+
}
|
|
264
276
|
});
|
|
265
277
|
finishedFlushing = true;
|
|
266
278
|
} else {
|
|
@@ -312,24 +324,6 @@ export { SequencerState };
|
|
|
312
324
|
return this.publisher.getForwarderAddress();
|
|
313
325
|
}
|
|
314
326
|
/**
|
|
315
|
-
* Checks if we can propose at the next block and returns the slot number if we can.
|
|
316
|
-
* @param tipArchive - The archive of the previous block.
|
|
317
|
-
* @param proposalBlockNumber - The block number of the proposal.
|
|
318
|
-
* @returns The slot number if we can propose at the next block, otherwise undefined.
|
|
319
|
-
*/ async slotForProposal(tipArchive, proposalBlockNumber) {
|
|
320
|
-
const result = await this.publisher.canProposeAtNextEthBlock(tipArchive);
|
|
321
|
-
if (!result) {
|
|
322
|
-
return undefined;
|
|
323
|
-
}
|
|
324
|
-
const [slot, blockNumber] = result;
|
|
325
|
-
if (proposalBlockNumber !== blockNumber) {
|
|
326
|
-
const msg = `Sequencer block number mismatch. Expected ${proposalBlockNumber} but got ${blockNumber}.`;
|
|
327
|
-
this.log.warn(msg);
|
|
328
|
-
throw new Error(msg);
|
|
329
|
-
}
|
|
330
|
-
return slot;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
327
|
* Sets the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
334
328
|
* @param proposedState - The new state to transition to.
|
|
335
329
|
* @param currentSlotNumber - The current slot number.
|
|
@@ -368,16 +362,15 @@ export { SequencerState };
|
|
|
368
362
|
// Sync to the previous block at least. If we cannot sync to that block because the archiver hasn't caught up,
|
|
369
363
|
// we keep retrying until the reexecution deadline. Note that this could only happen when we are a validator,
|
|
370
364
|
// for if we are the proposer, then world-state should already be caught up, as we check this earlier.
|
|
371
|
-
await retryUntil(()
|
|
365
|
+
await retryUntil(()=>!opts.validateOnly || this.worldState.syncImmediate(blockNumber - 1, true).then((syncedTo)=>syncedTo >= blockNumber - 1), 'sync to previous block', this.timetable.getValidatorReexecTimeEnd(), 0.1);
|
|
372
366
|
this.log.debug(`Synced to previous block ${blockNumber - 1}`);
|
|
373
367
|
// NB: separating the dbs because both should update the state
|
|
374
368
|
const publicProcessorDBFork = await this.worldState.fork();
|
|
375
|
-
const
|
|
376
|
-
const previousBlockHeader = (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? orchestratorDBFork.getInitialHeader();
|
|
369
|
+
const previousBlockHeader = (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? publicProcessorDBFork.getInitialHeader();
|
|
377
370
|
try {
|
|
378
371
|
const processor = this.publicProcessorFactory.create(publicProcessorDBFork, newGlobalVariables, true);
|
|
379
372
|
const blockBuildingTimer = new Timer();
|
|
380
|
-
const blockBuilder = this.blockBuilderFactory.create(
|
|
373
|
+
const blockBuilder = this.blockBuilderFactory.create(publicProcessorDBFork);
|
|
381
374
|
await blockBuilder.startNewBlock(newGlobalVariables, l1ToL2Messages, previousBlockHeader);
|
|
382
375
|
// Deadline for processing depends on whether we're proposing a block
|
|
383
376
|
const secondsIntoSlot = this.getSecondsIntoSlot(slot);
|
|
@@ -391,9 +384,6 @@ export { SequencerState };
|
|
|
391
384
|
deadline
|
|
392
385
|
});
|
|
393
386
|
const validator = createValidatorForBlockBuilding(publicProcessorDBFork, this.contractDataSource, newGlobalVariables, this.txPublicSetupAllowList);
|
|
394
|
-
// TODO(#11000): Public processor should just handle processing, one tx at a time. It should be responsibility
|
|
395
|
-
// of the sequencer to update world state and iterate over txs. We should refactor this along with unifying the
|
|
396
|
-
// publicProcessorFork and orchestratorFork, to avoid doing tree insertions twice when building the block.
|
|
397
387
|
const proposerLimits = {
|
|
398
388
|
maxTransactions: this.maxTxsPerBlock,
|
|
399
389
|
maxBlockSize: this.maxBlockSizeInBytes,
|
|
@@ -449,7 +439,6 @@ export { SequencerState };
|
|
|
449
439
|
setTimeout(async ()=>{
|
|
450
440
|
try {
|
|
451
441
|
await publicProcessorDBFork.close();
|
|
452
|
-
await orchestratorDBFork.close();
|
|
453
442
|
} catch (err) {
|
|
454
443
|
// This can happen if the sequencer is stopped before we hit this timeout.
|
|
455
444
|
this.log.warn(`Error closing forks for block processing`, err);
|
|
@@ -643,6 +632,9 @@ export { SequencerState };
|
|
|
643
632
|
get maxL2BlockGas() {
|
|
644
633
|
return this.config.maxL2BlockGas;
|
|
645
634
|
}
|
|
635
|
+
getSlasherClient() {
|
|
636
|
+
return this.slasherClient;
|
|
637
|
+
}
|
|
646
638
|
}
|
|
647
639
|
_ts_decorate([
|
|
648
640
|
trackSpan('Sequencer.work')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import {
|
|
2
|
+
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
3
3
|
import type { BlockAttestation } from '@aztec/stdlib/p2p';
|
|
4
4
|
export declare enum SequencerState {
|
|
5
5
|
/**
|
|
@@ -44,5 +44,5 @@ export declare function sequencerStateToNumber(state: SequencerState): number;
|
|
|
44
44
|
*
|
|
45
45
|
* @todo: perform this logic within the memory attestation store instead?
|
|
46
46
|
*/
|
|
47
|
-
export declare function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]):
|
|
47
|
+
export declare function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]): CommitteeAttestation[];
|
|
48
48
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,oBAAY,cAAc;IACxB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,aAAa,kBAAkB;IAC/B;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,qBAAqB,0BAA0B;IAC/C;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,uBAAuB,4BAA4B;IACnD;;OAEG;IACH,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,gBAAgB,EAAE,EAChC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB"}
|
package/dest/sequencer/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
2
2
|
export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
3
3
|
/**
|
|
4
4
|
* Sequencer is stopped and not processing any txs from the pool.
|
|
@@ -40,12 +40,14 @@ export function sequencerStateToNumber(state) {
|
|
|
40
40
|
const attestationMap = new Map();
|
|
41
41
|
for (const attestation of attestations){
|
|
42
42
|
const sender = attestation.getSender();
|
|
43
|
-
|
|
43
|
+
if (sender) {
|
|
44
|
+
attestationMap.set(sender.toString(), CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature));
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
|
-
// Create the ordered array based on the orderAddresses, else return an empty
|
|
47
|
+
// Create the ordered array based on the orderAddresses, else return an empty attestation
|
|
46
48
|
const orderedAttestations = orderAddresses.map((address)=>{
|
|
47
49
|
const addressString = address.toString();
|
|
48
|
-
return attestationMap.get(addressString)
|
|
50
|
+
return attestationMap.get(addressString) || CommitteeAttestation.fromAddress(address);
|
|
49
51
|
});
|
|
50
52
|
return orderedAttestations;
|
|
51
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.3-nightly.20250529",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,36 +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": "0.87.
|
|
30
|
-
"@aztec/bb-prover": "0.87.
|
|
31
|
-
"@aztec/blob-lib": "0.87.
|
|
32
|
-
"@aztec/blob-sink": "0.87.
|
|
33
|
-
"@aztec/constants": "0.87.
|
|
34
|
-
"@aztec/epoch-cache": "0.87.
|
|
35
|
-
"@aztec/ethereum": "0.87.
|
|
36
|
-
"@aztec/foundation": "0.87.
|
|
37
|
-
"@aztec/l1-artifacts": "0.87.
|
|
38
|
-
"@aztec/merkle-tree": "0.87.
|
|
39
|
-
"@aztec/noir-acvm_js": "0.87.
|
|
40
|
-
"@aztec/noir-contracts.js": "0.87.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "0.87.
|
|
42
|
-
"@aztec/noir-types": "0.87.
|
|
43
|
-
"@aztec/p2p": "0.87.
|
|
44
|
-
"@aztec/protocol-contracts": "0.87.
|
|
45
|
-
"@aztec/prover-client": "0.87.
|
|
46
|
-
"@aztec/simulator": "0.87.
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
29
|
+
"@aztec/aztec.js": "0.87.3-nightly.20250529",
|
|
30
|
+
"@aztec/bb-prover": "0.87.3-nightly.20250529",
|
|
31
|
+
"@aztec/blob-lib": "0.87.3-nightly.20250529",
|
|
32
|
+
"@aztec/blob-sink": "0.87.3-nightly.20250529",
|
|
33
|
+
"@aztec/constants": "0.87.3-nightly.20250529",
|
|
34
|
+
"@aztec/epoch-cache": "0.87.3-nightly.20250529",
|
|
35
|
+
"@aztec/ethereum": "0.87.3-nightly.20250529",
|
|
36
|
+
"@aztec/foundation": "0.87.3-nightly.20250529",
|
|
37
|
+
"@aztec/l1-artifacts": "0.87.3-nightly.20250529",
|
|
38
|
+
"@aztec/merkle-tree": "0.87.3-nightly.20250529",
|
|
39
|
+
"@aztec/noir-acvm_js": "0.87.3-nightly.20250529",
|
|
40
|
+
"@aztec/noir-contracts.js": "0.87.3-nightly.20250529",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "0.87.3-nightly.20250529",
|
|
42
|
+
"@aztec/noir-types": "0.87.3-nightly.20250529",
|
|
43
|
+
"@aztec/p2p": "0.87.3-nightly.20250529",
|
|
44
|
+
"@aztec/protocol-contracts": "0.87.3-nightly.20250529",
|
|
45
|
+
"@aztec/prover-client": "0.87.3-nightly.20250529",
|
|
46
|
+
"@aztec/simulator": "0.87.3-nightly.20250529",
|
|
47
|
+
"@aztec/slasher": "0.87.3-nightly.20250529",
|
|
48
|
+
"@aztec/stdlib": "0.87.3-nightly.20250529",
|
|
49
|
+
"@aztec/telemetry-client": "0.87.3-nightly.20250529",
|
|
50
|
+
"@aztec/validator-client": "0.87.3-nightly.20250529",
|
|
51
|
+
"@aztec/world-state": "0.87.3-nightly.20250529",
|
|
51
52
|
"lodash.chunk": "^4.2.0",
|
|
52
53
|
"lodash.pick": "^4.4.0",
|
|
53
54
|
"tslib": "^2.4.0",
|
|
54
55
|
"viem": "2.23.7"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@aztec/archiver": "0.87.
|
|
58
|
-
"@aztec/kv-store": "0.87.
|
|
58
|
+
"@aztec/archiver": "0.87.3-nightly.20250529",
|
|
59
|
+
"@aztec/kv-store": "0.87.3-nightly.20250529",
|
|
59
60
|
"@jest/globals": "^29.5.0",
|
|
60
61
|
"@types/jest": "^29.5.0",
|
|
61
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -16,6 +16,7 @@ import type { DateProvider } from '@aztec/foundation/timer';
|
|
|
16
16
|
import type { P2P } from '@aztec/p2p';
|
|
17
17
|
import { LightweightBlockBuilderFactory } from '@aztec/prover-client/block-builder';
|
|
18
18
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
19
|
+
import type { SlasherClient } from '@aztec/slasher';
|
|
19
20
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
20
21
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
21
22
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
@@ -28,7 +29,6 @@ import type { SequencerClientConfig } from '../config.js';
|
|
|
28
29
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
29
30
|
import { SequencerPublisher } from '../publisher/index.js';
|
|
30
31
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
31
|
-
import type { SlasherClient } from '../slasher/index.js';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Encapsulates the full sequencer and publisher.
|
|
@@ -214,6 +214,10 @@ export class SequencerClient {
|
|
|
214
214
|
this.sequencer.restart();
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
public getSequencer(): Sequencer {
|
|
218
|
+
return this.sequencer;
|
|
219
|
+
}
|
|
220
|
+
|
|
217
221
|
get coinbase(): EthAddress {
|
|
218
222
|
return this.sequencer.coinbase;
|
|
219
223
|
}
|