@aztec/sequencer-client 0.0.1-commit.96bb3f7 → 0.0.1-commit.96dac018d
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 +12 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +15 -4
- package/dest/config.d.ts +3 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -14
- 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/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/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 +13 -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 +22 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +297 -47
- package/dest/sequencer/checkpoint_proposal_job.d.ts +34 -9
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +171 -41
- 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 +17 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +111 -30
- package/dest/sequencer/sequencer.d.ts +31 -13
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +95 -36
- 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/index.d.ts +3 -5
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +19 -13
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +31 -11
- package/dest/test/utils.d.ts +8 -8
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +12 -11
- package/package.json +30 -28
- package/src/client/sequencer-client.ts +25 -7
- package/src/config.ts +27 -22
- package/src/global_variable_builder/global_builder.ts +3 -3
- package/src/index.ts +1 -6
- 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 +23 -6
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/publisher/sequencer-publisher.ts +274 -53
- package/src/sequencer/checkpoint_proposal_job.ts +243 -59
- package/src/sequencer/checkpoint_voter.ts +32 -7
- package/src/sequencer/index.ts +0 -1
- package/src/sequencer/metrics.ts +124 -32
- package/src/sequencer/sequencer.ts +118 -38
- package/src/sequencer/timetable.ts +6 -5
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +75 -34
- package/src/test/utils.ts +24 -14
- 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
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, 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:
|
|
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.
|
|
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,eyJ2ZX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UFlLEVBQ2hDLE9BQU8sRUFBRSxNQUFNLEVBQ2YsT0FBTyxFQUFFLEVBQUUsR0FDVixPQUFPLENBQUM7SUFBRSxHQUFHLEVBQUUsRUFBRSxFQUFFLENBQUM7SUFBQyxLQUFLLEVBQUUsT0FBTyxDQUFBO0NBQUUsQ0FBQyxDQUt4QyJ9
|
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,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,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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,13 +29,14 @@ 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
|
|
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
|
|
@@ -53,11 +54,11 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
53
54
|
];
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
|
-
* Creates a CheckpointHeader from an
|
|
57
|
-
* Uses mock values for blockHeadersHash, blobsHash and inHash since
|
|
57
|
+
* Creates a CheckpointHeader from an L2Block for testing purposes.
|
|
58
|
+
* Uses mock values for blockHeadersHash, blobsHash and inHash since L2Block doesn't have these fields.
|
|
58
59
|
*/ function createCheckpointHeaderFromBlock(block) {
|
|
59
60
|
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);
|
|
61
|
+
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
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Creates a block proposal from a block and signature
|
|
@@ -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.96dac018d",
|
|
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.96dac018d",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.96dac018d",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.96dac018d",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.96dac018d",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.96dac018d",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.96dac018d",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.96dac018d",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.96dac018d",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.96dac018d",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.96dac018d",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.96dac018d",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.96dac018d",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.96dac018d",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.96dac018d",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.96dac018d",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.96dac018d",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.96dac018d",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.96dac018d",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.96dac018d",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.96dac018d",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.96dac018d",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.96dac018d",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.96dac018d",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.96dac018d",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.96dac018d",
|
|
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.96dac018d",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.96dac018d",
|
|
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",
|
|
@@ -3,7 +3,7 @@ import { EpochCache } from '@aztec/epoch-cache';
|
|
|
3
3
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
4
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
5
|
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
-
import {
|
|
6
|
+
import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
7
7
|
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
8
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -18,7 +18,7 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
|
18
18
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
19
19
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
20
20
|
|
|
21
|
-
import type
|
|
21
|
+
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
22
22
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
23
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
24
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
@@ -28,11 +28,12 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
|
28
28
|
*/
|
|
29
29
|
export class SequencerClient {
|
|
30
30
|
constructor(
|
|
31
|
-
protected publisherManager: PublisherManager<
|
|
31
|
+
protected publisherManager: PublisherManager<L1TxUtils>,
|
|
32
32
|
protected sequencer: Sequencer,
|
|
33
33
|
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
34
34
|
protected validatorClient?: ValidatorClient,
|
|
35
35
|
private l1Metrics?: L1Metrics,
|
|
36
|
+
private delayer_?: Delayer,
|
|
36
37
|
) {}
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -62,7 +63,7 @@ export class SequencerClient {
|
|
|
62
63
|
blobClient: BlobClientInterface;
|
|
63
64
|
dateProvider: DateProvider;
|
|
64
65
|
epochCache?: EpochCache;
|
|
65
|
-
l1TxUtils:
|
|
66
|
+
l1TxUtils: L1TxUtils[];
|
|
66
67
|
nodeKeyStore: KeystoreManager;
|
|
67
68
|
},
|
|
68
69
|
) {
|
|
@@ -85,7 +86,11 @@ export class SequencerClient {
|
|
|
85
86
|
publicClient,
|
|
86
87
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
87
88
|
);
|
|
88
|
-
const publisherManager = new PublisherManager(
|
|
89
|
+
const publisherManager = new PublisherManager(
|
|
90
|
+
l1TxUtils,
|
|
91
|
+
getPublisherConfigFromSequencerConfig(config),
|
|
92
|
+
log.getBindings(),
|
|
93
|
+
);
|
|
89
94
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
90
95
|
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
91
96
|
rollupContract.getL1GenesisTime(),
|
|
@@ -171,9 +176,12 @@ export class SequencerClient {
|
|
|
171
176
|
log,
|
|
172
177
|
);
|
|
173
178
|
|
|
174
|
-
|
|
179
|
+
sequencer.init();
|
|
180
|
+
|
|
181
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
182
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
175
183
|
|
|
176
|
-
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
|
|
184
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
|
|
177
185
|
}
|
|
178
186
|
|
|
179
187
|
/**
|
|
@@ -208,6 +216,16 @@ export class SequencerClient {
|
|
|
208
216
|
return this.sequencer;
|
|
209
217
|
}
|
|
210
218
|
|
|
219
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
220
|
+
public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
|
|
221
|
+
this.sequencer.updatePublisherNodeKeyStore(adapter);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
|
|
225
|
+
getDelayer(): Delayer | undefined {
|
|
226
|
+
return this.delayer_;
|
|
227
|
+
}
|
|
228
|
+
|
|
211
229
|
get validatorAddresses(): EthAddress[] | undefined {
|
|
212
230
|
return this.sequencer.getValidatorAddresses();
|
|
213
231
|
}
|
package/src/config.ts
CHANGED
|
@@ -11,22 +11,26 @@ 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 {
|
|
19
|
-
type
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
type SequencerPublisherConfig,
|
|
26
|
+
type SequencerTxSenderConfig,
|
|
27
|
+
sequencerPublisherConfigMappings,
|
|
28
|
+
sequencerTxSenderConfigMappings,
|
|
23
29
|
} from './publisher/config.js';
|
|
24
30
|
|
|
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,17 +54,17 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
50
54
|
injectFakeAttestation: false,
|
|
51
55
|
fishermanMode: false,
|
|
52
56
|
shuffleAttestationOrdering: false,
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
skipPushProposedBlocksToArchiver: false,
|
|
58
|
+
skipPublishingCheckpointsPercent: 0,
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* Configuration settings for the SequencerClient.
|
|
59
63
|
*/
|
|
60
|
-
export type SequencerClientConfig =
|
|
64
|
+
export type SequencerClientConfig = SequencerPublisherConfig &
|
|
61
65
|
KeyStoreConfig &
|
|
62
66
|
ValidatorClientConfig &
|
|
63
|
-
|
|
67
|
+
SequencerTxSenderConfig &
|
|
64
68
|
SequencerConfig &
|
|
65
69
|
L1ReaderConfig &
|
|
66
70
|
ChainConfig &
|
|
@@ -192,23 +196,24 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
192
196
|
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
193
197
|
...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
|
|
194
198
|
},
|
|
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
|
-
},
|
|
199
|
+
...sharedSequencerConfigMappings,
|
|
202
200
|
buildCheckpointIfEmpty: {
|
|
203
201
|
env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
|
|
204
202
|
description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
|
|
205
203
|
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
206
204
|
},
|
|
207
|
-
// TODO(palla/mbps): Change default to false once block sync is stable
|
|
208
205
|
skipPushProposedBlocksToArchiver: {
|
|
209
206
|
description: 'Skip pushing proposed blocks to archiver (default: true)',
|
|
210
207
|
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
211
208
|
},
|
|
209
|
+
minBlocksForCheckpoint: {
|
|
210
|
+
description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
|
|
211
|
+
},
|
|
212
|
+
skipPublishingCheckpointsPercent: {
|
|
213
|
+
env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
|
|
214
|
+
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
215
|
+
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
216
|
+
},
|
|
212
217
|
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
|
|
213
218
|
};
|
|
214
219
|
|
|
@@ -217,8 +222,8 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
|
|
|
217
222
|
...sequencerConfigMappings,
|
|
218
223
|
...keyStoreConfigMappings,
|
|
219
224
|
...l1ReaderConfigMappings,
|
|
220
|
-
...
|
|
221
|
-
...
|
|
225
|
+
...sequencerTxSenderConfigMappings,
|
|
226
|
+
...sequencerPublisherConfigMappings,
|
|
222
227
|
...chainConfigMappings,
|
|
223
228
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
224
229
|
};
|
|
@@ -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;
|
|
@@ -120,7 +120,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
120
120
|
coinbase: EthAddress,
|
|
121
121
|
feeRecipient: AztecAddress,
|
|
122
122
|
slotNumber: SlotNumber,
|
|
123
|
-
): Promise<CheckpointGlobalVariables
|
|
123
|
+
): Promise<CheckpointGlobalVariables> {
|
|
124
124
|
const { chainId, version } = this;
|
|
125
125
|
|
|
126
126
|
const timestamp = getTimestampForSlot(slotNumber, {
|
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)
|