@aztec/sequencer-client 6.0.0-nightly.20260604 → 6.0.0-nightly.20260721
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/README.md +27 -27
- package/dest/client/sequencer-client.d.ts +16 -3
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +17 -12
- package/dest/config.d.ts +6 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +23 -14
- package/dest/global_variable_builder/fee_predictor.d.ts +1 -1
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -1
- package/dest/global_variable_builder/fee_predictor.js +11 -1
- package/dest/global_variable_builder/fee_provider.d.ts +1 -1
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -1
- package/dest/global_variable_builder/fee_provider.js +27 -5
- package/dest/global_variable_builder/global_builder.d.ts +3 -16
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +2 -25
- 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 +5 -1
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +11 -1
- package/dest/publisher/l1_to_l2_messaging.d.ts +21 -0
- package/dest/publisher/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/publisher/l1_to_l2_messaging.js +70 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +48 -8
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +68 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +2 -2
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +4 -2
- package/dest/publisher/l1_tx_failed_store/index.d.ts +2 -2
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/index.js +1 -0
- package/dest/publisher/sequencer-publisher.d.ts +34 -6
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +364 -60
- package/dest/publisher/write_json.d.ts +11 -0
- package/dest/publisher/write_json.d.ts.map +1 -0
- package/dest/publisher/write_json.js +57 -0
- package/dest/sequencer/automine/automine_factory.d.ts +5 -3
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -1
- package/dest/sequencer/automine/automine_factory.js +2 -1
- package/dest/sequencer/automine/automine_sequencer.d.ts +43 -5
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -1
- package/dest/sequencer/automine/automine_sequencer.js +199 -18
- package/dest/sequencer/automine/index.d.ts +3 -0
- package/dest/sequencer/automine/index.d.ts.map +1 -0
- package/dest/sequencer/automine/index.js +2 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +28 -15
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +140 -96
- package/dest/sequencer/events.d.ts +16 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/index.d.ts +1 -3
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +0 -2
- package/dest/sequencer/requests_tracker.d.ts +22 -0
- package/dest/sequencer/requests_tracker.d.ts.map +1 -0
- package/dest/sequencer/requests_tracker.js +33 -0
- package/dest/sequencer/sequencer.d.ts +110 -36
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +330 -174
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/utils.d.ts +15 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +18 -1
- package/package.json +30 -28
- package/src/client/sequencer-client.ts +20 -13
- package/src/config.ts +25 -12
- package/src/global_variable_builder/fee_predictor.ts +11 -1
- package/src/global_variable_builder/fee_provider.ts +27 -5
- package/src/global_variable_builder/global_builder.ts +2 -34
- package/src/index.ts +1 -10
- package/src/publisher/config.ts +22 -1
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +114 -7
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +4 -3
- package/src/publisher/l1_tx_failed_store/index.ts +1 -1
- package/src/publisher/sequencer-publisher.ts +385 -71
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/automine/README.md +18 -4
- package/src/sequencer/automine/automine_factory.ts +8 -1
- package/src/sequencer/automine/automine_sequencer.ts +221 -20
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +163 -111
- package/src/sequencer/events.ts +16 -4
- package/src/sequencer/index.ts +0 -2
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +361 -187
- package/src/test/index.ts +2 -2
- package/src/test/utils.ts +33 -0
- package/dest/sequencer/chain_state_overrides.d.ts +0 -61
- package/dest/sequencer/chain_state_overrides.d.ts.map +0 -1
- package/dest/sequencer/chain_state_overrides.js +0 -98
- package/dest/sequencer/timetable.d.ts +0 -98
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -227
- package/src/sequencer/chain_state_overrides.ts +0 -162
- package/src/sequencer/timetable.ts +0 -288
|
@@ -33,7 +33,7 @@ export type CreateAutomineSequencerArgs = {
|
|
|
33
33
|
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
34
34
|
globalVariableBuilder: GlobalVariableBuilder;
|
|
35
35
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
36
|
-
archiver: L2BlockSource & L1ToL2MessageSource & Pick<Archiver, 'rollbackTo' | 'addBlock' | 'addProposedCheckpoint' | 'syncImmediate'>;
|
|
36
|
+
archiver: L2BlockSource & L1ToL2MessageSource & Pick<Archiver, 'rollbackTo' | 'addBlock' | 'addProposedCheckpoint' | 'syncImmediate' | 'removeUncheckpointedBlocksAfter'>;
|
|
37
37
|
p2pClient: P2P & Pick<ConcreteP2PClient, 'sync'>;
|
|
38
38
|
l1Constants: {
|
|
39
39
|
l1GenesisTime: bigint;
|
|
@@ -41,6 +41,8 @@ export type CreateAutomineSequencerArgs = {
|
|
|
41
41
|
ethereumSlotDuration: number;
|
|
42
42
|
rollupManaLimit: number;
|
|
43
43
|
};
|
|
44
|
+
/** When true, run the auto-settle / clock-reconcile loop (local-network only). */
|
|
45
|
+
autoSettle?: boolean;
|
|
44
46
|
log: Logger;
|
|
45
47
|
};
|
|
46
48
|
/**
|
|
@@ -50,5 +52,5 @@ export type CreateAutomineSequencerArgs = {
|
|
|
50
52
|
* looks up the attestor/coinbase/feeRecipient from the keystore, wires EthCheatCodes,
|
|
51
53
|
* and starts the publisher manager before returning.
|
|
52
54
|
*/
|
|
53
|
-
export declare function createAutomineSequencer({ config, l1TxUtils, funderL1TxUtils, publicClient, rollupContract, epochCache, blobClient, telemetry, dateProvider, keyStoreManager, validatorClient, checkpointsBuilder, globalVariableBuilder, worldStateSynchronizer, archiver, p2pClient, l1Constants, log }: CreateAutomineSequencerArgs): Promise<AutomineSequencer>;
|
|
54
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
55
|
+
export declare function createAutomineSequencer({ config, l1TxUtils, funderL1TxUtils, publicClient, rollupContract, epochCache, blobClient, telemetry, dateProvider, keyStoreManager, validatorClient, checkpointsBuilder, globalVariableBuilder, worldStateSynchronizer, archiver, p2pClient, l1Constants, autoSettle, log }: CreateAutomineSequencerArgs): Promise<AutomineSequencer>;
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b21pbmVfZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NlcXVlbmNlci9hdXRvbWluZS9hdXRvbWluZV9mYWN0b3J5Ln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AAC;QAAC,oBAAoB,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;IACpH,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,MAAM,EACN,SAAS,EACT,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,GAAG,EACJ,EAAE,2BAA2B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuE1D"}
|
|
@@ -11,7 +11,7 @@ import { AutomineSequencer } from './automine_sequencer.js';
|
|
|
11
11
|
* Constructs the PublisherManager, GovernanceProposerContract, SequencerPublisherFactory,
|
|
12
12
|
* looks up the attestor/coinbase/feeRecipient from the keystore, wires EthCheatCodes,
|
|
13
13
|
* and starts the publisher manager before returning.
|
|
14
|
-
*/ export async function createAutomineSequencer({ config, l1TxUtils, funderL1TxUtils, publicClient, rollupContract, epochCache, blobClient, telemetry, dateProvider, keyStoreManager, validatorClient, checkpointsBuilder, globalVariableBuilder, worldStateSynchronizer, archiver, p2pClient, l1Constants, log }) {
|
|
14
|
+
*/ export async function createAutomineSequencer({ config, l1TxUtils, funderL1TxUtils, publicClient, rollupContract, epochCache, blobClient, telemetry, dateProvider, keyStoreManager, validatorClient, checkpointsBuilder, globalVariableBuilder, worldStateSynchronizer, archiver, p2pClient, l1Constants, autoSettle, log }) {
|
|
15
15
|
const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), {
|
|
16
16
|
bindings: log.getBindings(),
|
|
17
17
|
funder: funderL1TxUtils
|
|
@@ -76,6 +76,7 @@ import { AutomineSequencer } from './automine_sequencer.js';
|
|
|
76
76
|
config,
|
|
77
77
|
archiver,
|
|
78
78
|
l1TxUtils: reorgResetL1TxUtils,
|
|
79
|
+
autoSettle,
|
|
79
80
|
stopExtras: ()=>publisherManager.stop(),
|
|
80
81
|
log: log.createChild('automine-sequencer')
|
|
81
82
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Archiver } from '@aztec/archiver';
|
|
2
2
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
3
|
-
import type
|
|
3
|
+
import { type EthCheatCodes } from '@aztec/ethereum/test';
|
|
4
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
6
7
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
@@ -42,7 +43,7 @@ export type AutomineSequencerDeps = {
|
|
|
42
43
|
* Archiver used to push locally-built blocks and proposed checkpoints into the in-memory
|
|
43
44
|
* store, force an immediate L1 sync after publishing, and roll back state during reorgs.
|
|
44
45
|
*/
|
|
45
|
-
archiver: Pick<Archiver, 'rollbackTo' | 'addBlock' | 'addProposedCheckpoint' | 'syncImmediate'>;
|
|
46
|
+
archiver: Pick<Archiver, 'rollbackTo' | 'addBlock' | 'addProposedCheckpoint' | 'syncImmediate' | 'removeUncheckpointedBlocksAfter'>;
|
|
46
47
|
/** L1 tx utils whose cached nonces must be reset after an L1 reorg. */
|
|
47
48
|
l1TxUtils: Pick<L1TxUtils, 'resetNonce'>[];
|
|
48
49
|
/**
|
|
@@ -52,6 +53,14 @@ export type AutomineSequencerDeps = {
|
|
|
52
53
|
stopExtras?: () => Promise<void>;
|
|
53
54
|
/** How often to poll the mempool for new txs while running. Defaults to 50ms. */
|
|
54
55
|
pollIntervalMs?: number;
|
|
56
|
+
/**
|
|
57
|
+
* When true, run a loop that synthetically settles epochs (writes outbox roots and advances the
|
|
58
|
+
* proven tip) as checkpoints land, replacing the standalone `EpochTestSettler`. Local-network only;
|
|
59
|
+
* e2e tests leave this off and drive proving explicitly.
|
|
60
|
+
*/
|
|
61
|
+
autoSettle?: boolean;
|
|
62
|
+
/** How often the auto-settle / clock-reconcile loop runs while {@link autoSettle} is enabled. Defaults to 200ms. */
|
|
63
|
+
settlePollIntervalMs?: number;
|
|
55
64
|
log?: Logger;
|
|
56
65
|
};
|
|
57
66
|
/**
|
|
@@ -81,13 +90,19 @@ export declare class AutomineSequencer {
|
|
|
81
90
|
private stopped;
|
|
82
91
|
private paused;
|
|
83
92
|
private mempoolPoller?;
|
|
93
|
+
/** Loop that settles epochs and reconciles the clock while {@link AutomineSequencerDeps.autoSettle} is set. */
|
|
94
|
+
private settler?;
|
|
84
95
|
private publisher?;
|
|
85
96
|
private attestorAddress?;
|
|
86
97
|
/** Set while a mempool-driven build is queued but not yet run; used to coalesce. */
|
|
87
98
|
private buildQueued;
|
|
88
99
|
/** Last L2 slot we published a checkpoint for (-1 means none yet). */
|
|
89
100
|
private lastBuiltSlot;
|
|
101
|
+
/** Lazily-built cheat codes for synthetic epoch settlement (outbox roots + proven tip). */
|
|
102
|
+
private rollupCheatCodes?;
|
|
90
103
|
constructor(deps: AutomineSequencerDeps);
|
|
104
|
+
/** Cheat codes for the rollup, built from the same EthCheatCodes the sequencer uses for time control. */
|
|
105
|
+
private getRollupCheatCodes;
|
|
91
106
|
/**
|
|
92
107
|
* Starts the sequencer. Switches anvil into automine mode (no interval mining),
|
|
93
108
|
* acquires a publisher, and begins polling the mempool for pending txs.
|
|
@@ -126,10 +141,15 @@ export declare class AutomineSequencer {
|
|
|
126
141
|
/**
|
|
127
142
|
* Warps L1 timestamp to `targetTimestampSec`. Rounded up to the next aztec-slot
|
|
128
143
|
* boundary so the next build lands on a fresh slot. Atomic with respect to builds —
|
|
129
|
-
* the queue ensures no build is in flight while the warp executes.
|
|
144
|
+
* the queue ensures no build is in flight while the warp executes. A no-op when the
|
|
145
|
+
* target is already at or behind the current L1 time (see {@link runWarp}).
|
|
130
146
|
*/
|
|
131
147
|
warpTo(targetTimestampSec: number): Promise<void>;
|
|
132
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Warps L1 timestamp forward by `deltaSec` seconds from the current L1 time, rounded up to the next
|
|
150
|
+
* aztec-slot boundary. Throws if `deltaSec` is not positive (warping "by" a non-positive amount is a
|
|
151
|
+
* caller bug — unlike {@link warpTo}, which no-ops on a past target).
|
|
152
|
+
*/
|
|
133
153
|
warpBy(deltaSec: number): Promise<void>;
|
|
134
154
|
/**
|
|
135
155
|
* Reorgs L1 so that every L1 block strictly after the one that published
|
|
@@ -141,11 +161,29 @@ export declare class AutomineSequencer {
|
|
|
141
161
|
revertToCheckpoint(targetCheckpoint: number): Promise<void>;
|
|
142
162
|
/** Awaits the queue draining to a fully idle state. */
|
|
143
163
|
syncPoint(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Synthetically "proves" the L2 chain up to `upToCheckpoint` (default: the latest checkpointed
|
|
166
|
+
* checkpoint). For every epoch newly covered — including a partial final epoch — the epoch out hash
|
|
167
|
+
* is written into the L1 Outbox so the L2-to-L1 messages in those checkpoints become consumable,
|
|
168
|
+
* then the rollup's proven tip is advanced to the target. There is no real proof; this is the
|
|
169
|
+
* local-network equivalent of an epoch proof landing on L1.
|
|
170
|
+
*
|
|
171
|
+
* Clamps the target down to the latest checkpointed checkpoint and no-ops when it is already proven.
|
|
172
|
+
* Runs inside the serial queue so it never interleaves with a build or warp.
|
|
173
|
+
*
|
|
174
|
+
* @returns The proven checkpoint after the call (the target, or the existing proven tip on no-op).
|
|
175
|
+
*/
|
|
176
|
+
prove(upToCheckpoint?: CheckpointNumber): Promise<CheckpointNumber>;
|
|
177
|
+
private maybeSettle;
|
|
178
|
+
private reconcileDateProvider;
|
|
144
179
|
private maybeEnqueueBuild;
|
|
145
180
|
private runBuild;
|
|
181
|
+
private rollbackOptimisticInsert;
|
|
146
182
|
private runWarp;
|
|
147
183
|
private runRevert;
|
|
184
|
+
private runProve;
|
|
185
|
+
private getEpochOfCheckpoint;
|
|
148
186
|
private tryBuildBlock;
|
|
149
187
|
private dropFailedTxsFromP2P;
|
|
150
188
|
}
|
|
151
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
189
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b21pbmVfc2VxdWVuY2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2VxdWVuY2VyL2F1dG9taW5lL2F1dG9taW5lX3NlcXVlbmNlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUNoRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUM3RCxPQUFPLEVBQUUsS0FBSyxhQUFhLEVBQW9CLE1BQU0sc0JBQXNCLENBQUM7QUFDNUUsT0FBTyxFQUFlLGdCQUFnQixFQUEyQixNQUFNLGlDQUFpQyxDQUFDO0FBQ3pHLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRWhFLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUdsRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRWhFLE9BQU8sS0FBSyxFQUFFLFNBQVMsSUFBSSxpQkFBaUIsRUFBRSxHQUFHLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFdEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxFQUFtQyxLQUFLLE9BQU8sRUFBRSxLQUFLLGFBQWEsRUFBRSxNQUFNLHFCQU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ine_sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"automine_sequencer.d.ts","sourceRoot":"","sources":["../../../src/sequencer/automine/automine_sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAe,gBAAgB,EAA2B,MAAM,iCAAiC,CAAC;AACzG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAmC,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAExG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAA6B,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAGV,0BAA0B,EAC3B,MAAM,yBAAyB,CAA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AAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAE1D;IAED,6FAA6F;IACtF,SAAS,IAAI,eAAe,CAElC;IAED,kEAAkE;IAC3D,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAQzC;IAED;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ7C;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,uDAAuD;IAChD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEzE;YAOa,WAAW;YAgBX,qBAAqB;YAQrB,iBAAiB;YAyBjB,QAAQ;YA4LR,wBAAwB;YAaxB,OAAO;YAyBP,SAAS;YA2DT,QAAQ;YA6DR,oBAAoB;YAcpB,aAAa;YA2Cb,oBAAoB;CAQnC"}
|
|
@@ -63,12 +63,14 @@ function _ts_dispose_resources(env) {
|
|
|
63
63
|
return next();
|
|
64
64
|
})(env);
|
|
65
65
|
}
|
|
66
|
-
import {
|
|
66
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
67
|
+
import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
67
68
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
68
69
|
import { createLogger } from '@aztec/foundation/log';
|
|
69
70
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
70
71
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
71
72
|
import { isErrorClass } from '@aztec/foundation/types';
|
|
73
|
+
import { settleEpochOutbox } from '@aztec/prover-client/test';
|
|
72
74
|
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
73
75
|
import { getPreviousCheckpointOutHashes } from '@aztec/stdlib/checkpoint';
|
|
74
76
|
import { getEpochAtSlot, getSlotAtTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
@@ -99,16 +101,24 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
99
101
|
stopped = false;
|
|
100
102
|
paused = false;
|
|
101
103
|
mempoolPoller;
|
|
104
|
+
/** Loop that settles epochs and reconciles the clock while {@link AutomineSequencerDeps.autoSettle} is set. */ settler;
|
|
102
105
|
publisher;
|
|
103
106
|
attestorAddress;
|
|
104
107
|
/** Set while a mempool-driven build is queued but not yet run; used to coalesce. */ buildQueued = undefined;
|
|
105
108
|
/** Last L2 slot we published a checkpoint for (-1 means none yet). */ lastBuiltSlot = -1;
|
|
109
|
+
/** Lazily-built cheat codes for synthetic epoch settlement (outbox roots + proven tip). */ rollupCheatCodes;
|
|
106
110
|
constructor(deps){
|
|
107
111
|
this.deps = deps;
|
|
108
112
|
this.log = deps.log ?? createLogger('sequencer:automine');
|
|
109
113
|
this.queue = new SerialQueue();
|
|
110
114
|
this.pollIntervalMs = deps.pollIntervalMs ?? 50;
|
|
111
115
|
}
|
|
116
|
+
/** Cheat codes for the rollup, built from the same EthCheatCodes the sequencer uses for time control. */ getRollupCheatCodes() {
|
|
117
|
+
this.rollupCheatCodes ??= new RollupCheatCodes(this.deps.ethCheatCodes, {
|
|
118
|
+
rollupAddress: this.deps.config.rollupAddress
|
|
119
|
+
});
|
|
120
|
+
return this.rollupCheatCodes;
|
|
121
|
+
}
|
|
112
122
|
/**
|
|
113
123
|
* Starts the sequencer. Switches anvil into automine mode (no interval mining),
|
|
114
124
|
* acquires a publisher, and begins polling the mempool for pending txs.
|
|
@@ -135,6 +145,12 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
135
145
|
// notification. Tests can also call `buildIfPending()` directly to skip the poll wait.
|
|
136
146
|
this.mempoolPoller = new RunningPromise(()=>this.maybeEnqueueBuild(), this.log, this.pollIntervalMs);
|
|
137
147
|
this.mempoolPoller.start();
|
|
148
|
+
// Local-network only: settle epochs and reconcile the clock to L1 as checkpoints land. Both run
|
|
149
|
+
// through the same serial queue as builds/warps, so they never interleave with a checkpoint build.
|
|
150
|
+
if (this.deps.autoSettle) {
|
|
151
|
+
this.settler = new RunningPromise(()=>this.maybeSettle(), this.log, this.deps.settlePollIntervalMs ?? 200);
|
|
152
|
+
this.settler.start();
|
|
153
|
+
}
|
|
138
154
|
}
|
|
139
155
|
/**
|
|
140
156
|
* Stops the sequencer. Drains the queue, unsubscribes the mempool poller, and runs any
|
|
@@ -147,6 +163,7 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
147
163
|
this.stopped = true;
|
|
148
164
|
this.running = false;
|
|
149
165
|
await this.mempoolPoller?.stop();
|
|
166
|
+
await this.settler?.stop();
|
|
150
167
|
await this.queue.end();
|
|
151
168
|
await this.deps.stopExtras?.();
|
|
152
169
|
this.log.info('AutomineSequencer stopped');
|
|
@@ -216,11 +233,19 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
216
233
|
/**
|
|
217
234
|
* Warps L1 timestamp to `targetTimestampSec`. Rounded up to the next aztec-slot
|
|
218
235
|
* boundary so the next build lands on a fresh slot. Atomic with respect to builds —
|
|
219
|
-
* the queue ensures no build is in flight while the warp executes.
|
|
236
|
+
* the queue ensures no build is in flight while the warp executes. A no-op when the
|
|
237
|
+
* target is already at or behind the current L1 time (see {@link runWarp}).
|
|
220
238
|
*/ warpTo(targetTimestampSec) {
|
|
221
239
|
return this.queue.put(()=>this.runWarp(targetTimestampSec));
|
|
222
240
|
}
|
|
223
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Warps L1 timestamp forward by `deltaSec` seconds from the current L1 time, rounded up to the next
|
|
243
|
+
* aztec-slot boundary. Throws if `deltaSec` is not positive (warping "by" a non-positive amount is a
|
|
244
|
+
* caller bug — unlike {@link warpTo}, which no-ops on a past target).
|
|
245
|
+
*/ warpBy(deltaSec) {
|
|
246
|
+
if (deltaSec <= 0) {
|
|
247
|
+
throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${deltaSec} seconds.`);
|
|
248
|
+
}
|
|
224
249
|
return this.queue.put(async ()=>{
|
|
225
250
|
const current = await this.deps.ethCheatCodes.lastBlockTimestamp();
|
|
226
251
|
await this.runWarp(current + deltaSec);
|
|
@@ -238,13 +263,52 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
238
263
|
/** Awaits the queue draining to a fully idle state. */ syncPoint() {
|
|
239
264
|
return this.queue.syncPoint();
|
|
240
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Synthetically "proves" the L2 chain up to `upToCheckpoint` (default: the latest checkpointed
|
|
268
|
+
* checkpoint). For every epoch newly covered — including a partial final epoch — the epoch out hash
|
|
269
|
+
* is written into the L1 Outbox so the L2-to-L1 messages in those checkpoints become consumable,
|
|
270
|
+
* then the rollup's proven tip is advanced to the target. There is no real proof; this is the
|
|
271
|
+
* local-network equivalent of an epoch proof landing on L1.
|
|
272
|
+
*
|
|
273
|
+
* Clamps the target down to the latest checkpointed checkpoint and no-ops when it is already proven.
|
|
274
|
+
* Runs inside the serial queue so it never interleaves with a build or warp.
|
|
275
|
+
*
|
|
276
|
+
* @returns The proven checkpoint after the call (the target, or the existing proven tip on no-op).
|
|
277
|
+
*/ prove(upToCheckpoint) {
|
|
278
|
+
return this.queue.put(()=>this.runProve(upToCheckpoint));
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Auto-settle tick (local-network only). Proving up to the latest checkpointed checkpoint also
|
|
282
|
+
* reconciles the clock at the head of {@link runProve}, so this single tick keeps both the
|
|
283
|
+
* proven tip and the date provider current even when no build is happening.
|
|
284
|
+
*/ async maybeSettle() {
|
|
285
|
+
if (!this.running) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
await this.prove();
|
|
290
|
+
} catch (err) {
|
|
291
|
+
this.log.warn('Automine auto-settle tick failed', {
|
|
292
|
+
err: err instanceof Error ? err.message : String(err)
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Advances the injected date provider to the latest *mined* L1 timestamp when it has fallen behind
|
|
298
|
+
* (e.g. an unrelated L1 tx mined a block between our builds). Never advances to the pending, un-mined
|
|
299
|
+
* timestamp. Keeps node-side consumers of `dateProvider.now()` aligned with L1 without our own builds.
|
|
300
|
+
*/ async reconcileDateProvider() {
|
|
301
|
+
const lastTsMs = await this.deps.ethCheatCodes.lastBlockTimestamp() * 1000;
|
|
302
|
+
if (lastTsMs > this.deps.dateProvider.now()) {
|
|
303
|
+
this.deps.dateProvider.setTime(lastTsMs);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
241
306
|
/** Called from the mempool poller. Enqueues a build if there are pending txs. */ async maybeEnqueueBuild() {
|
|
242
307
|
if (!this.running || this.paused || this.buildQueued) {
|
|
243
308
|
return;
|
|
244
309
|
}
|
|
245
310
|
try {
|
|
246
|
-
|
|
247
|
-
if (pending > 0) {
|
|
311
|
+
if (await this.deps.p2pClient.hasEligiblePendingTxs(1)) {
|
|
248
312
|
// Fire-and-forget; the build result is delivered via `buildIfPending()` callers,
|
|
249
313
|
// not via the poller.
|
|
250
314
|
void this.buildIfPending().catch((err)=>{
|
|
@@ -257,7 +321,14 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
257
321
|
});
|
|
258
322
|
}
|
|
259
323
|
}
|
|
260
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* Builds and publishes one checkpoint, returning the built block — or `undefined` when there was
|
|
326
|
+
* nothing to build or the propose failed. A failed propose mines no checkpoint on L1 (it reverts
|
|
327
|
+
* inside the multicall or is never sent), so recovery is purely local: the optimistic archiver insert
|
|
328
|
+
* is rolled back, the block's txs return to the pending pool, and the L1 nonce is reset. No L1 reorg
|
|
329
|
+
* is performed, and the build is not retried inline — once the txs are back in the pending pool the
|
|
330
|
+
* mempool poller re-enqueues a build on its next tick (see {@link maybeEnqueueBuild}).
|
|
331
|
+
*/ async runBuild({ allowEmpty }) {
|
|
261
332
|
const env = {
|
|
262
333
|
stack: [],
|
|
263
334
|
error: void 0,
|
|
@@ -267,13 +338,14 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
267
338
|
if (!this.running || !this.publisher || !this.attestorAddress) {
|
|
268
339
|
return undefined;
|
|
269
340
|
}
|
|
270
|
-
|
|
271
|
-
// For mempool-driven builds, wait for at least `minTxsPerBlock`
|
|
341
|
+
await this.reconcileDateProvider();
|
|
342
|
+
// For mempool-driven builds, wait for at least `minTxsPerBlock` age-eligible txs (or 1 if not set)
|
|
272
343
|
// before building. This mirrors the production sequencer's `waitForMinTxs` behavior, and is
|
|
273
344
|
// required for tests that bundle multiple txs into one block via `setConfig({ minTxsPerBlock })`.
|
|
274
|
-
// Explicit empty-block / warp paths pass `allowEmpty: true
|
|
345
|
+
// Explicit empty-block / warp paths pass `allowEmpty: true`, giving minRequired 0, which
|
|
346
|
+
// hasEligiblePendingTxs treats as always satisfied so the gate is bypassed.
|
|
275
347
|
const minRequired = allowEmpty ? 0 : Math.max(this.deps.config.minTxsPerBlock ?? 1, 1);
|
|
276
|
-
if (
|
|
348
|
+
if (!await this.deps.p2pClient.hasEligiblePendingTxs(minRequired)) {
|
|
277
349
|
return undefined;
|
|
278
350
|
}
|
|
279
351
|
// Decide target slot from the pending block's timestamp — picks up any prior
|
|
@@ -292,7 +364,10 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
292
364
|
if (slotBoundaryTs > pendingBlockTs) {
|
|
293
365
|
await this.deps.ethCheatCodes.setNextBlockTimestamp(slotBoundaryTs);
|
|
294
366
|
}
|
|
295
|
-
const tips = await
|
|
367
|
+
const [tips, proposedCheckpoint] = await Promise.all([
|
|
368
|
+
this.deps.l2BlockSource.getL2Tips(),
|
|
369
|
+
this.deps.l2BlockSource.getProposedCheckpointData()
|
|
370
|
+
]);
|
|
296
371
|
const syncedToBlockNumber = tips.proposed.number;
|
|
297
372
|
// Ensure world state has processed the archiver's tip before forking. Without this,
|
|
298
373
|
// world state may still be at the previous block (since it syncs asynchronously from
|
|
@@ -300,14 +375,14 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
300
375
|
// "Unable to initialize from future block".
|
|
301
376
|
await this.deps.worldState.syncImmediate(BlockNumber(syncedToBlockNumber));
|
|
302
377
|
const nextBlockNumber = BlockNumber(syncedToBlockNumber + 1);
|
|
303
|
-
const
|
|
378
|
+
const parentCheckpointNumber = proposedCheckpoint?.checkpointNumber ?? tips.checkpointed.checkpoint.number;
|
|
379
|
+
const checkpointNumber = CheckpointNumber(parentCheckpointNumber + 1);
|
|
304
380
|
const targetEpoch = getEpochAtSlot(SlotNumber(targetSlot), this.deps.l1Constants);
|
|
305
381
|
this.log.verbose(`Building automine checkpoint`, {
|
|
306
382
|
checkpointNumber,
|
|
307
383
|
blockNumber: nextBlockNumber,
|
|
308
384
|
slot: targetSlot,
|
|
309
385
|
slotTimestamp: slotBoundaryTs,
|
|
310
|
-
txCount,
|
|
311
386
|
allowEmpty
|
|
312
387
|
});
|
|
313
388
|
const checkpointGlobals = await this.deps.globalsBuilder.buildCheckpointGlobalVariables(this.deps.coinbase, this.deps.feeRecipient, SlotNumber(targetSlot));
|
|
@@ -325,7 +400,10 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
325
400
|
closeDelayMs: 0
|
|
326
401
|
}), true);
|
|
327
402
|
const checkpointBuilder = await this.deps.checkpointsBuilder.startCheckpoint(checkpointNumber, checkpointGlobals, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, this.log.getBindings());
|
|
328
|
-
|
|
403
|
+
// Block building only executes txs, and automine publishes straight to L1, so the proofs are never needed.
|
|
404
|
+
const pendingTxs = this.deps.p2pClient.iterateEligiblePendingTxs({
|
|
405
|
+
includeProof: false
|
|
406
|
+
});
|
|
329
407
|
const buildResult = await this.tryBuildBlock(checkpointBuilder, pendingTxs, nextBlockNumber, checkpointGlobals.timestamp, allowEmpty, checkpointNumber);
|
|
330
408
|
if (!buildResult) {
|
|
331
409
|
return undefined;
|
|
@@ -354,15 +432,16 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
354
432
|
// production `sendRequestsAt` (or `canProposeAt`), which always apply the one-slot pipelining
|
|
355
433
|
// offset — automine is the deliberate non-pipelined exception and builds/publishes in place.
|
|
356
434
|
const result = await this.publisher.sendRequests(SlotNumber(targetSlot));
|
|
357
|
-
const
|
|
358
|
-
if (!
|
|
359
|
-
this.log.
|
|
435
|
+
const proposeSucceeded = !!result?.successfulActions?.some((action)=>action === 'propose');
|
|
436
|
+
if (!proposeSucceeded) {
|
|
437
|
+
this.log.warn('Automine propose did not succeed; rolled back optimistic insert, will rebuild from the poller', {
|
|
360
438
|
slot: targetSlot,
|
|
361
439
|
checkpointNumber,
|
|
362
440
|
successful: result?.successfulActions,
|
|
363
441
|
failed: result?.failedActions
|
|
364
442
|
});
|
|
365
|
-
|
|
443
|
+
await this.rollbackOptimisticInsert(syncedToBlockNumber);
|
|
444
|
+
return undefined;
|
|
366
445
|
}
|
|
367
446
|
// Force one full L1-sync cycle synchronously. The local addBlock/addProposedCheckpoint
|
|
368
447
|
// above advances the proposed tip, but tips.checkpointed and the L1->L2 inbox tree state
|
|
@@ -371,6 +450,16 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
371
450
|
// Sync the date provider to the L1 block timestamp we just mined.
|
|
372
451
|
const newL1Ts = await this.deps.ethCheatCodes.lastBlockTimestamp();
|
|
373
452
|
this.deps.dateProvider.setTime(newL1Ts * 1000);
|
|
453
|
+
// A successful propose is validated on-chain against the mined L1 block's slot, so the mined slot
|
|
454
|
+
// should equal our target; warn (without rolling back — the checkpoint is on L1) if it ever differs.
|
|
455
|
+
const minedSlot = Number(getSlotAtTimestamp(BigInt(newL1Ts), this.deps.l1Constants));
|
|
456
|
+
if (minedSlot !== targetSlot) {
|
|
457
|
+
this.log.warn(`Automine checkpoint mined in slot ${minedSlot} but targeted ${targetSlot}`, {
|
|
458
|
+
minedSlot,
|
|
459
|
+
targetSlot,
|
|
460
|
+
checkpointNumber
|
|
461
|
+
});
|
|
462
|
+
}
|
|
374
463
|
this.lastBuiltSlot = targetSlot;
|
|
375
464
|
this.log.verbose(`Automine checkpoint published`, {
|
|
376
465
|
checkpointNumber,
|
|
@@ -389,11 +478,27 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
389
478
|
}
|
|
390
479
|
}
|
|
391
480
|
/**
|
|
481
|
+
* Undoes an optimistic archiver insert (uncheckpointed block + proposed checkpoint) without reorging
|
|
482
|
+
* L1: removes the uncheckpointed block and evicts the proposed checkpoint that referenced it, so the
|
|
483
|
+
* proposed tip drops back to `toBlockNumber`. `p2pClient.sync()` then observes the lowered tip and
|
|
484
|
+
* restores the block's txs to the pending pool; `worldState.syncImmediate()` drops any applied effects;
|
|
485
|
+
* and the L1 nonce is reset (a reverted-but-mined propose consumes one) so the build can be retried.
|
|
486
|
+
*
|
|
487
|
+
* Note: `archiver.rollbackTo` is NOT usable here — it is checkpoint-granular and no-ops on a
|
|
488
|
+
* proposed-only tip (the inserted checkpoint is not yet in the checkpointed set).
|
|
489
|
+
*/ async rollbackOptimisticInsert(toBlockNumber) {
|
|
490
|
+
await this.deps.archiver.removeUncheckpointedBlocksAfter(toBlockNumber);
|
|
491
|
+
await this.deps.p2pClient.sync();
|
|
492
|
+
await this.deps.worldState.syncImmediate();
|
|
493
|
+
this.deps.l1TxUtils.forEach((utils)=>utils.resetNonce());
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
392
496
|
* Warps L1 timestamp to (or past) `targetTimestampSec`, rounded up to the next aztec-slot
|
|
393
497
|
* boundary, by queuing an empty-checkpoint build at that slot. Mines exactly one L1 block
|
|
394
498
|
* (the propose tx auto-mined under anvil's automine mode), with the timestamp pre-set so
|
|
395
499
|
* the mined block lands on the slot boundary.
|
|
396
500
|
*/ async runWarp(targetTimestampSec) {
|
|
501
|
+
await this.reconcileDateProvider();
|
|
397
502
|
const currentL1Ts = await this.deps.ethCheatCodes.lastBlockTimestamp();
|
|
398
503
|
if (targetTimestampSec <= currentL1Ts) {
|
|
399
504
|
this.log.debug(`Warp target ${targetTimestampSec} is not in the future of current L1 ts ${currentL1Ts}`);
|
|
@@ -463,6 +568,82 @@ import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
|
463
568
|
});
|
|
464
569
|
}
|
|
465
570
|
/**
|
|
571
|
+
* Writes outbox roots for every epoch newly covered up to `maybeCheckpoint` and advances the proven
|
|
572
|
+
* tip. Settles each fully-covered epoch in full and the final epoch only up to the target checkpoint
|
|
573
|
+
* (a partial epoch, which the AZIP-14 Outbox supports via per-`numCheckpointsInEpoch` roots).
|
|
574
|
+
*/ async runProve(upToCheckpoint) {
|
|
575
|
+
await this.reconcileDateProvider();
|
|
576
|
+
const rollupCheatCodes = this.getRollupCheatCodes();
|
|
577
|
+
const tips = await this.deps.l2BlockSource.getL2Tips();
|
|
578
|
+
const checkpointedTip = tips.checkpointed.checkpoint.number;
|
|
579
|
+
// Never prove beyond what the archiver has actually checkpointed; default to that tip.
|
|
580
|
+
const target = CheckpointNumber(Math.min(upToCheckpoint ?? checkpointedTip, checkpointedTip));
|
|
581
|
+
const { proven } = await rollupCheatCodes.getTips();
|
|
582
|
+
if (target <= proven) {
|
|
583
|
+
this.log.debug(`Checkpoint ${target} already proven`, {
|
|
584
|
+
target,
|
|
585
|
+
proven,
|
|
586
|
+
checkpointedTip
|
|
587
|
+
});
|
|
588
|
+
return proven;
|
|
589
|
+
}
|
|
590
|
+
const startEpoch = await this.getEpochOfCheckpoint(CheckpointNumber(proven + 1));
|
|
591
|
+
const endEpoch = await this.getEpochOfCheckpoint(target);
|
|
592
|
+
if (startEpoch === undefined || endEpoch === undefined) {
|
|
593
|
+
this.log.warn(`Cannot resolve epoch range to prove up to checkpoint ${target}`, {
|
|
594
|
+
target,
|
|
595
|
+
proven,
|
|
596
|
+
startEpoch,
|
|
597
|
+
endEpoch
|
|
598
|
+
});
|
|
599
|
+
return proven;
|
|
600
|
+
}
|
|
601
|
+
for(let epoch = startEpoch; epoch <= endEpoch; epoch++){
|
|
602
|
+
const lastCovered = await settleEpochOutbox({
|
|
603
|
+
rollupCheatCodes,
|
|
604
|
+
l2BlockSource: this.deps.l2BlockSource,
|
|
605
|
+
epoch: EpochNumber(epoch),
|
|
606
|
+
maxCheckpoint: epoch === endEpoch ? target : undefined,
|
|
607
|
+
log: this.log
|
|
608
|
+
});
|
|
609
|
+
if (lastCovered === undefined) {
|
|
610
|
+
// An epoch in (proven, target] with no checkpointed blocks — expected when warps skip a whole
|
|
611
|
+
// epoch. Logged so it's distinguishable from the archiver failing to serve the epoch's blocks.
|
|
612
|
+
this.log.debug(`No checkpointed blocks to settle for epoch ${epoch} while proving to ${target}`, {
|
|
613
|
+
epoch,
|
|
614
|
+
target
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
await rollupCheatCodes.markAsProven(target);
|
|
619
|
+
// Settlement is a direct L1 storage write that mines no block, unlike a real epoch proof landing
|
|
620
|
+
// on L1. The archiver's L1 sync short-circuits while the L1 block hash is unchanged, so it would
|
|
621
|
+
// never re-read the proven tip until the next build/warp mines a block. Mine one L1 block so the
|
|
622
|
+
// block hash advances, then force an immediate sync that observes the new proven checkpoint. Use
|
|
623
|
+
// evmMine (not mineEmptyBlock): mineEmptyBlock drops+re-adds the mempool non-atomically, which can
|
|
624
|
+
// silently lose a test's concurrently-submitted direct L1 tx. evm_mine just includes whatever is
|
|
625
|
+
// pending, which is fine here — we only need the block hash to advance.
|
|
626
|
+
await this.deps.ethCheatCodes.evmMine();
|
|
627
|
+
await this.deps.archiver.syncImmediate();
|
|
628
|
+
this.log.verbose(`Proved up to checkpoint ${target}`, {
|
|
629
|
+
target,
|
|
630
|
+
proven,
|
|
631
|
+
startEpoch,
|
|
632
|
+
endEpoch
|
|
633
|
+
});
|
|
634
|
+
return target;
|
|
635
|
+
}
|
|
636
|
+
/** Resolves the epoch a checkpoint belongs to from its slot, or undefined if the archiver lacks it. */ async getEpochOfCheckpoint(checkpointNumber) {
|
|
637
|
+
const checkpointData = await this.deps.l2BlockSource.getCheckpointData({
|
|
638
|
+
number: checkpointNumber
|
|
639
|
+
});
|
|
640
|
+
if (!checkpointData) {
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
643
|
+
const slot = SlotNumber(Number(checkpointData.header.slotNumber));
|
|
644
|
+
return Number(getEpochAtSlot(slot, this.deps.l1Constants));
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
466
647
|
* Wraps `checkpointBuilder.buildBlock` with the failed-tx handling shared by both error
|
|
467
648
|
* and success paths: drops the failed txs from the P2P mempool, and returns `undefined`
|
|
468
649
|
* when `InsufficientValidTxsError` aborts the build (so the caller skips publishing).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AutomineSequencer, type AutomineSequencerConstants, type AutomineSequencerDeps, } from './automine_sequencer.js';
|
|
2
|
+
export { createAutomineSequencer, type CreateAutomineSequencerArgs } from './automine_factory.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zZXF1ZW5jZXIvYXV0b21pbmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLGlCQUFpQixFQUNqQixLQUFLLDBCQUEwQixFQUMvQixLQUFLLHFCQUFxQixHQUMzQixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxLQUFLLDJCQUEyQixFQUFFLE1BQU0sdUJBQXVCLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sequencer/automine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC"}
|