@aztec/sequencer-client 1.2.1 → 2.0.0-nightly.20250813
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 +0 -2
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +5 -7
- package/dest/config.d.ts +1 -0
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +27 -0
- package/dest/publisher/index.d.ts +1 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +48 -33
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +272 -114
- package/dest/sequencer/block_builder.d.ts +2 -7
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +3 -7
- package/dest/sequencer/sequencer.d.ts +27 -15
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +141 -85
- package/dest/sequencer/timetable.d.ts +15 -5
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +25 -12
- package/dest/sequencer/utils.d.ts +1 -11
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +0 -23
- package/package.json +26 -26
- package/src/client/sequencer-client.ts +4 -8
- package/src/config.ts +33 -0
- package/src/publisher/index.ts +1 -1
- package/src/publisher/sequencer-publisher.ts +318 -131
- package/src/sequencer/block_builder.ts +15 -8
- package/src/sequencer/sequencer.ts +217 -87
- package/src/sequencer/timetable.ts +43 -7
- package/src/sequencer/utils.ts +6 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,aAAa,kBAAkB;IAC/B;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,qBAAqB,0BAA0B;IAC/C;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,uBAAuB,4BAA4B;IACnD;;OAEG;IACH,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,sBAAsB,GAC9B,cAAc,CAAC,qBAAqB,GACpC,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,gBAAgB,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE"}
|
package/dest/sequencer/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
2
1
|
export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
3
2
|
/**
|
|
4
3
|
* Sequencer is stopped and not processing any txs from the pool.
|
|
@@ -29,25 +28,3 @@ export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
|
29
28
|
export function sequencerStateToNumber(state) {
|
|
30
29
|
return Object.values(SequencerState).indexOf(state);
|
|
31
30
|
}
|
|
32
|
-
/** Order Attestations
|
|
33
|
-
*
|
|
34
|
-
* Returns attestation signatures in the order of a series of provided ethereum addresses
|
|
35
|
-
* The rollup smart contract expects attestations to appear in the order of the committee
|
|
36
|
-
*
|
|
37
|
-
* @todo: perform this logic within the memory attestation store instead?
|
|
38
|
-
*/ export function orderAttestations(attestations, orderAddresses) {
|
|
39
|
-
// Create a map of sender addresses to BlockAttestations
|
|
40
|
-
const attestationMap = new Map();
|
|
41
|
-
for (const attestation of attestations){
|
|
42
|
-
const sender = attestation.getSender();
|
|
43
|
-
if (sender) {
|
|
44
|
-
attestationMap.set(sender.toString(), CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// Create the ordered array based on the orderAddresses, else return an empty attestation
|
|
48
|
-
const orderedAttestations = orderAddresses.map((address)=>{
|
|
49
|
-
const addressString = address.toString();
|
|
50
|
-
return attestationMap.get(addressString) || CommitteeAttestation.fromAddress(address);
|
|
51
|
-
});
|
|
52
|
-
return orderedAttestations;
|
|
53
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-nightly.20250813",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "
|
|
30
|
-
"@aztec/bb-prover": "
|
|
31
|
-
"@aztec/blob-lib": "
|
|
32
|
-
"@aztec/blob-sink": "
|
|
33
|
-
"@aztec/constants": "
|
|
34
|
-
"@aztec/epoch-cache": "
|
|
35
|
-
"@aztec/ethereum": "
|
|
36
|
-
"@aztec/foundation": "
|
|
37
|
-
"@aztec/l1-artifacts": "
|
|
38
|
-
"@aztec/merkle-tree": "
|
|
39
|
-
"@aztec/noir-acvm_js": "
|
|
40
|
-
"@aztec/noir-contracts.js": "
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "
|
|
42
|
-
"@aztec/noir-types": "
|
|
43
|
-
"@aztec/p2p": "
|
|
44
|
-
"@aztec/protocol-contracts": "
|
|
45
|
-
"@aztec/prover-client": "
|
|
46
|
-
"@aztec/simulator": "
|
|
47
|
-
"@aztec/slasher": "
|
|
48
|
-
"@aztec/stdlib": "
|
|
49
|
-
"@aztec/telemetry-client": "
|
|
50
|
-
"@aztec/validator-client": "
|
|
51
|
-
"@aztec/world-state": "
|
|
29
|
+
"@aztec/aztec.js": "2.0.0-nightly.20250813",
|
|
30
|
+
"@aztec/bb-prover": "2.0.0-nightly.20250813",
|
|
31
|
+
"@aztec/blob-lib": "2.0.0-nightly.20250813",
|
|
32
|
+
"@aztec/blob-sink": "2.0.0-nightly.20250813",
|
|
33
|
+
"@aztec/constants": "2.0.0-nightly.20250813",
|
|
34
|
+
"@aztec/epoch-cache": "2.0.0-nightly.20250813",
|
|
35
|
+
"@aztec/ethereum": "2.0.0-nightly.20250813",
|
|
36
|
+
"@aztec/foundation": "2.0.0-nightly.20250813",
|
|
37
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250813",
|
|
38
|
+
"@aztec/merkle-tree": "2.0.0-nightly.20250813",
|
|
39
|
+
"@aztec/noir-acvm_js": "2.0.0-nightly.20250813",
|
|
40
|
+
"@aztec/noir-contracts.js": "2.0.0-nightly.20250813",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250813",
|
|
42
|
+
"@aztec/noir-types": "2.0.0-nightly.20250813",
|
|
43
|
+
"@aztec/p2p": "2.0.0-nightly.20250813",
|
|
44
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250813",
|
|
45
|
+
"@aztec/prover-client": "2.0.0-nightly.20250813",
|
|
46
|
+
"@aztec/simulator": "2.0.0-nightly.20250813",
|
|
47
|
+
"@aztec/slasher": "2.0.0-nightly.20250813",
|
|
48
|
+
"@aztec/stdlib": "2.0.0-nightly.20250813",
|
|
49
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250813",
|
|
50
|
+
"@aztec/validator-client": "2.0.0-nightly.20250813",
|
|
51
|
+
"@aztec/world-state": "2.0.0-nightly.20250813",
|
|
52
52
|
"lodash.chunk": "^4.2.0",
|
|
53
53
|
"lodash.pick": "^4.4.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "2.23.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "
|
|
59
|
-
"@aztec/kv-store": "
|
|
58
|
+
"@aztec/archiver": "2.0.0-nightly.20250813",
|
|
59
|
+
"@aztec/kv-store": "2.0.0-nightly.20250813",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -79,7 +79,7 @@ export class SequencerClient {
|
|
|
79
79
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
80
80
|
const log = createLogger('sequencer-client');
|
|
81
81
|
const l1Client = createExtendedL1Client(rpcUrls, publisherPrivateKey.getValue(), chain.chainInfo);
|
|
82
|
-
const l1TxUtils = deps.l1TxUtils ?? new L1TxUtilsWithBlobs(l1Client, log, config);
|
|
82
|
+
const l1TxUtils = deps.l1TxUtils ?? new L1TxUtilsWithBlobs(l1Client, log, deps.dateProvider, config);
|
|
83
83
|
const rollupContract = new RollupContract(l1Client, config.l1Contracts.rollupAddress.toString());
|
|
84
84
|
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
85
85
|
rollupContract.getL1GenesisTime(),
|
|
@@ -117,6 +117,7 @@ export class SequencerClient {
|
|
|
117
117
|
epochCache,
|
|
118
118
|
governanceProposerContract,
|
|
119
119
|
slashingProposerContract,
|
|
120
|
+
dateProvider: deps.dateProvider,
|
|
120
121
|
});
|
|
121
122
|
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
122
123
|
|
|
@@ -131,14 +132,14 @@ export class SequencerClient {
|
|
|
131
132
|
sequencerManaLimit = rollupManaLimit;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
// When running in anvil, assume we can post a tx up until
|
|
135
|
+
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
135
136
|
// Otherwise, assume we must have broadcasted the tx before the slot started (we use a default
|
|
136
137
|
// maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
|
|
137
138
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
138
139
|
// make it with a propagation time into slot equal to 4s. However, we prefer being conservative.
|
|
139
140
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
140
141
|
const maxL1TxInclusionTimeIntoSlot =
|
|
141
|
-
(config.maxL1TxInclusionTimeIntoSlot ?? isAnvilTestChain(config.l1ChainId)) ? ethereumSlotDuration : 0;
|
|
142
|
+
(config.maxL1TxInclusionTimeIntoSlot ?? isAnvilTestChain(config.l1ChainId)) ? ethereumSlotDuration - 1 : 0;
|
|
142
143
|
|
|
143
144
|
const l1Constants = {
|
|
144
145
|
l1GenesisTime,
|
|
@@ -185,11 +186,6 @@ export class SequencerClient {
|
|
|
185
186
|
await this.sequencer.stop();
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
/** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
|
|
189
|
-
public flush() {
|
|
190
|
-
this.sequencer.flush();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
189
|
/**
|
|
194
190
|
* Restarts the sequencer after being stopped.
|
|
195
191
|
*/
|
package/src/config.ts
CHANGED
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
export * from './publisher/config.js';
|
|
28
28
|
export type { SequencerConfig };
|
|
29
29
|
|
|
30
|
+
export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* Configuration settings for the SequencerClient.
|
|
32
34
|
*/
|
|
@@ -110,6 +112,37 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
110
112
|
description: 'How many seconds into an L1 slot we can still send a tx and get it mined.',
|
|
111
113
|
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
112
114
|
},
|
|
115
|
+
attestationPropagationTime: {
|
|
116
|
+
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
117
|
+
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
|
|
118
|
+
...numberConfigHelper(DEFAULT_ATTESTATION_PROPAGATION_TIME),
|
|
119
|
+
},
|
|
120
|
+
fakeProcessingDelayPerTxMs: {
|
|
121
|
+
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
122
|
+
},
|
|
123
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember: {
|
|
124
|
+
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
|
|
125
|
+
description:
|
|
126
|
+
'How many seconds to wait before trying to invalidate a block from the pending chain as a committee member (zero to never invalidate).' +
|
|
127
|
+
' The next proposer is expected to invalidate, so the committee acts as a fallback.',
|
|
128
|
+
...numberConfigHelper(144), // 12 L1 blocks
|
|
129
|
+
},
|
|
130
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
|
|
131
|
+
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
|
|
132
|
+
description:
|
|
133
|
+
'How many seconds to wait before trying to invalidate a block from the pending chain as a non-committee member (zero to never invalidate).' +
|
|
134
|
+
' The next proposer is expected to invalidate, then the committee, so other sequencers act as a fallback.',
|
|
135
|
+
...numberConfigHelper(432), // 36 L1 blocks
|
|
136
|
+
},
|
|
137
|
+
skipCollectingAttestations: {
|
|
138
|
+
description:
|
|
139
|
+
'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
|
|
140
|
+
...booleanConfigHelper(false),
|
|
141
|
+
},
|
|
142
|
+
skipInvalidateBlockAsProposer: {
|
|
143
|
+
description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
|
|
144
|
+
...booleanConfigHelper(false),
|
|
145
|
+
},
|
|
113
146
|
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
|
|
114
147
|
};
|
|
115
148
|
|
package/src/publisher/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SequencerPublisher } from './sequencer-publisher.js';
|
|
1
|
+
export { SequencerPublisher, SignalType } from './sequencer-publisher.js';
|