@aztec/sequencer-client 0.0.1-commit.1142ef1 → 0.0.1-commit.1a99e26c
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 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +1 -3
- package/dest/global_variable_builder/global_builder.js +2 -2
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- 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/sequencer/checkpoint_proposal_job.d.ts +8 -6
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +97 -17
- package/dest/sequencer/checkpoint_voter.d.ts +3 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +34 -10
- package/dest/sequencer/index.d.ts +1 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +0 -1
- 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 +17 -9
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +67 -11
- package/dest/test/mock_checkpoint_builder.d.ts +17 -13
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +28 -8
- package/dest/test/utils.d.ts +8 -8
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +7 -7
- package/package.json +30 -28
- package/src/client/sequencer-client.ts +1 -1
- package/src/config.ts +1 -3
- package/src/global_variable_builder/global_builder.ts +2 -2
- package/src/index.ts +1 -6
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/sequencer/checkpoint_proposal_job.ts +136 -28
- package/src/sequencer/checkpoint_voter.ts +32 -7
- package/src/sequencer/index.ts +0 -1
- package/src/sequencer/metrics.ts +36 -18
- package/src/sequencer/sequencer.ts +82 -10
- package/src/test/mock_checkpoint_builder.ts +65 -33
- package/src/test/utils.ts +19 -12
- package/dest/sequencer/block_builder.d.ts +0 -26
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -129
- package/src/sequencer/block_builder.ts +0 -216
|
@@ -16,6 +16,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
16
16
|
blockIndex;
|
|
17
17
|
/** Optional function to dynamically provide the block (alternative to seedBlocks) */ blockProvider;
|
|
18
18
|
/** Track calls for assertions */ buildBlockCalls;
|
|
19
|
+
/** Track all consumed transaction hashes across buildBlock calls */ consumedTxHashes;
|
|
19
20
|
completeCheckpointCalled;
|
|
20
21
|
getCheckpointCalled;
|
|
21
22
|
/** Set to an error to make buildBlock throw on next call */ errorOnBuild;
|
|
@@ -28,6 +29,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
28
29
|
this.blockIndex = 0;
|
|
29
30
|
this.blockProvider = undefined;
|
|
30
31
|
this.buildBlockCalls = [];
|
|
32
|
+
this.consumedTxHashes = new Set();
|
|
31
33
|
this.completeCheckpointCalled = false;
|
|
32
34
|
this.getCheckpointCalled = false;
|
|
33
35
|
this.errorOnBuild = undefined;
|
|
@@ -50,14 +52,14 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
50
52
|
getConstantData() {
|
|
51
53
|
return this.constants;
|
|
52
54
|
}
|
|
53
|
-
buildBlock(
|
|
55
|
+
async buildBlock(pendingTxs, blockNumber, timestamp, opts) {
|
|
54
56
|
this.buildBlockCalls.push({
|
|
55
57
|
blockNumber,
|
|
56
58
|
timestamp,
|
|
57
59
|
opts
|
|
58
60
|
});
|
|
59
61
|
if (this.errorOnBuild) {
|
|
60
|
-
|
|
62
|
+
throw this.errorOnBuild;
|
|
61
63
|
}
|
|
62
64
|
let block;
|
|
63
65
|
let usedTxs;
|
|
@@ -73,15 +75,27 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
73
75
|
this.blockIndex++;
|
|
74
76
|
this.builtBlocks.push(block);
|
|
75
77
|
}
|
|
76
|
-
|
|
78
|
+
// Check that no pending tx has already been consumed
|
|
79
|
+
for await (const tx of pendingTxs){
|
|
80
|
+
const hash = tx.getTxHash().toString();
|
|
81
|
+
if (this.consumedTxHashes.has(hash)) {
|
|
82
|
+
throw new Error(`Transaction ${hash} was already consumed in a previous block`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Add used txs to consumed set
|
|
86
|
+
for (const tx of usedTxs){
|
|
87
|
+
this.consumedTxHashes.add(tx.getTxHash().toString());
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
77
90
|
block,
|
|
78
91
|
publicGas: Gas.empty(),
|
|
79
92
|
publicProcessorDuration: 0,
|
|
80
93
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
81
94
|
blockBuildingTimer: new Timer(),
|
|
82
95
|
usedTxs,
|
|
83
|
-
failedTxs: []
|
|
84
|
-
|
|
96
|
+
failedTxs: [],
|
|
97
|
+
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx)=>sum + tx.getNumBlobFields(), 0) ?? 0
|
|
98
|
+
};
|
|
85
99
|
}
|
|
86
100
|
completeCheckpoint() {
|
|
87
101
|
this.completeCheckpointCalled = true;
|
|
@@ -125,6 +139,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
125
139
|
this.usedTxsPerBlock = [];
|
|
126
140
|
this.blockIndex = 0;
|
|
127
141
|
this.buildBlockCalls = [];
|
|
142
|
+
this.consumedTxHashes.clear();
|
|
128
143
|
this.completeCheckpointCalled = false;
|
|
129
144
|
this.getCheckpointCalled = false;
|
|
130
145
|
this.errorOnBuild = undefined;
|
|
@@ -168,11 +183,12 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
168
183
|
updateConfig(config) {
|
|
169
184
|
this.updateConfigCalls.push(config);
|
|
170
185
|
}
|
|
171
|
-
startCheckpoint(checkpointNumber, constants, l1ToL2Messages, _fork) {
|
|
186
|
+
startCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, _fork) {
|
|
172
187
|
this.startCheckpointCalls.push({
|
|
173
188
|
checkpointNumber,
|
|
174
189
|
constants,
|
|
175
|
-
l1ToL2Messages
|
|
190
|
+
l1ToL2Messages,
|
|
191
|
+
previousCheckpointOutHashes
|
|
176
192
|
});
|
|
177
193
|
if (!this.checkpointBuilder) {
|
|
178
194
|
// Auto-create a builder if none was set
|
|
@@ -180,11 +196,12 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
180
196
|
}
|
|
181
197
|
return Promise.resolve(this.checkpointBuilder);
|
|
182
198
|
}
|
|
183
|
-
openCheckpoint(checkpointNumber, constants, l1ToL2Messages, _fork, existingBlocks = []) {
|
|
199
|
+
openCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, _fork, existingBlocks = []) {
|
|
184
200
|
this.openCheckpointCalls.push({
|
|
185
201
|
checkpointNumber,
|
|
186
202
|
constants,
|
|
187
203
|
l1ToL2Messages,
|
|
204
|
+
previousCheckpointOutHashes,
|
|
188
205
|
existingBlocks
|
|
189
206
|
});
|
|
190
207
|
if (!this.checkpointBuilder) {
|
|
@@ -193,6 +210,9 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
193
210
|
}
|
|
194
211
|
return Promise.resolve(this.checkpointBuilder);
|
|
195
212
|
}
|
|
213
|
+
getFork(_blockNumber) {
|
|
214
|
+
throw new Error('MockCheckpointsBuilder.getFork not implemented');
|
|
215
|
+
}
|
|
196
216
|
/** Reset for reuse in another test */ reset() {
|
|
197
217
|
this.checkpointBuilder = undefined;
|
|
198
218
|
this.startCheckpointCalls = [];
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0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;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,EAAE,CAGpF;AAuBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,aAAa,CAUvF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Body } from '@aztec/aztec.js/block';
|
|
2
|
-
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
3
3
|
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,11 +53,11 @@ 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
|
-
return new CheckpointHeader(block.header.lastArchive.root, Fr.random(), Fr.random(), Fr.random(), gv.slotNumber, gv.timestamp, gv.coinbase, gv.feeRecipient, gv.gasFees, block.header.totalManaUsed);
|
|
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);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Creates a block proposal from a block and signature
|
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.1a99e26c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,43 +26,45 @@
|
|
|
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/
|
|
29
|
+
"@aztec/aztec.js": "0.0.1-commit.1a99e26c",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.1a99e26c",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.1a99e26c",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.1a99e26c",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.1a99e26c",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.1a99e26c",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.1a99e26c",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.1a99e26c",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.1a99e26c",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.1a99e26c",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.1a99e26c",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.1a99e26c",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.1a99e26c",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.1a99e26c",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.1a99e26c",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.1a99e26c",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.1a99e26c",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.1a99e26c",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.1a99e26c",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.1a99e26c",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.1a99e26c",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.1a99e26c",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.1a99e26c",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.1a99e26c",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.1a99e26c",
|
|
53
54
|
"lodash.chunk": "^4.2.0",
|
|
54
55
|
"tslib": "^2.4.0",
|
|
55
56
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
59
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.1a99e26c",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.1a99e26c",
|
|
61
|
+
"@electric-sql/pglite": "^0.3.14",
|
|
60
62
|
"@jest/globals": "^30.0.0",
|
|
61
63
|
"@types/jest": "^30.0.0",
|
|
62
64
|
"@types/lodash.chunk": "^4.2.7",
|
|
63
65
|
"@types/lodash.pick": "^4.4.7",
|
|
64
66
|
"@types/node": "^22.15.17",
|
|
65
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
67
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
66
68
|
"concurrently": "^7.6.0",
|
|
67
69
|
"eslint": "^9.26.0",
|
|
68
70
|
"express": "^4.21.2",
|
|
@@ -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
|
@@ -50,8 +50,7 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
50
50
|
injectFakeAttestation: false,
|
|
51
51
|
fishermanMode: false,
|
|
52
52
|
shuffleAttestationOrdering: false,
|
|
53
|
-
|
|
54
|
-
skipPushProposedBlocksToArchiver: true,
|
|
53
|
+
skipPushProposedBlocksToArchiver: false,
|
|
55
54
|
};
|
|
56
55
|
|
|
57
56
|
/**
|
|
@@ -204,7 +203,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
204
203
|
description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
|
|
205
204
|
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
206
205
|
},
|
|
207
|
-
// TODO(palla/mbps): Change default to false once block sync is stable
|
|
208
206
|
skipPushProposedBlocksToArchiver: {
|
|
209
207
|
description: 'Skip pushing proposed blocks to archiver (default: true)',
|
|
210
208
|
...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;
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
export * from './client/index.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './publisher/index.js';
|
|
4
|
-
export {
|
|
5
|
-
FullNodeBlockBuilder as BlockBuilder,
|
|
6
|
-
Sequencer,
|
|
7
|
-
SequencerState,
|
|
8
|
-
type SequencerEvents,
|
|
9
|
-
} from './sequencer/index.js';
|
|
4
|
+
export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
|
|
10
5
|
|
|
11
6
|
// Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
|
|
12
7
|
// ISSUE(#9832)
|
|
@@ -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
|
|