@aztec/sequencer-client 0.0.1-commit.f295ac2 → 0.0.1-commit.f8ca9b2f3
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.js +1 -1
- package/dest/config.d.ts +1 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +5 -11
- package/dest/global_variable_builder/global_builder.js +2 -2
- package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +12 -4
- package/dest/publisher/sequencer-publisher.d.ts +1 -2
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +39 -18
- package/dest/sequencer/checkpoint_proposal_job.d.ts +32 -9
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +87 -51
- package/dest/sequencer/metrics.d.ts +2 -2
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +27 -17
- package/dest/sequencer/sequencer.d.ts +5 -3
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +8 -3
- package/dest/sequencer/timetable.d.ts +1 -4
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +1 -4
- package/dest/test/mock_checkpoint_builder.d.ts +11 -8
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +18 -6
- package/dest/test/utils.d.ts +8 -8
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +5 -5
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +1 -1
- package/src/config.ts +10 -14
- package/src/global_variable_builder/global_builder.ts +2 -2
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/publisher/sequencer-publisher.ts +34 -18
- package/src/sequencer/checkpoint_proposal_job.ts +118 -77
- package/src/sequencer/metrics.ts +36 -18
- package/src/sequencer/sequencer.ts +12 -5
- package/src/sequencer/timetable.ts +6 -5
- package/src/test/mock_checkpoint_builder.ts +32 -18
- package/src/test/utils.ts +17 -11
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import {
|
|
3
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
4
4
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FullNodeBlockBuilderConfig, ICheckpointBlockBuilder, ICheckpointsBuilder, MerkleTreeWriteOperations, PublicProcessorLimits } from '@aztec/stdlib/interfaces/server';
|
|
6
6
|
import type { CheckpointGlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import type { BuildBlockInCheckpointResult } from '@aztec/validator-client';
|
|
7
8
|
/**
|
|
8
9
|
* A fake CheckpointBuilder for testing that implements the same interface as the real one.
|
|
9
10
|
* Can be seeded with blocks to return sequentially on each `buildBlock` call.
|
|
@@ -23,20 +24,22 @@ export declare class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
23
24
|
timestamp: bigint;
|
|
24
25
|
opts: PublicProcessorLimits;
|
|
25
26
|
}>;
|
|
27
|
+
/** Track all consumed transaction hashes across buildBlock calls */
|
|
28
|
+
consumedTxHashes: Set<string>;
|
|
26
29
|
completeCheckpointCalled: boolean;
|
|
27
30
|
getCheckpointCalled: boolean;
|
|
28
31
|
/** Set to an error to make buildBlock throw on next call */
|
|
29
32
|
errorOnBuild: Error | undefined;
|
|
30
33
|
constructor(constants: CheckpointGlobalVariables, checkpointNumber: CheckpointNumber);
|
|
31
34
|
/** Seed the builder with blocks to return on successive buildBlock calls */
|
|
32
|
-
seedBlocks(blocks:
|
|
35
|
+
seedBlocks(blocks: L2Block[], usedTxsPerBlock?: Tx[][]): this;
|
|
33
36
|
/**
|
|
34
37
|
* Set a function that provides blocks dynamically.
|
|
35
38
|
* Useful for tests where the block is determined at call time (e.g., sequencer tests).
|
|
36
39
|
*/
|
|
37
|
-
setBlockProvider(provider: () =>
|
|
40
|
+
setBlockProvider(provider: () => L2Block): this;
|
|
38
41
|
getConstantData(): CheckpointGlobalVariables;
|
|
39
|
-
buildBlock(
|
|
42
|
+
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: PublicProcessorLimits): Promise<BuildBlockInCheckpointResult>;
|
|
40
43
|
completeCheckpoint(): Promise<Checkpoint>;
|
|
41
44
|
getCheckpoint(): Promise<Checkpoint>;
|
|
42
45
|
/**
|
|
@@ -66,7 +69,7 @@ export declare class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
66
69
|
constants: CheckpointGlobalVariables;
|
|
67
70
|
l1ToL2Messages: Fr[];
|
|
68
71
|
previousCheckpointOutHashes: Fr[];
|
|
69
|
-
existingBlocks:
|
|
72
|
+
existingBlocks: L2Block[];
|
|
70
73
|
}>;
|
|
71
74
|
updateConfigCalls: Array<Partial<FullNodeBlockBuilderConfig>>;
|
|
72
75
|
/**
|
|
@@ -84,9 +87,9 @@ export declare class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
84
87
|
getConfig(): FullNodeBlockBuilderConfig;
|
|
85
88
|
updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
|
|
86
89
|
startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], _fork: MerkleTreeWriteOperations): Promise<ICheckpointBlockBuilder>;
|
|
87
|
-
openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], _fork: MerkleTreeWriteOperations, existingBlocks?:
|
|
90
|
+
openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], _fork: MerkleTreeWriteOperations, existingBlocks?: L2Block[]): Promise<ICheckpointBlockBuilder>;
|
|
88
91
|
getFork(_blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
89
92
|
/** Reset for reuse in another test */
|
|
90
93
|
reset(): void;
|
|
91
94
|
}
|
|
92
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
95
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19jaGVja3BvaW50X2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L21vY2tfY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDOUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXRELE9BQU8sS0FBSyxFQUNWLDBCQUEwQixFQUMxQix1QkFBdUIsRUFDdkIsbUJBQW1CLEVBQ25CLHlCQUF5QixFQUN6QixxQkFBcUIsRUFDdEIsTUFBTSxpQ0FBaUMsQ0FBQztBQUd6QyxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxFQUFFLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSw0QkFBNEIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRTVFOzs7R0FHRztBQUNILHFCQUFhLHFCQUF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LQUFLLElBQUksSUFBSSxDQUtaO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/test/mock_checkpoint_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"mock_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/test/mock_checkpoint_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,uBAAuB;IAwBjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAxBnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,UAAU,CAAK;IAEvB,qFAAqF;IACrF,OAAO,CAAC,aAAa,CAA0C;IAE/D,iCAAiC;IAC1B,eAAe,EAAE,KAAK,CAAC;QAC5B,WAAW,EAAE,W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
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
3
2
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
4
3
|
import { Gas } from '@aztec/stdlib/gas';
|
|
5
4
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
@@ -16,6 +15,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
16
15
|
blockIndex;
|
|
17
16
|
/** Optional function to dynamically provide the block (alternative to seedBlocks) */ blockProvider;
|
|
18
17
|
/** Track calls for assertions */ buildBlockCalls;
|
|
18
|
+
/** Track all consumed transaction hashes across buildBlock calls */ consumedTxHashes;
|
|
19
19
|
completeCheckpointCalled;
|
|
20
20
|
getCheckpointCalled;
|
|
21
21
|
/** Set to an error to make buildBlock throw on next call */ errorOnBuild;
|
|
@@ -28,6 +28,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
28
28
|
this.blockIndex = 0;
|
|
29
29
|
this.blockProvider = undefined;
|
|
30
30
|
this.buildBlockCalls = [];
|
|
31
|
+
this.consumedTxHashes = new Set();
|
|
31
32
|
this.completeCheckpointCalled = false;
|
|
32
33
|
this.getCheckpointCalled = false;
|
|
33
34
|
this.errorOnBuild = undefined;
|
|
@@ -50,14 +51,14 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
50
51
|
getConstantData() {
|
|
51
52
|
return this.constants;
|
|
52
53
|
}
|
|
53
|
-
buildBlock(
|
|
54
|
+
async buildBlock(pendingTxs, blockNumber, timestamp, opts) {
|
|
54
55
|
this.buildBlockCalls.push({
|
|
55
56
|
blockNumber,
|
|
56
57
|
timestamp,
|
|
57
58
|
opts
|
|
58
59
|
});
|
|
59
60
|
if (this.errorOnBuild) {
|
|
60
|
-
|
|
61
|
+
throw this.errorOnBuild;
|
|
61
62
|
}
|
|
62
63
|
let block;
|
|
63
64
|
let usedTxs;
|
|
@@ -73,16 +74,26 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
73
74
|
this.blockIndex++;
|
|
74
75
|
this.builtBlocks.push(block);
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
// Check that no pending tx has already been consumed
|
|
78
|
+
for await (const tx of pendingTxs){
|
|
79
|
+
const hash = tx.getTxHash().toString();
|
|
80
|
+
if (this.consumedTxHashes.has(hash)) {
|
|
81
|
+
throw new Error(`Transaction ${hash} was already consumed in a previous block`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Add used txs to consumed set
|
|
85
|
+
for (const tx of usedTxs){
|
|
86
|
+
this.consumedTxHashes.add(tx.getTxHash().toString());
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
77
89
|
block,
|
|
78
90
|
publicGas: Gas.empty(),
|
|
79
91
|
publicProcessorDuration: 0,
|
|
80
92
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
81
|
-
blockBuildingTimer: new Timer(),
|
|
82
93
|
usedTxs,
|
|
83
94
|
failedTxs: [],
|
|
84
95
|
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx)=>sum + tx.getNumBlobFields(), 0) ?? 0
|
|
85
|
-
}
|
|
96
|
+
};
|
|
86
97
|
}
|
|
87
98
|
completeCheckpoint() {
|
|
88
99
|
this.completeCheckpointCalled = true;
|
|
@@ -126,6 +137,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
126
137
|
this.usedTxsPerBlock = [];
|
|
127
138
|
this.blockIndex = 0;
|
|
128
139
|
this.buildBlockCalls = [];
|
|
140
|
+
this.consumedTxHashes.clear();
|
|
129
141
|
this.completeCheckpointCalled = false;
|
|
130
142
|
this.getCheckpointCalled = false;
|
|
131
143
|
this.errorOnBuild = undefined;
|
package/dest/test/utils.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
5
|
import type { P2P } from '@aztec/p2p';
|
|
6
|
-
import { CommitteeAttestation,
|
|
6
|
+
import { CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
7
7
|
import { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
8
8
|
import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
9
9
|
import type { MockProxy } from 'jest-mock-extended';
|
|
@@ -13,9 +13,9 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function makeTx(seed?: number, chainId?: Fr): Promise<Tx>;
|
|
15
15
|
/**
|
|
16
|
-
* Creates an
|
|
16
|
+
* Creates an L2Block from transactions and global variables
|
|
17
17
|
*/
|
|
18
|
-
export declare function makeBlock(txs: Tx[], globalVariables: GlobalVariables): Promise<
|
|
18
|
+
export declare function makeBlock(txs: Tx[], globalVariables: GlobalVariables): Promise<L2Block>;
|
|
19
19
|
/**
|
|
20
20
|
* Mocks the P2P client to return specific pending transactions
|
|
21
21
|
*/
|
|
@@ -31,23 +31,23 @@ export declare function createMockSignatures(signer: Secp256k1Signer): Committee
|
|
|
31
31
|
/**
|
|
32
32
|
* Creates a block proposal from a block and signature
|
|
33
33
|
*/
|
|
34
|
-
export declare function createBlockProposal(block:
|
|
34
|
+
export declare function createBlockProposal(block: L2Block, signature: Signature): BlockProposal;
|
|
35
35
|
/**
|
|
36
36
|
* Creates a checkpoint proposal from a block and signature
|
|
37
37
|
*/
|
|
38
|
-
export declare function createCheckpointProposal(block:
|
|
38
|
+
export declare function createCheckpointProposal(block: L2Block, checkpointSignature: Signature, blockSignature?: Signature): CheckpointProposal;
|
|
39
39
|
/**
|
|
40
40
|
* Creates a checkpoint attestation from a block and signature.
|
|
41
41
|
* Note: We manually set the sender since we use random signatures in tests.
|
|
42
42
|
* In production, the sender is recovered from the signature.
|
|
43
43
|
*/
|
|
44
|
-
export declare function createCheckpointAttestation(block:
|
|
44
|
+
export declare function createCheckpointAttestation(block: L2Block, signature: Signature, sender: EthAddress): CheckpointAttestation;
|
|
45
45
|
/**
|
|
46
46
|
* Creates transactions and a block, and mocks P2P to return them.
|
|
47
47
|
* Helper for tests that need to set up a block with transactions.
|
|
48
48
|
*/
|
|
49
49
|
export declare function setupTxsAndBlock(p2p: MockProxy<P2P>, globalVariables: GlobalVariables, txCount: number, chainId: Fr): Promise<{
|
|
50
50
|
txs: Tx[];
|
|
51
|
-
block:
|
|
51
|
+
block: L2Block;
|
|
52
52
|
}>;
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0QyxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDcEUsT0FBTyxFQUFFLGFBQWEsRUFBRSxxQkFBcUIsRUFBRSxrQkFBa0IsRUFBb0IsTUFBTSxtQkFBbUIsQ0FBQztBQUcvRyxPQUFP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T0FBTyxFQUNkLG1CQUFtQixFQUFFLFNBQVMsRUFDOUIsY0FBYyxDQUFDLEVBQUUsU0FBUyxHQUN6QixrQkFBa0IsQ0FTcEI7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQWdCLDJCQUEyQixDQUN6QyxLQUFLLEVBQUUsT0FBTyxFQUNkLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxVQUFVLEdBQ2pCLHFCQUFxQixDQU92QjtBQUVEOzs7R0FHRztBQUNILHdCQUFzQixnQkFBZ0IsQ0FDcEMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxHQUFHLENBQUMsRUFDbkIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsT0FBTyxFQUFFLE1BQU0sRUFDZixPQUFPLEVBQUUsRUFBRSxHQUNWLE9BQU8sQ0FBQztJQUFFLEdBQUcsRUFBRSxFQUFFLEVBQUUsQ0FBQztJQUFDLEtBQUssRUFBRSxPQUFPLENBQUE7Q0FBRSxDQUFDLENBS3hDIn0=
|
package/dest/test/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,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BAAwB,CACtC,KAAK,EAAE,OAAO,EACd,mBAAmB,EAAE,SAAS,EAC9B,cAAc,CAAC,EAAE,SAAS,GACzB,kBAAkB,CASpB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,GACjB,qBAAqB,CAOvB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EACnB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,EAAE,GACV,OAAO,CAAC;IAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAKxC"}
|
package/dest/test/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ import { times } from '@aztec/foundation/collection';
|
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
6
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
7
|
-
import { CommitteeAttestation,
|
|
7
|
+
import { CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
8
8
|
import { BlockProposal, CheckpointAttestation, CheckpointProposal, ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
9
9
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
10
10
|
import { makeAppendOnlyTreeSnapshot, mockTxForRollup } from '@aztec/stdlib/testing';
|
|
@@ -21,7 +21,7 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
21
21
|
return tx;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Creates an
|
|
24
|
+
* Creates an L2Block from transactions and global variables
|
|
25
25
|
*/ export async function makeBlock(txs, globalVariables) {
|
|
26
26
|
const processedTxs = await Promise.all(txs.map((tx)=>makeProcessedTxFromPrivateOnlyTx(tx, Fr.ZERO, new PublicDataWrite(Fr.random(), Fr.random()), globalVariables)));
|
|
27
27
|
const body = new Body(processedTxs.map((tx)=>tx.txEffect));
|
|
@@ -29,7 +29,7 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
29
29
|
globalVariables
|
|
30
30
|
});
|
|
31
31
|
const archive = makeAppendOnlyTreeSnapshot(globalVariables.blockNumber + 1);
|
|
32
|
-
return new
|
|
32
|
+
return new L2Block(archive, header, body, CheckpointNumber.fromBlockNumber(globalVariables.blockNumber), IndexWithinCheckpoint(0));
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Mocks the P2P client to return specific pending transactions
|
|
@@ -53,8 +53,8 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
53
53
|
];
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Creates a CheckpointHeader from an
|
|
57
|
-
* Uses mock values for blockHeadersHash, blobsHash and inHash since
|
|
56
|
+
* Creates a CheckpointHeader from an L2Block for testing purposes.
|
|
57
|
+
* Uses mock values for blockHeadersHash, blobsHash and inHash since L2Block doesn't have these fields.
|
|
58
58
|
*/ function createCheckpointHeaderFromBlock(block) {
|
|
59
59
|
const gv = block.header.globalVariables;
|
|
60
60
|
return new CheckpointHeader(block.header.lastArchive.root, Fr.random(), Fr.random(), Fr.random(), Fr.random(), gv.slotNumber, gv.timestamp, gv.coinbase, gv.feeRecipient, gv.gasFees, block.header.totalManaUsed);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f8ca9b2f3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,38 +26,38 @@
|
|
|
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.0.1-commit.
|
|
30
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
31
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
32
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
33
|
-
"@aztec/constants": "0.0.1-commit.
|
|
34
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
35
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
36
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
37
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
38
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
39
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
40
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
41
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
43
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
44
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
45
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
46
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
47
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
48
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
49
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
50
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
51
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
52
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
53
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
29
|
+
"@aztec/aztec.js": "0.0.1-commit.f8ca9b2f3",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.f8ca9b2f3",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.f8ca9b2f3",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.f8ca9b2f3",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.f8ca9b2f3",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.f8ca9b2f3",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.f8ca9b2f3",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.f8ca9b2f3",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f8ca9b2f3",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.f8ca9b2f3",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.f8ca9b2f3",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.f8ca9b2f3",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f8ca9b2f3",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f8ca9b2f3",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.f8ca9b2f3",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.f8ca9b2f3",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f8ca9b2f3",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.f8ca9b2f3",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.f8ca9b2f3",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.f8ca9b2f3",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.f8ca9b2f3",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.f8ca9b2f3",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.f8ca9b2f3",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.f8ca9b2f3",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.f8ca9b2f3",
|
|
54
54
|
"lodash.chunk": "^4.2.0",
|
|
55
55
|
"tslib": "^2.4.0",
|
|
56
56
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
60
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.f8ca9b2f3",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.f8ca9b2f3",
|
|
61
61
|
"@electric-sql/pglite": "^0.3.14",
|
|
62
62
|
"@jest/globals": "^30.0.0",
|
|
63
63
|
"@types/jest": "^30.0.0",
|
|
@@ -85,7 +85,7 @@ export class SequencerClient {
|
|
|
85
85
|
publicClient,
|
|
86
86
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
87
87
|
);
|
|
88
|
-
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
88
|
+
const publisherManager = new PublisherManager(l1TxUtils, config, log.getBindings());
|
|
89
89
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
90
90
|
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
91
91
|
rollupContract.getL1GenesisTime(),
|
package/src/config.ts
CHANGED
|
@@ -11,8 +11,14 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
11
11
|
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
|
|
12
12
|
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
13
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type ChainConfig,
|
|
16
|
+
type SequencerConfig,
|
|
17
|
+
chainConfigMappings,
|
|
18
|
+
sharedSequencerConfigMappings,
|
|
19
|
+
} from '@aztec/stdlib/config';
|
|
15
20
|
import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
21
|
+
import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
|
|
16
22
|
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
17
23
|
|
|
18
24
|
import {
|
|
@@ -25,8 +31,6 @@ import {
|
|
|
25
31
|
export * from './publisher/config.js';
|
|
26
32
|
export type { SequencerConfig };
|
|
27
33
|
|
|
28
|
-
export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
|
|
29
|
-
|
|
30
34
|
/**
|
|
31
35
|
* Default values for SequencerConfig.
|
|
32
36
|
* Centralized location for all sequencer configuration defaults.
|
|
@@ -41,7 +45,7 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
41
45
|
maxDABlockGas: 10e9,
|
|
42
46
|
maxBlockSizeInBytes: 1024 * 1024,
|
|
43
47
|
enforceTimeTable: true,
|
|
44
|
-
attestationPropagationTime:
|
|
48
|
+
attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
|
|
45
49
|
secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
|
|
46
50
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
|
|
47
51
|
skipCollectingAttestations: false,
|
|
@@ -50,8 +54,7 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
50
54
|
injectFakeAttestation: false,
|
|
51
55
|
fishermanMode: false,
|
|
52
56
|
shuffleAttestationOrdering: false,
|
|
53
|
-
|
|
54
|
-
skipPushProposedBlocksToArchiver: true,
|
|
57
|
+
skipPushProposedBlocksToArchiver: false,
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
/**
|
|
@@ -192,19 +195,12 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
192
195
|
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
193
196
|
...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
|
|
194
197
|
},
|
|
195
|
-
|
|
196
|
-
env: 'SEQ_BLOCK_DURATION_MS',
|
|
197
|
-
description:
|
|
198
|
-
'Duration per block in milliseconds when building multiple blocks per slot. ' +
|
|
199
|
-
'If undefined (default), builds a single block per slot using the full slot duration.',
|
|
200
|
-
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
201
|
-
},
|
|
198
|
+
...sharedSequencerConfigMappings,
|
|
202
199
|
buildCheckpointIfEmpty: {
|
|
203
200
|
env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
|
|
204
201
|
description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
|
|
205
202
|
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
206
203
|
},
|
|
207
|
-
// TODO(palla/mbps): Change default to false once block sync is stable
|
|
208
204
|
skipPushProposedBlocksToArchiver: {
|
|
209
205
|
description: 'Skip pushing proposed blocks to archiver (default: true)',
|
|
210
206
|
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
@@ -69,9 +69,9 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
69
69
|
// we need to fetch the last block written, and estimate the earliest timestamp for the next block.
|
|
70
70
|
// The timestamp of that last block will act as a lower bound for the next block.
|
|
71
71
|
|
|
72
|
-
const
|
|
72
|
+
const lastCheckpoint = await this.rollupContract.getPendingCheckpoint();
|
|
73
73
|
const earliestTimestamp = await this.rollupContract.getTimestampForSlot(
|
|
74
|
-
SlotNumber.fromBigInt(BigInt(
|
|
74
|
+
SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n),
|
|
75
75
|
);
|
|
76
76
|
const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
|
|
77
77
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Metrics,
|
|
8
8
|
type TelemetryClient,
|
|
9
9
|
type UpDownCounter,
|
|
10
|
+
createUpDownCounterWithDefault,
|
|
10
11
|
} from '@aztec/telemetry-client';
|
|
11
12
|
|
|
12
13
|
import { formatEther } from 'viem/utils';
|
|
@@ -41,7 +42,10 @@ export class SequencerPublisherMetrics {
|
|
|
41
42
|
|
|
42
43
|
this.gasPrice = meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE);
|
|
43
44
|
|
|
44
|
-
this.txCount = meter
|
|
45
|
+
this.txCount = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
46
|
+
[Attributes.L1_TX_TYPE]: ['process'],
|
|
47
|
+
[Attributes.OK]: [true, false],
|
|
48
|
+
});
|
|
45
49
|
|
|
46
50
|
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION);
|
|
47
51
|
|
|
@@ -59,9 +63,9 @@ export class SequencerPublisherMetrics {
|
|
|
59
63
|
|
|
60
64
|
this.blobInclusionBlocksHistogram = meter.createHistogram(Metrics.L1_PUBLISHER_BLOB_INCLUSION_BLOCKS);
|
|
61
65
|
|
|
62
|
-
this.blobTxSuccessCounter = meter
|
|
66
|
+
this.blobTxSuccessCounter = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_BLOB_TX_SUCCESS);
|
|
63
67
|
|
|
64
|
-
this.blobTxFailureCounter = meter
|
|
68
|
+
this.blobTxFailureCounter = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_BLOB_TX_FAILURE);
|
|
65
69
|
|
|
66
70
|
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE);
|
|
67
71
|
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
type L1BlobInputs,
|
|
19
19
|
type L1TxConfig,
|
|
20
20
|
type L1TxRequest,
|
|
21
|
+
MAX_L1_TX_LIMIT,
|
|
21
22
|
type TransactionStats,
|
|
22
23
|
WEI_CONST,
|
|
23
24
|
} from '@aztec/ethereum/l1-tx-utils';
|
|
24
25
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
25
|
-
import { FormattedViemError, formatViemError, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
26
|
+
import { FormattedViemError, formatViemError, mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
26
27
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
27
28
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
28
29
|
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
@@ -122,11 +123,6 @@ export class SequencerPublisher {
|
|
|
122
123
|
|
|
123
124
|
/** L1 fee analyzer for fisherman mode */
|
|
124
125
|
private l1FeeAnalyzer?: L1FeeAnalyzer;
|
|
125
|
-
// @note - with blobs, the below estimate seems too large.
|
|
126
|
-
// Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
|
|
127
|
-
// Total used for emptier block from above test: 429k (of which 84k is 1x blob)
|
|
128
|
-
public static PROPOSE_GAS_GUESS: bigint = 12_000_000n;
|
|
129
|
-
|
|
130
126
|
// A CALL to a cold address is 2700 gas
|
|
131
127
|
public static MULTICALL_OVERHEAD_GAS_GUESS = 5000n;
|
|
132
128
|
|
|
@@ -273,7 +269,7 @@ export class SequencerPublisher {
|
|
|
273
269
|
// Start the analysis
|
|
274
270
|
const analysisId = await this.l1FeeAnalyzer.startAnalysis(
|
|
275
271
|
l2SlotNumber,
|
|
276
|
-
gasLimit > 0n ? gasLimit :
|
|
272
|
+
gasLimit > 0n ? gasLimit : MAX_L1_TX_LIMIT,
|
|
277
273
|
l1Requests,
|
|
278
274
|
blobConfig,
|
|
279
275
|
onComplete,
|
|
@@ -346,7 +342,16 @@ export class SequencerPublisher {
|
|
|
346
342
|
|
|
347
343
|
// Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
|
|
348
344
|
const gasLimits = gasConfigs.map(g => g?.gasLimit).filter((g): g is bigint => g !== undefined);
|
|
349
|
-
|
|
345
|
+
let gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
346
|
+
// Cap at L1 block gas limit so the node accepts the tx ("gas limit too high" otherwise).
|
|
347
|
+
const maxGas = MAX_L1_TX_LIMIT;
|
|
348
|
+
if (gasLimit !== undefined && gasLimit > maxGas) {
|
|
349
|
+
this.log.debug('Capping bundled tx gas limit to L1 max', {
|
|
350
|
+
requested: gasLimit,
|
|
351
|
+
capped: maxGas,
|
|
352
|
+
});
|
|
353
|
+
gasLimit = maxGas;
|
|
354
|
+
}
|
|
350
355
|
const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
|
|
351
356
|
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined; // earliest
|
|
352
357
|
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
@@ -517,7 +522,12 @@ export class SequencerPublisher {
|
|
|
517
522
|
this.log.debug(`Simulating invalidate checkpoint ${checkpointNumber}`, { ...logData, request });
|
|
518
523
|
|
|
519
524
|
try {
|
|
520
|
-
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
525
|
+
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
526
|
+
request,
|
|
527
|
+
undefined,
|
|
528
|
+
undefined,
|
|
529
|
+
mergeAbis([request.abi ?? [], ErrorsAbi]),
|
|
530
|
+
);
|
|
521
531
|
this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} succeeded`, {
|
|
522
532
|
...logData,
|
|
523
533
|
request,
|
|
@@ -536,7 +546,7 @@ export class SequencerPublisher {
|
|
|
536
546
|
|
|
537
547
|
// If the error is due to the checkpoint not being in the pending chain, and it was indeed removed by someone else,
|
|
538
548
|
// we can safely ignore it and return undefined so we go ahead with checkpoint building.
|
|
539
|
-
if (viemError.message?.includes('
|
|
549
|
+
if (viemError.message?.includes('Rollup__CheckpointNotInPendingChain')) {
|
|
540
550
|
this.log.verbose(
|
|
541
551
|
`Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`,
|
|
542
552
|
{ ...logData, request, error: viemError.message },
|
|
@@ -700,7 +710,7 @@ export class SequencerPublisher {
|
|
|
700
710
|
});
|
|
701
711
|
|
|
702
712
|
try {
|
|
703
|
-
await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi);
|
|
713
|
+
await this.l1TxUtils.simulate(request, { time: timestamp }, [], mergeAbis([request.abi ?? [], ErrorsAbi]));
|
|
704
714
|
this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, { request });
|
|
705
715
|
} catch (err) {
|
|
706
716
|
this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, err);
|
|
@@ -999,12 +1009,14 @@ export class SequencerPublisher {
|
|
|
999
1009
|
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
1000
1010
|
|
|
1001
1011
|
let gasUsed: bigint;
|
|
1012
|
+
const simulateAbi = mergeAbis([request.abi ?? [], ErrorsAbi]);
|
|
1002
1013
|
try {
|
|
1003
|
-
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [],
|
|
1014
|
+
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], simulateAbi)); // TODO(palla/slash): Check the timestamp logic
|
|
1004
1015
|
this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
|
|
1005
1016
|
} catch (err) {
|
|
1006
|
-
const viemError = formatViemError(err);
|
|
1017
|
+
const viemError = formatViemError(err, simulateAbi);
|
|
1007
1018
|
this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
|
|
1019
|
+
|
|
1008
1020
|
return false;
|
|
1009
1021
|
}
|
|
1010
1022
|
|
|
@@ -1012,10 +1024,14 @@ export class SequencerPublisher {
|
|
|
1012
1024
|
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(gasUsed) * 64) / 63)));
|
|
1013
1025
|
logData.gasLimit = gasLimit;
|
|
1014
1026
|
|
|
1027
|
+
// Store the ABI used for simulation on the request so Multicall3.forward can decode errors
|
|
1028
|
+
// when the tx is sent and a revert is diagnosed via simulation.
|
|
1029
|
+
const requestWithAbi = { ...request, abi: simulateAbi };
|
|
1030
|
+
|
|
1015
1031
|
this.log.debug(`Enqueuing ${action}`, logData);
|
|
1016
1032
|
this.addRequest({
|
|
1017
1033
|
action,
|
|
1018
|
-
request,
|
|
1034
|
+
request: requestWithAbi,
|
|
1019
1035
|
gasConfig: { gasLimit },
|
|
1020
1036
|
lastValidL2Slot: slotNumber,
|
|
1021
1037
|
checkSuccess: (_req, result) => {
|
|
@@ -1171,20 +1187,20 @@ export class SequencerPublisher {
|
|
|
1171
1187
|
{
|
|
1172
1188
|
to: this.rollupContract.address,
|
|
1173
1189
|
data: rollupData,
|
|
1174
|
-
gas:
|
|
1190
|
+
gas: MAX_L1_TX_LIMIT,
|
|
1175
1191
|
...(this.proposerAddressForSimulation && { from: this.proposerAddressForSimulation.toString() }),
|
|
1176
1192
|
},
|
|
1177
1193
|
{
|
|
1178
1194
|
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
1179
1195
|
time: timestamp + 1n,
|
|
1180
1196
|
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
1181
|
-
gasLimit:
|
|
1197
|
+
gasLimit: MAX_L1_TX_LIMIT * 2n,
|
|
1182
1198
|
},
|
|
1183
1199
|
stateOverrides,
|
|
1184
1200
|
RollupAbi,
|
|
1185
1201
|
{
|
|
1186
1202
|
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
1187
|
-
fallbackGasEstimate:
|
|
1203
|
+
fallbackGasEstimate: MAX_L1_TX_LIMIT,
|
|
1188
1204
|
},
|
|
1189
1205
|
)
|
|
1190
1206
|
.catch(err => {
|
|
@@ -1194,7 +1210,7 @@ export class SequencerPublisher {
|
|
|
1194
1210
|
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
1195
1211
|
// Return a minimal simulation result with the fallback gas estimate
|
|
1196
1212
|
return {
|
|
1197
|
-
gasUsed:
|
|
1213
|
+
gasUsed: MAX_L1_TX_LIMIT,
|
|
1198
1214
|
logs: [],
|
|
1199
1215
|
};
|
|
1200
1216
|
}
|