@aztec/sequencer-client 0.0.1-commit.ee80a48 → 0.0.1-commit.ef17749e1
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 +23 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +99 -16
- package/dest/config.d.ts +24 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +40 -28
- package/dest/global_variable_builder/global_builder.d.ts +2 -4
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/publisher/config.d.ts +35 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +106 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -2
- package/dest/publisher/sequencer-publisher.d.ts +26 -7
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +299 -30
- package/dest/sequencer/checkpoint_proposal_job.d.ts +4 -4
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +104 -48
- package/dest/sequencer/metrics.d.ts +17 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +86 -15
- package/dest/sequencer/sequencer.d.ts +23 -12
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +25 -26
- package/dest/sequencer/timetable.d.ts +4 -6
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +7 -11
- package/dest/sequencer/types.d.ts +5 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +3 -5
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +8 -8
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +45 -34
- package/dest/test/utils.d.ts +3 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +5 -4
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +135 -18
- package/src/config.ts +54 -38
- package/src/global_variable_builder/global_builder.ts +1 -1
- package/src/publisher/config.ts +121 -43
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -6
- package/src/publisher/sequencer-publisher.ts +300 -43
- package/src/sequencer/checkpoint_proposal_job.ts +142 -54
- package/src/sequencer/metrics.ts +92 -18
- package/src/sequencer/sequencer.ts +33 -31
- package/src/sequencer/timetable.ts +13 -12
- package/src/sequencer/types.ts +4 -1
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +60 -46
- package/src/test/utils.ts +5 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { unfreeze } from '@aztec/foundation/types';
|
|
4
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
2
5
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
3
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
4
6
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
5
7
|
import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
6
8
|
/**
|
|
@@ -63,8 +65,10 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
63
65
|
let block;
|
|
64
66
|
let usedTxs;
|
|
65
67
|
if (this.blockProvider) {
|
|
66
|
-
// Dynamic mode: get block from provider
|
|
67
|
-
block = this.blockProvider();
|
|
68
|
+
// Dynamic mode: get block from provider, cloning to avoid shared references across multiple buildBlock calls
|
|
69
|
+
block = L2Block.fromBuffer(this.blockProvider().toBuffer());
|
|
70
|
+
block.header.globalVariables.blockNumber = blockNumber;
|
|
71
|
+
await block.header.recomputeHash();
|
|
68
72
|
usedTxs = [];
|
|
69
73
|
this.builtBlocks.push(block);
|
|
70
74
|
} else {
|
|
@@ -87,61 +91,63 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
87
91
|
}
|
|
88
92
|
return {
|
|
89
93
|
block,
|
|
90
|
-
publicGas: Gas.empty(),
|
|
91
94
|
publicProcessorDuration: 0,
|
|
92
95
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
93
96
|
usedTxs,
|
|
94
|
-
failedTxs: []
|
|
95
|
-
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx)=>sum + tx.getNumBlobFields(), 0) ?? 0
|
|
97
|
+
failedTxs: []
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
completeCheckpoint() {
|
|
99
101
|
this.completeCheckpointCalled = true;
|
|
100
102
|
const allBlocks = this.blockProvider ? this.builtBlocks : this.blocks;
|
|
101
|
-
|
|
102
|
-
// Create a CheckpointHeader from the last block's header for testing
|
|
103
|
-
const checkpointHeader = this.createCheckpointHeader(lastBlock);
|
|
104
|
-
return Promise.resolve(new Checkpoint(makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1), checkpointHeader, allBlocks, this.checkpointNumber));
|
|
103
|
+
return this.buildCheckpoint(allBlocks);
|
|
105
104
|
}
|
|
106
105
|
getCheckpoint() {
|
|
107
106
|
this.getCheckpointCalled = true;
|
|
108
107
|
const builtBlocks = this.blockProvider ? this.builtBlocks : this.blocks.slice(0, this.blockIndex);
|
|
109
|
-
|
|
110
|
-
if (!lastBlock) {
|
|
108
|
+
if (builtBlocks.length === 0) {
|
|
111
109
|
throw new Error('No blocks built yet');
|
|
112
110
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
return this.buildCheckpoint(builtBlocks);
|
|
112
|
+
}
|
|
113
|
+
/** Builds a structurally valid Checkpoint from a list of blocks, fixing up indexes and archive chaining. */ async buildCheckpoint(blocks) {
|
|
114
|
+
// Fix up indexWithinCheckpoint and archive chaining so the checkpoint passes structural validation.
|
|
115
|
+
for(let i = 0; i < blocks.length; i++){
|
|
116
|
+
blocks[i].indexWithinCheckpoint = IndexWithinCheckpoint(i);
|
|
117
|
+
if (i > 0) {
|
|
118
|
+
unfreeze(blocks[i].header).lastArchive = blocks[i - 1].archive;
|
|
119
|
+
await blocks[i].header.recomputeHash();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const firstBlock = blocks[0];
|
|
123
|
+
const lastBlock = blocks[blocks.length - 1];
|
|
124
|
+
const gv = firstBlock.header.globalVariables;
|
|
125
|
+
const checkpointHeader = CheckpointHeader.empty({
|
|
126
|
+
lastArchiveRoot: firstBlock.header.lastArchive.root,
|
|
125
127
|
blockHeadersHash: Fr.random(),
|
|
126
128
|
slotNumber: gv.slotNumber,
|
|
127
129
|
timestamp: gv.timestamp,
|
|
128
130
|
coinbase: gv.coinbase,
|
|
129
131
|
feeRecipient: gv.feeRecipient,
|
|
130
132
|
gasFees: gv.gasFees,
|
|
131
|
-
totalManaUsed: header.totalManaUsed
|
|
133
|
+
totalManaUsed: lastBlock.header.totalManaUsed
|
|
132
134
|
});
|
|
135
|
+
return new Checkpoint(makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1), checkpointHeader, blocks, this.checkpointNumber);
|
|
133
136
|
}
|
|
134
|
-
/**
|
|
135
|
-
this.blocks = [];
|
|
137
|
+
/** Resets per-checkpoint state (built blocks, consumed txs) while preserving config (blockProvider, seeded blocks). */ resetCheckpointState() {
|
|
136
138
|
this.builtBlocks = [];
|
|
137
|
-
this.usedTxsPerBlock = [];
|
|
138
139
|
this.blockIndex = 0;
|
|
139
|
-
this.buildBlockCalls = [];
|
|
140
140
|
this.consumedTxHashes.clear();
|
|
141
141
|
this.completeCheckpointCalled = false;
|
|
142
142
|
this.getCheckpointCalled = false;
|
|
143
|
+
}
|
|
144
|
+
/** Reset for reuse in another test */ reset() {
|
|
145
|
+
this.blocks = [];
|
|
146
|
+
this.usedTxsPerBlock = [];
|
|
147
|
+
this.buildBlockCalls = [];
|
|
143
148
|
this.errorOnBuild = undefined;
|
|
144
149
|
this.blockProvider = undefined;
|
|
150
|
+
this.resetCheckpointState();
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
153
|
/**
|
|
@@ -175,32 +181,37 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
175
181
|
l1GenesisTime: 0n,
|
|
176
182
|
slotDuration: 24,
|
|
177
183
|
l1ChainId: 1,
|
|
178
|
-
rollupVersion: 1
|
|
184
|
+
rollupVersion: 1,
|
|
185
|
+
rollupManaLimit: 200_000_000
|
|
179
186
|
};
|
|
180
187
|
}
|
|
181
188
|
updateConfig(config) {
|
|
182
189
|
this.updateConfigCalls.push(config);
|
|
183
190
|
}
|
|
184
|
-
startCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, _fork) {
|
|
191
|
+
startCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, _fork) {
|
|
185
192
|
this.startCheckpointCalls.push({
|
|
186
193
|
checkpointNumber,
|
|
187
194
|
constants,
|
|
188
195
|
l1ToL2Messages,
|
|
189
|
-
previousCheckpointOutHashes
|
|
196
|
+
previousCheckpointOutHashes,
|
|
197
|
+
feeAssetPriceModifier
|
|
190
198
|
});
|
|
191
199
|
if (!this.checkpointBuilder) {
|
|
192
200
|
// Auto-create a builder if none was set
|
|
193
201
|
this.checkpointBuilder = new MockCheckpointBuilder(constants, checkpointNumber);
|
|
202
|
+
} else {
|
|
203
|
+
this.checkpointBuilder.resetCheckpointState();
|
|
194
204
|
}
|
|
195
205
|
return Promise.resolve(this.checkpointBuilder);
|
|
196
206
|
}
|
|
197
|
-
openCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, _fork, existingBlocks = []) {
|
|
207
|
+
openCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, _fork, existingBlocks = []) {
|
|
198
208
|
this.openCheckpointCalls.push({
|
|
199
209
|
checkpointNumber,
|
|
200
210
|
constants,
|
|
201
211
|
l1ToL2Messages,
|
|
202
212
|
previousCheckpointOutHashes,
|
|
203
|
-
existingBlocks
|
|
213
|
+
existingBlocks,
|
|
214
|
+
feeAssetPriceModifier
|
|
204
215
|
});
|
|
205
216
|
if (!this.checkpointBuilder) {
|
|
206
217
|
// Auto-create a builder if none was set
|
package/dest/test/utils.d.ts
CHANGED
|
@@ -35,13 +35,13 @@ export declare function createBlockProposal(block: L2Block, signature: Signature
|
|
|
35
35
|
/**
|
|
36
36
|
* Creates a checkpoint proposal from a block and signature
|
|
37
37
|
*/
|
|
38
|
-
export declare function createCheckpointProposal(block: L2Block, checkpointSignature: Signature, blockSignature?: Signature): CheckpointProposal;
|
|
38
|
+
export declare function createCheckpointProposal(block: L2Block, checkpointSignature: Signature, blockSignature?: Signature, feeAssetPriceModifier?: bigint): 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: L2Block, signature: Signature, sender: EthAddress): CheckpointAttestation;
|
|
44
|
+
export declare function createCheckpointAttestation(block: L2Block, signature: Signature, sender: EthAddress, feeAssetPriceModifier?: bigint): 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.
|
|
@@ -50,4 +50,4 @@ export declare function setupTxsAndBlock(p2p: MockProxy<P2P>, globalVariables: G
|
|
|
50
50
|
txs: Tx[];
|
|
51
51
|
block: L2Block;
|
|
52
52
|
}>;
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLEN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","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,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAoB,MAAM,mBAAmB,CAAC;AAG/G,OAAO,EAAe,eAAe,EAAE,KAAK,EAAE,EAAoC,MAAM,kBAAkB,CAAC;AAE3G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE7F;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAMrE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,
|
|
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,U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mB,EAAE,SAAS,EAC9B,cAAc,CAAC,EAAE,SAAS,EAC1B,qBAAqB,GAAE,MAAW,GACjC,kBAAkB,CASpB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,EAClB,qBAAqB,GAAE,MAAW,GACjC,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
|
@@ -36,6 +36,7 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
36
36
|
*/ export function mockPendingTxs(p2p, txs) {
|
|
37
37
|
p2p.getPendingTxCount.mockResolvedValue(txs.length);
|
|
38
38
|
p2p.iteratePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
|
|
39
|
+
p2p.iterateEligiblePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Creates an async iterator for transactions
|
|
@@ -67,10 +68,10 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Creates a checkpoint proposal from a block and signature
|
|
70
|
-
*/ export function createCheckpointProposal(block, checkpointSignature, blockSignature) {
|
|
71
|
+
*/ export function createCheckpointProposal(block, checkpointSignature, blockSignature, feeAssetPriceModifier = 0n) {
|
|
71
72
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
72
73
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
73
|
-
return new CheckpointProposal(checkpointHeader, block.archive.root, checkpointSignature, {
|
|
74
|
+
return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, {
|
|
74
75
|
blockHeader: block.header,
|
|
75
76
|
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
76
77
|
txHashes,
|
|
@@ -81,9 +82,9 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
81
82
|
* Creates a checkpoint attestation from a block and signature.
|
|
82
83
|
* Note: We manually set the sender since we use random signatures in tests.
|
|
83
84
|
* In production, the sender is recovered from the signature.
|
|
84
|
-
*/ export function createCheckpointAttestation(block, signature, sender) {
|
|
85
|
+
*/ export function createCheckpointAttestation(block, signature, sender, feeAssetPriceModifier = 0n) {
|
|
85
86
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
86
|
-
const payload = new ConsensusPayload(checkpointHeader, block.archive.root);
|
|
87
|
+
const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier);
|
|
87
88
|
const attestation = new CheckpointAttestation(payload, signature, signature);
|
|
88
89
|
// Set sender directly for testing (bypasses signature recovery)
|
|
89
90
|
attestation.sender = sender;
|
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.ef17749e1",
|
|
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.ef17749e1",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.ef17749e1",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.ef17749e1",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.ef17749e1",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.ef17749e1",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.ef17749e1",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.ef17749e1",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.ef17749e1",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.ef17749e1",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.ef17749e1",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.ef17749e1",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.ef17749e1",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.ef17749e1",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.ef17749e1",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.ef17749e1",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.ef17749e1",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.ef17749e1",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.ef17749e1",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.ef17749e1",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.ef17749e1",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.ef17749e1",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.ef17749e1",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.ef17749e1",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.ef17749e1",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.ef17749e1",
|
|
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.ef17749e1",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.ef17749e1",
|
|
61
61
|
"@electric-sql/pglite": "^0.3.14",
|
|
62
62
|
"@jest/globals": "^30.0.0",
|
|
63
63
|
"@types/jest": "^30.0.0",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
|
+
import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
|
|
2
3
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
4
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
5
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
6
|
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
-
import {
|
|
7
|
+
import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
7
8
|
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
8
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -18,21 +19,27 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
|
18
19
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
19
20
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
20
21
|
|
|
21
|
-
import
|
|
22
|
+
import {
|
|
23
|
+
DefaultSequencerConfig,
|
|
24
|
+
type SequencerClientConfig,
|
|
25
|
+
getPublisherConfigFromSequencerConfig,
|
|
26
|
+
} from '../config.js';
|
|
22
27
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
28
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
29
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
30
|
+
import { SequencerTimetable } from '../sequencer/timetable.js';
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* Encapsulates the full sequencer and publisher.
|
|
28
34
|
*/
|
|
29
35
|
export class SequencerClient {
|
|
30
36
|
constructor(
|
|
31
|
-
protected publisherManager: PublisherManager<
|
|
37
|
+
protected publisherManager: PublisherManager<L1TxUtils>,
|
|
32
38
|
protected sequencer: Sequencer,
|
|
33
39
|
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
34
40
|
protected validatorClient?: ValidatorClient,
|
|
35
41
|
private l1Metrics?: L1Metrics,
|
|
42
|
+
private delayer_?: Delayer,
|
|
36
43
|
) {}
|
|
37
44
|
|
|
38
45
|
/**
|
|
@@ -62,7 +69,7 @@ export class SequencerClient {
|
|
|
62
69
|
blobClient: BlobClientInterface;
|
|
63
70
|
dateProvider: DateProvider;
|
|
64
71
|
epochCache?: EpochCache;
|
|
65
|
-
l1TxUtils:
|
|
72
|
+
l1TxUtils: L1TxUtils[];
|
|
66
73
|
nodeKeyStore: KeystoreManager;
|
|
67
74
|
},
|
|
68
75
|
) {
|
|
@@ -85,7 +92,11 @@ export class SequencerClient {
|
|
|
85
92
|
publicClient,
|
|
86
93
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
87
94
|
);
|
|
88
|
-
const publisherManager = new PublisherManager(
|
|
95
|
+
const publisherManager = new PublisherManager(
|
|
96
|
+
l1TxUtils,
|
|
97
|
+
getPublisherConfigFromSequencerConfig(config),
|
|
98
|
+
log.getBindings(),
|
|
99
|
+
);
|
|
89
100
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
90
101
|
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
91
102
|
rollupContract.getL1GenesisTime(),
|
|
@@ -132,17 +143,14 @@ export class SequencerClient {
|
|
|
132
143
|
});
|
|
133
144
|
|
|
134
145
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
135
|
-
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
|
|
136
|
-
|
|
137
|
-
const globalsBuilder = new GlobalVariableBuilder({ ...config, ...l1Constants, rollupVersion });
|
|
138
146
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
147
|
+
const globalsBuilder = new GlobalVariableBuilder({
|
|
148
|
+
...config,
|
|
149
|
+
l1GenesisTime,
|
|
150
|
+
slotDuration: Number(slotDuration),
|
|
151
|
+
ethereumSlotDuration,
|
|
152
|
+
rollupVersion,
|
|
153
|
+
});
|
|
146
154
|
|
|
147
155
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
148
156
|
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
@@ -152,6 +160,15 @@ export class SequencerClient {
|
|
|
152
160
|
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
153
161
|
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
154
162
|
|
|
163
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = computeBlockLimits(
|
|
164
|
+
config,
|
|
165
|
+
rollupManaLimit,
|
|
166
|
+
l1PublishingTime,
|
|
167
|
+
log,
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration, rollupManaLimit };
|
|
171
|
+
|
|
155
172
|
const sequencer = new Sequencer(
|
|
156
173
|
publisherFactory,
|
|
157
174
|
validatorClient,
|
|
@@ -166,14 +183,17 @@ export class SequencerClient {
|
|
|
166
183
|
deps.dateProvider,
|
|
167
184
|
epochCache,
|
|
168
185
|
rollupContract,
|
|
169
|
-
{ ...config, l1PublishingTime, maxL2BlockGas
|
|
186
|
+
{ ...config, l1PublishingTime, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
170
187
|
telemetryClient,
|
|
171
188
|
log,
|
|
172
189
|
);
|
|
173
190
|
|
|
174
|
-
|
|
191
|
+
sequencer.init();
|
|
192
|
+
|
|
193
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
194
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
175
195
|
|
|
176
|
-
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
|
|
196
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
/**
|
|
@@ -208,6 +228,16 @@ export class SequencerClient {
|
|
|
208
228
|
return this.sequencer;
|
|
209
229
|
}
|
|
210
230
|
|
|
231
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
232
|
+
public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
|
|
233
|
+
this.sequencer.updatePublisherNodeKeyStore(adapter);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
|
|
237
|
+
getDelayer(): Delayer | undefined {
|
|
238
|
+
return this.delayer_;
|
|
239
|
+
}
|
|
240
|
+
|
|
211
241
|
get validatorAddresses(): EthAddress[] | undefined {
|
|
212
242
|
return this.sequencer.getValidatorAddresses();
|
|
213
243
|
}
|
|
@@ -216,3 +246,90 @@ export class SequencerClient {
|
|
|
216
246
|
return this.sequencer.maxL2BlockGas;
|
|
217
247
|
}
|
|
218
248
|
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Computes per-block L2 gas, DA gas, and TX count budgets based on the L1 rollup limits and the timetable.
|
|
252
|
+
* If the user explicitly set a limit, it is capped at the corresponding checkpoint limit.
|
|
253
|
+
* Otherwise, derives it as (checkpointLimit / maxBlocks) * multiplier, capped at the checkpoint limit.
|
|
254
|
+
*/
|
|
255
|
+
export function computeBlockLimits(
|
|
256
|
+
config: SequencerClientConfig,
|
|
257
|
+
rollupManaLimit: number,
|
|
258
|
+
l1PublishingTime: number,
|
|
259
|
+
log: ReturnType<typeof createLogger>,
|
|
260
|
+
): { maxL2BlockGas: number; maxDABlockGas: number; maxTxsPerBlock: number } {
|
|
261
|
+
const maxNumberOfBlocks = new SequencerTimetable({
|
|
262
|
+
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
263
|
+
aztecSlotDuration: config.aztecSlotDuration,
|
|
264
|
+
l1PublishingTime,
|
|
265
|
+
p2pPropagationTime: config.attestationPropagationTime,
|
|
266
|
+
blockDurationMs: config.blockDurationMs,
|
|
267
|
+
enforce: config.enforceTimeTable ?? DefaultSequencerConfig.enforceTimeTable,
|
|
268
|
+
}).maxNumberOfBlocks;
|
|
269
|
+
|
|
270
|
+
const multiplier = config.perBlockAllocationMultiplier ?? DefaultSequencerConfig.perBlockAllocationMultiplier;
|
|
271
|
+
|
|
272
|
+
// Compute maxL2BlockGas
|
|
273
|
+
let maxL2BlockGas: number;
|
|
274
|
+
if (config.maxL2BlockGas !== undefined) {
|
|
275
|
+
if (config.maxL2BlockGas > rollupManaLimit) {
|
|
276
|
+
log.warn(
|
|
277
|
+
`Provided MAX_L2_BLOCK_GAS ${config.maxL2BlockGas} exceeds L1 rollup mana limit ${rollupManaLimit} (capping)`,
|
|
278
|
+
);
|
|
279
|
+
maxL2BlockGas = rollupManaLimit;
|
|
280
|
+
} else {
|
|
281
|
+
maxL2BlockGas = config.maxL2BlockGas;
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
maxL2BlockGas = Math.min(rollupManaLimit, Math.ceil((rollupManaLimit / maxNumberOfBlocks) * multiplier));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Compute maxDABlockGas
|
|
288
|
+
const daCheckpointLimit = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
289
|
+
let maxDABlockGas: number;
|
|
290
|
+
if (config.maxDABlockGas !== undefined) {
|
|
291
|
+
if (config.maxDABlockGas > daCheckpointLimit) {
|
|
292
|
+
log.warn(
|
|
293
|
+
`Provided MAX_DA_BLOCK_GAS ${config.maxDABlockGas} exceeds DA checkpoint limit ${daCheckpointLimit} (capping)`,
|
|
294
|
+
);
|
|
295
|
+
maxDABlockGas = daCheckpointLimit;
|
|
296
|
+
} else {
|
|
297
|
+
maxDABlockGas = config.maxDABlockGas;
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
maxDABlockGas = Math.min(daCheckpointLimit, Math.ceil((daCheckpointLimit / maxNumberOfBlocks) * multiplier));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Compute maxTxsPerBlock
|
|
304
|
+
const defaultMaxTxsPerBlock = 32;
|
|
305
|
+
let maxTxsPerBlock: number;
|
|
306
|
+
if (config.maxTxsPerBlock !== undefined) {
|
|
307
|
+
if (config.maxTxsPerCheckpoint !== undefined && config.maxTxsPerBlock > config.maxTxsPerCheckpoint) {
|
|
308
|
+
log.warn(
|
|
309
|
+
`Provided MAX_TX_PER_BLOCK ${config.maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`,
|
|
310
|
+
);
|
|
311
|
+
maxTxsPerBlock = config.maxTxsPerCheckpoint;
|
|
312
|
+
} else {
|
|
313
|
+
maxTxsPerBlock = config.maxTxsPerBlock;
|
|
314
|
+
}
|
|
315
|
+
} else if (config.maxTxsPerCheckpoint !== undefined) {
|
|
316
|
+
maxTxsPerBlock = Math.min(
|
|
317
|
+
config.maxTxsPerCheckpoint,
|
|
318
|
+
Math.ceil((config.maxTxsPerCheckpoint / maxNumberOfBlocks) * multiplier),
|
|
319
|
+
);
|
|
320
|
+
} else {
|
|
321
|
+
maxTxsPerBlock = defaultMaxTxsPerBlock;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
log.info(`Computed block limits L2=${maxL2BlockGas} DA=${maxDABlockGas} maxTxs=${maxTxsPerBlock}`, {
|
|
325
|
+
maxL2BlockGas,
|
|
326
|
+
maxDABlockGas,
|
|
327
|
+
maxTxsPerBlock,
|
|
328
|
+
rollupManaLimit,
|
|
329
|
+
daCheckpointLimit,
|
|
330
|
+
maxNumberOfBlocks,
|
|
331
|
+
multiplier,
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
return { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock };
|
|
335
|
+
}
|