@aztec/sequencer-client 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +10 -8
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +40 -28
- package/dest/config.d.ts +13 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +82 -25
- package/dest/global_variable_builder/global_builder.d.ts +22 -16
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +52 -39
- package/dest/global_variable_builder/index.d.ts +1 -1
- 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 +11 -8
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +21 -13
- package/dest/publisher/index.d.ts +2 -2
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -5
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +9 -2
- package/dest/publisher/sequencer-publisher-metrics.d.ts +4 -4
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +78 -70
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +687 -182
- package/dest/sequencer/block_builder.d.ts +6 -10
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +21 -10
- package/dest/sequencer/checkpoint_builder.d.ts +63 -0
- package/dest/sequencer/checkpoint_builder.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_builder.js +131 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +76 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1070 -0
- package/dest/sequencer/checkpoint_voter.d.ts +34 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +85 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +11 -0
- package/dest/sequencer/errors.d.ts.map +1 -0
- package/dest/sequencer/errors.js +15 -0
- package/dest/sequencer/events.d.ts +46 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +5 -1
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +4 -0
- package/dest/sequencer/metrics.d.ts +37 -20
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +211 -85
- package/dest/sequencer/sequencer.d.ts +110 -121
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +809 -524
- package/dest/sequencer/timetable.d.ts +57 -21
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +150 -68
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +20 -28
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +12 -24
- package/dest/test/index.d.ts +4 -2
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +83 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +179 -0
- package/dest/test/utils.d.ts +49 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +94 -0
- package/dest/tx_validator/nullifier_cache.d.ts +1 -1
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.d.ts +4 -3
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +12 -9
- package/package.json +32 -31
- package/src/client/sequencer-client.ts +34 -40
- package/src/config.ts +89 -29
- package/src/global_variable_builder/global_builder.ts +67 -59
- package/src/index.ts +2 -0
- package/src/publisher/config.ts +32 -19
- package/src/publisher/index.ts +1 -1
- package/src/publisher/sequencer-publisher-factory.ts +19 -6
- package/src/publisher/sequencer-publisher-metrics.ts +3 -3
- package/src/publisher/sequencer-publisher.ts +418 -242
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/block_builder.ts +28 -30
- package/src/sequencer/checkpoint_builder.ts +217 -0
- package/src/sequencer/checkpoint_proposal_job.ts +722 -0
- package/src/sequencer/checkpoint_voter.ts +105 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/errors.ts +21 -0
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +4 -0
- package/src/sequencer/metrics.ts +269 -94
- package/src/sequencer/sequencer.ts +508 -675
- package/src/sequencer/timetable.ts +181 -91
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +24 -29
- package/src/test/index.ts +3 -1
- package/src/test/mock_checkpoint_builder.ts +247 -0
- package/src/test/utils.ts +137 -0
- package/src/tx_validator/tx_validator_factory.ts +13 -7
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { SequencerMetrics } from './metrics.js';
|
|
2
2
|
import { SequencerState } from './utils.js';
|
|
3
|
+
export declare const MIN_EXECUTION_TIME = 2;
|
|
4
|
+
export declare const CHECKPOINT_INITIALIZATION_TIME = 1;
|
|
5
|
+
export declare const CHECKPOINT_ASSEMBLE_TIME = 1;
|
|
3
6
|
export declare class SequencerTimetable {
|
|
4
7
|
private readonly metrics?;
|
|
5
8
|
private readonly log;
|
|
@@ -9,46 +12,79 @@ export declare class SequencerTimetable {
|
|
|
9
12
|
* starts building at this time, and all times hold, it will have at least `minExecutionTime` to execute txs for the block.
|
|
10
13
|
*/
|
|
11
14
|
readonly initializeDeadline: number;
|
|
15
|
+
/**
|
|
16
|
+
* Fixed time offset (in seconds) when the first sub-slot starts, used as baseline for all block deadlines.
|
|
17
|
+
* This is an estimate of how long initialization (sync + proposer check) typically takes.
|
|
18
|
+
* If actual initialization takes longer/shorter, blocks just get less/more time accordingly.
|
|
19
|
+
*/
|
|
20
|
+
readonly initializationOffset: number;
|
|
21
|
+
/**
|
|
22
|
+
* Total time needed to finalize and publish a checkpoint, including:
|
|
23
|
+
* - Assembling the checkpoint
|
|
24
|
+
* - Round-trip p2p propagation for the checkpoint proposal and its corresponding attestations
|
|
25
|
+
* - Publishing to L1
|
|
26
|
+
*/
|
|
27
|
+
readonly checkpointFinalizationTime: number;
|
|
12
28
|
/**
|
|
13
29
|
* How long it takes to get a published block into L1. L1 builders typically accept txs up to 4 seconds into their slot,
|
|
14
30
|
* but we'll timeout sooner to give it more time to propagate (remember we also have blobs!). Still, when working in anvil,
|
|
15
31
|
* we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
|
|
16
32
|
*/
|
|
17
33
|
readonly l1PublishingTime: number;
|
|
18
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* What's the minimum time we want to leave available for execution and reexecution (used to derive init deadline)
|
|
36
|
+
* Defaults to half of the block duration if set, otherwise a constant.
|
|
37
|
+
*/
|
|
19
38
|
readonly minExecutionTime: number;
|
|
20
39
|
/** How long it takes to get ready to start building */
|
|
21
|
-
readonly
|
|
40
|
+
readonly checkpointInitializationTime: number;
|
|
22
41
|
/** How long it takes to for proposals and attestations to travel across the p2p layer (one-way) */
|
|
23
|
-
readonly
|
|
24
|
-
/** How much time we spend
|
|
25
|
-
readonly
|
|
42
|
+
readonly p2pPropagationTime: number;
|
|
43
|
+
/** How much time we spend assembling a checkpoint after building the last block */
|
|
44
|
+
readonly checkpointAssembleTime: number;
|
|
26
45
|
/** Ethereum slot duration in seconds */
|
|
27
46
|
readonly ethereumSlotDuration: number;
|
|
28
47
|
/** Aztec slot duration in seconds (must be multiple of ethereum slot duration) */
|
|
29
48
|
readonly aztecSlotDuration: number;
|
|
30
|
-
/** How late into an L1 slot we can send a tx to make sure it gets included in the immediate next block. Complement of l1PublishingTime. */
|
|
31
|
-
readonly maxL1TxInclusionTimeIntoSlot: number;
|
|
32
49
|
/** Whether assertTimeLeft will throw if not enough time. */
|
|
33
50
|
readonly enforce: boolean;
|
|
51
|
+
/** Duration per block when building multiple blocks per slot (undefined = single block per slot) */
|
|
52
|
+
readonly blockDuration: number | undefined;
|
|
53
|
+
/** Maximum number of blocks that can be built in this slot configuration */
|
|
54
|
+
readonly maxNumberOfBlocks: number;
|
|
34
55
|
constructor(opts: {
|
|
35
56
|
ethereumSlotDuration: number;
|
|
36
57
|
aztecSlotDuration: number;
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
l1PublishingTime: number;
|
|
59
|
+
p2pPropagationTime?: number;
|
|
60
|
+
blockDurationMs?: number;
|
|
39
61
|
enforce: boolean;
|
|
40
|
-
}, metrics?: SequencerMetrics | undefined, log?: import("@aztec/aztec.js").Logger);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
private get afterBlockReexecTimeNeeded();
|
|
44
|
-
getValidatorReexecTimeEnd(secondsIntoSlot?: number): number;
|
|
62
|
+
}, metrics?: SequencerMetrics | undefined, log?: import("@aztec/aztec.js/log").Logger);
|
|
63
|
+
getMaxAllowedTime(state: Extract<SequencerState, SequencerState.STOPPED | SequencerState.IDLE | SequencerState.SYNCHRONIZING>): undefined;
|
|
64
|
+
getMaxAllowedTime(state: Exclude<SequencerState, SequencerState.STOPPED | SequencerState.IDLE | SequencerState.SYNCHRONIZING>): number;
|
|
45
65
|
getMaxAllowedTime(state: SequencerState): number | undefined;
|
|
46
66
|
assertTimeLeft(newState: SequencerState, secondsIntoSlot: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Determines if we can start building the next block and returns its deadline.
|
|
69
|
+
*
|
|
70
|
+
* The timetable divides the slot into fixed sub-slots. This method finds the next
|
|
71
|
+
* available sub-slot that has enough time remaining to build a block.
|
|
72
|
+
*
|
|
73
|
+
* @param secondsIntoSlot - Current time (seconds into the slot)
|
|
74
|
+
* @returns Object with canStart flag, deadline, and whether this is the last block
|
|
75
|
+
*/
|
|
76
|
+
canStartNextBlock(secondsIntoSlot: number): {
|
|
77
|
+
canStart: true;
|
|
78
|
+
deadline: undefined;
|
|
79
|
+
isLastBlock: true;
|
|
80
|
+
} | {
|
|
81
|
+
canStart: false;
|
|
82
|
+
deadline: undefined;
|
|
83
|
+
isLastBlock: false;
|
|
84
|
+
} | {
|
|
85
|
+
canStart: boolean;
|
|
86
|
+
deadline: number;
|
|
87
|
+
isLastBlock: boolean;
|
|
88
|
+
};
|
|
47
89
|
}
|
|
48
|
-
|
|
49
|
-
readonly proposedState: SequencerState;
|
|
50
|
-
readonly maxAllowedTime: number;
|
|
51
|
-
readonly currentTime: number;
|
|
52
|
-
constructor(proposedState: SequencerState, maxAllowedTime: number, currentTime: number);
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=timetable.d.ts.map
|
|
90
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZXRhYmxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VxdWVuY2VyL3RpbWV0YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUNyRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRTVDLGVBQU8sTUFBTSxrQkFBa0IsSUFBSSxDQUFDO0FBQ3BDLGVBQU8sTUFBTSw4QkFBOEIsSUFBSSxDQUFDO0FBQ2hELGVBQU8sTUFBTSx3QkFBd0IsSUF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zVEO1FBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQztRQUFDLFFBQVEsRUFBRSxNQUFNLENBQUM7UUFBQyxXQUFXLEVBQUUsT0FBTyxDQUFBO0tBQUUsQ0F3RGhFO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,qBAAa,kBAAkB;IAqE3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IArEtB;;;;OAIG;IACH,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAE3C;;;;OAIG;IACH,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAE7C;;;;;OAKG;IACH,SAAgB,0BAA0B,EAAE,MAAM,CAAC;IAEnD;;;;OAIG;IACH,SAAgB,gBAAgB,EAAE,MAAM,CAAC;IAEzC;;;OAGG;IACH,SAAgB,gBAAgB,EAAE,MAAM,CAAsB;IAE9D,uDAAuD;IACvD,SAAgB,4BAA4B,EAAE,MAAM,CAAkC;IAEtF,mGAAmG;IACnG,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAE3C,mFAAmF;IACnF,SAAgB,sBAAsB,EAAE,MAAM,CAA4B;IAE1E,wCAAwC;IACxC,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAE7C,kFAAkF;IAClF,SAAgB,iBAAiB,EAAE,MAAM,CAA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M,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAwDhE;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
-
import { DEFAULT_ATTESTATION_PROPAGATION_TIME } from '../config.js';
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { DEFAULT_ATTESTATION_PROPAGATION_TIME as DEFAULT_P2P_PROPAGATION_TIME } from '../config.js';
|
|
3
|
+
import { SequencerTooSlowError } from './errors.js';
|
|
3
4
|
import { SequencerState } from './utils.js';
|
|
4
|
-
const MIN_EXECUTION_TIME =
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
export const MIN_EXECUTION_TIME = 2;
|
|
6
|
+
export const CHECKPOINT_INITIALIZATION_TIME = 1;
|
|
7
|
+
export const CHECKPOINT_ASSEMBLE_TIME = 1;
|
|
7
8
|
export class SequencerTimetable {
|
|
8
9
|
metrics;
|
|
9
10
|
log;
|
|
@@ -13,99 +14,112 @@ export class SequencerTimetable {
|
|
|
13
14
|
* starts building at this time, and all times hold, it will have at least `minExecutionTime` to execute txs for the block.
|
|
14
15
|
*/ initializeDeadline;
|
|
15
16
|
/**
|
|
17
|
+
* Fixed time offset (in seconds) when the first sub-slot starts, used as baseline for all block deadlines.
|
|
18
|
+
* This is an estimate of how long initialization (sync + proposer check) typically takes.
|
|
19
|
+
* If actual initialization takes longer/shorter, blocks just get less/more time accordingly.
|
|
20
|
+
*/ initializationOffset;
|
|
21
|
+
/**
|
|
22
|
+
* Total time needed to finalize and publish a checkpoint, including:
|
|
23
|
+
* - Assembling the checkpoint
|
|
24
|
+
* - Round-trip p2p propagation for the checkpoint proposal and its corresponding attestations
|
|
25
|
+
* - Publishing to L1
|
|
26
|
+
*/ checkpointFinalizationTime;
|
|
27
|
+
/**
|
|
16
28
|
* How long it takes to get a published block into L1. L1 builders typically accept txs up to 4 seconds into their slot,
|
|
17
29
|
* but we'll timeout sooner to give it more time to propagate (remember we also have blobs!). Still, when working in anvil,
|
|
18
30
|
* we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
|
|
19
31
|
*/ l1PublishingTime;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
/**
|
|
33
|
+
* What's the minimum time we want to leave available for execution and reexecution (used to derive init deadline)
|
|
34
|
+
* Defaults to half of the block duration if set, otherwise a constant.
|
|
35
|
+
*/ minExecutionTime;
|
|
36
|
+
/** How long it takes to get ready to start building */ checkpointInitializationTime;
|
|
37
|
+
/** How long it takes to for proposals and attestations to travel across the p2p layer (one-way) */ p2pPropagationTime;
|
|
38
|
+
/** How much time we spend assembling a checkpoint after building the last block */ checkpointAssembleTime;
|
|
24
39
|
/** Ethereum slot duration in seconds */ ethereumSlotDuration;
|
|
25
40
|
/** Aztec slot duration in seconds (must be multiple of ethereum slot duration) */ aztecSlotDuration;
|
|
26
|
-
/** How late into an L1 slot we can send a tx to make sure it gets included in the immediate next block. Complement of l1PublishingTime. */ maxL1TxInclusionTimeIntoSlot;
|
|
27
41
|
/** Whether assertTimeLeft will throw if not enough time. */ enforce;
|
|
42
|
+
/** Duration per block when building multiple blocks per slot (undefined = single block per slot) */ blockDuration;
|
|
43
|
+
/** Maximum number of blocks that can be built in this slot configuration */ maxNumberOfBlocks;
|
|
28
44
|
constructor(opts, metrics, log = createLogger('sequencer:timetable')){
|
|
29
45
|
this.metrics = metrics;
|
|
30
46
|
this.log = log;
|
|
31
47
|
this.minExecutionTime = MIN_EXECUTION_TIME;
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
48
|
+
this.checkpointInitializationTime = CHECKPOINT_INITIALIZATION_TIME;
|
|
49
|
+
this.checkpointAssembleTime = CHECKPOINT_ASSEMBLE_TIME;
|
|
34
50
|
this.ethereumSlotDuration = opts.ethereumSlotDuration;
|
|
35
51
|
this.aztecSlotDuration = opts.aztecSlotDuration;
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
52
|
+
this.l1PublishingTime = opts.l1PublishingTime;
|
|
53
|
+
this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
54
|
+
this.blockDuration = opts.blockDurationMs ? opts.blockDurationMs / 1000 : undefined;
|
|
39
55
|
this.enforce = opts.enforce;
|
|
40
56
|
// Assume zero-cost propagation time and faster runs in test environments where L1 slot duration is shortened
|
|
41
57
|
if (this.ethereumSlotDuration < 8) {
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
58
|
+
this.p2pPropagationTime = 0;
|
|
59
|
+
this.checkpointAssembleTime = 0.5;
|
|
60
|
+
this.checkpointInitializationTime = 0.5;
|
|
61
|
+
this.minExecutionTime = 1;
|
|
45
62
|
}
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
// Min execution time cannot be less than the block duration if set
|
|
64
|
+
if (this.blockDuration !== undefined && this.minExecutionTime > this.blockDuration) {
|
|
65
|
+
this.minExecutionTime = this.blockDuration;
|
|
66
|
+
}
|
|
67
|
+
// Calculate initialization offset - estimate of time needed for sync + proposer check
|
|
68
|
+
// This is the baseline for all sub-slot deadlines
|
|
69
|
+
this.initializationOffset = this.checkpointInitializationTime;
|
|
70
|
+
// Calculate total checkpoint finalization time (assembly + attestations + L1 publishing)
|
|
71
|
+
this.checkpointFinalizationTime = this.checkpointAssembleTime + this.p2pPropagationTime * 2 + // Round-trip propagation
|
|
72
|
+
this.l1PublishingTime; // L1 publishing
|
|
73
|
+
// Calculate maximum number of blocks that fit in this slot
|
|
74
|
+
if (!this.blockDuration) {
|
|
75
|
+
this.maxNumberOfBlocks = 1; // Single block per slot
|
|
76
|
+
} else {
|
|
77
|
+
const timeReservedAtEnd = this.blockDuration + // Last sub-slot for validator re-execution
|
|
78
|
+
this.checkpointFinalizationTime; // Checkpoint finalization
|
|
79
|
+
const timeAvailableForBlocks = this.aztecSlotDuration - this.initializationOffset - timeReservedAtEnd;
|
|
80
|
+
this.maxNumberOfBlocks = Math.floor(timeAvailableForBlocks / this.blockDuration);
|
|
81
|
+
}
|
|
82
|
+
// Minimum work to do within a slot for building a block with the minimum time for execution and publishing its checkpoint
|
|
83
|
+
const minWorkToDo = this.initializationOffset + this.minExecutionTime * 2 + // Execution and reexecution
|
|
84
|
+
this.checkpointFinalizationTime;
|
|
85
|
+
const initializeDeadline = this.aztecSlotDuration - minWorkToDo;
|
|
48
86
|
this.initializeDeadline = initializeDeadline;
|
|
49
|
-
this.log.verbose(`Sequencer timetable initialized (${this.enforce ? 'enforced' : 'not enforced'})`, {
|
|
87
|
+
this.log.verbose(`Sequencer timetable initialized with ${this.maxNumberOfBlocks} blocks per slot (${this.enforce ? 'enforced' : 'not enforced'})`, {
|
|
50
88
|
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
51
89
|
aztecSlotDuration: this.aztecSlotDuration,
|
|
52
|
-
maxL1TxInclusionTimeIntoSlot: this.maxL1TxInclusionTimeIntoSlot,
|
|
53
90
|
l1PublishingTime: this.l1PublishingTime,
|
|
54
91
|
minExecutionTime: this.minExecutionTime,
|
|
55
|
-
blockPrepareTime: this.
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
blockPrepareTime: this.checkpointInitializationTime,
|
|
93
|
+
p2pPropagationTime: this.p2pPropagationTime,
|
|
94
|
+
blockAssembleTime: this.checkpointAssembleTime,
|
|
58
95
|
initializeDeadline: this.initializeDeadline,
|
|
59
96
|
enforce: this.enforce,
|
|
60
|
-
|
|
97
|
+
minWorkToDo,
|
|
98
|
+
blockDuration: this.blockDuration,
|
|
99
|
+
maxNumberOfBlocks: this.maxNumberOfBlocks
|
|
61
100
|
});
|
|
62
101
|
if (initializeDeadline <= 0) {
|
|
63
|
-
throw new Error(`Block proposal initialize deadline cannot be negative (got ${initializeDeadline} from total time needed ${
|
|
102
|
+
throw new Error(`Block proposal initialize deadline cannot be negative (got ${initializeDeadline} from total time needed ${minWorkToDo} and a slot duration of ${this.aztecSlotDuration}).`);
|
|
64
103
|
}
|
|
65
104
|
}
|
|
66
|
-
get afterBlockBuildingTimeNeededWithoutReexec() {
|
|
67
|
-
return this.blockValidationTime + this.attestationPropagationTime * 2 + this.l1PublishingTime;
|
|
68
|
-
}
|
|
69
|
-
getBlockProposalExecTimeEnd(secondsIntoSlot) {
|
|
70
|
-
// We are N seconds into the slot. We need to account for `afterBlockBuildingTimeNeededWithoutReexec` seconds,
|
|
71
|
-
// send then split the remaining time between the re-execution and the block building.
|
|
72
|
-
const maxAllowed = this.aztecSlotDuration - this.afterBlockBuildingTimeNeededWithoutReexec;
|
|
73
|
-
const available = maxAllowed - secondsIntoSlot;
|
|
74
|
-
const executionTimeEnd = secondsIntoSlot + available / 2;
|
|
75
|
-
this.log.debug(`Block proposal execution time deadline is ${executionTimeEnd}`, {
|
|
76
|
-
secondsIntoSlot,
|
|
77
|
-
maxAllowed,
|
|
78
|
-
available,
|
|
79
|
-
executionTimeEnd
|
|
80
|
-
});
|
|
81
|
-
return executionTimeEnd;
|
|
82
|
-
}
|
|
83
|
-
get afterBlockReexecTimeNeeded() {
|
|
84
|
-
return this.attestationPropagationTime + this.l1PublishingTime;
|
|
85
|
-
}
|
|
86
|
-
getValidatorReexecTimeEnd(secondsIntoSlot) {
|
|
87
|
-
// We need to leave for `afterBlockReexecTimeNeeded` seconds available.
|
|
88
|
-
const validationTimeEnd = this.aztecSlotDuration - this.afterBlockReexecTimeNeeded;
|
|
89
|
-
this.log.debug(`Validator re-execution time deadline is ${validationTimeEnd}`, {
|
|
90
|
-
secondsIntoSlot,
|
|
91
|
-
validationTimeEnd
|
|
92
|
-
});
|
|
93
|
-
return validationTimeEnd;
|
|
94
|
-
}
|
|
95
105
|
getMaxAllowedTime(state) {
|
|
96
106
|
switch(state){
|
|
97
107
|
case SequencerState.STOPPED:
|
|
108
|
+
case SequencerState.STOPPING:
|
|
98
109
|
case SequencerState.IDLE:
|
|
99
110
|
case SequencerState.SYNCHRONIZING:
|
|
100
111
|
return; // We don't really care about times for this states
|
|
101
112
|
case SequencerState.PROPOSER_CHECK:
|
|
102
|
-
case SequencerState.
|
|
113
|
+
case SequencerState.INITIALIZING_CHECKPOINT:
|
|
103
114
|
return this.initializeDeadline;
|
|
115
|
+
case SequencerState.WAITING_FOR_TXS:
|
|
104
116
|
case SequencerState.CREATING_BLOCK:
|
|
105
|
-
|
|
117
|
+
case SequencerState.WAITING_UNTIL_NEXT_BLOCK:
|
|
118
|
+
return this.initializeDeadline + this.checkpointInitializationTime;
|
|
119
|
+
case SequencerState.ASSEMBLING_CHECKPOINT:
|
|
106
120
|
case SequencerState.COLLECTING_ATTESTATIONS:
|
|
107
|
-
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.
|
|
108
|
-
case SequencerState.
|
|
121
|
+
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.p2pPropagationTime;
|
|
122
|
+
case SequencerState.PUBLISHING_CHECKPOINT:
|
|
109
123
|
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
110
124
|
default:
|
|
111
125
|
{
|
|
@@ -132,13 +146,81 @@ export class SequencerTimetable {
|
|
|
132
146
|
secondsIntoSlot
|
|
133
147
|
});
|
|
134
148
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Determines if we can start building the next block and returns its deadline.
|
|
151
|
+
*
|
|
152
|
+
* The timetable divides the slot into fixed sub-slots. This method finds the next
|
|
153
|
+
* available sub-slot that has enough time remaining to build a block.
|
|
154
|
+
*
|
|
155
|
+
* @param secondsIntoSlot - Current time (seconds into the slot)
|
|
156
|
+
* @returns Object with canStart flag, deadline, and whether this is the last block
|
|
157
|
+
*/ canStartNextBlock(secondsIntoSlot) {
|
|
158
|
+
// When timetable enforcement is disabled, always allow starting,
|
|
159
|
+
// and build a single block with no deadline. This is here just to
|
|
160
|
+
// satisfy a subset of e2e tests and the sandbox that assume that the
|
|
161
|
+
// sequencer is permanently mining every tx sent.
|
|
162
|
+
if (!this.enforce) {
|
|
163
|
+
return {
|
|
164
|
+
canStart: true,
|
|
165
|
+
deadline: undefined,
|
|
166
|
+
isLastBlock: true
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// If no block duration is set, then we're in single-block mode, which
|
|
170
|
+
// is handled for backwards compatibility towards another subset of e2e tests.
|
|
171
|
+
if (this.blockDuration === undefined) {
|
|
172
|
+
// In single block mode, execution and re-execution happen sequentially, so we need to
|
|
173
|
+
// split the available time between them. After building, we need time for attestations and L1.
|
|
174
|
+
const maxAllowed = this.aztecSlotDuration - this.checkpointFinalizationTime;
|
|
175
|
+
const available = (maxAllowed - secondsIntoSlot) / 2; // Split remaining time: half for execution, half for re-execution
|
|
176
|
+
const canStart = available >= this.minExecutionTime;
|
|
177
|
+
const deadline = secondsIntoSlot + available;
|
|
178
|
+
this.log.verbose(`${canStart ? 'Can' : 'Cannot'} start single-block checkpoint at ${secondsIntoSlot}s into slot`, {
|
|
179
|
+
secondsIntoSlot,
|
|
180
|
+
maxAllowed,
|
|
181
|
+
available,
|
|
182
|
+
deadline
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
canStart,
|
|
186
|
+
deadline,
|
|
187
|
+
isLastBlock: true
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// Otherwise, we're in multi-block-per-slot mode, the default when running in production
|
|
191
|
+
// Find the next available sub-slot that has enough time remaining
|
|
192
|
+
for(let subSlot = 1; subSlot <= this.maxNumberOfBlocks; subSlot++){
|
|
193
|
+
// Calculate end for this sub-slot
|
|
194
|
+
const deadline = this.initializationOffset + subSlot * this.blockDuration;
|
|
195
|
+
// Check if we have enough time to build a block with this deadline
|
|
196
|
+
const timeUntilDeadline = deadline - secondsIntoSlot;
|
|
197
|
+
if (timeUntilDeadline >= this.minExecutionTime) {
|
|
198
|
+
// Found an available sub-slot! Is this the last one?
|
|
199
|
+
const isLastBlock = subSlot === this.maxNumberOfBlocks;
|
|
200
|
+
this.log.verbose(`Can start ${isLastBlock ? 'last block' : 'block'} in sub-slot ${subSlot} with deadline ${deadline}s`, {
|
|
201
|
+
secondsIntoSlot,
|
|
202
|
+
deadline,
|
|
203
|
+
timeUntilDeadline,
|
|
204
|
+
subSlot,
|
|
205
|
+
maxBlocks: this.maxNumberOfBlocks
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
canStart: true,
|
|
209
|
+
deadline,
|
|
210
|
+
isLastBlock
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// No sub-slots available with enough time
|
|
215
|
+
this.log.verbose(`No time left to start any more blocks`, {
|
|
216
|
+
secondsIntoSlot,
|
|
217
|
+
maxBlocks: this.maxNumberOfBlocks,
|
|
218
|
+
initializationOffset: this.initializationOffset
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
canStart: false,
|
|
222
|
+
deadline: undefined,
|
|
223
|
+
isLastBlock: false
|
|
224
|
+
};
|
|
143
225
|
}
|
|
144
226
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
2
|
+
export type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration'>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXF1ZW5jZXIvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVyRSxNQUFNLE1BQU0sd0JBQXdCLEdBQUcsSUFBSSxDQUN6QyxpQkFBaUIsRUFDakIsc0JBQXNCLEdBQUcsZUFBZSxHQUFHLGNBQWMsQ0FDMUQsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sequencer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,iBAAiB,EACjB,sBAAsB,GAAG,eAAe,GAAG,cAAc,CAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
export declare enum SequencerState {
|
|
2
|
-
/**
|
|
3
|
-
* Sequencer is stopped and not processing any txs from the pool.
|
|
4
|
-
*/
|
|
2
|
+
/** Sequencer is stopped and not processing any txs from the pool. */
|
|
5
3
|
STOPPED = "STOPPED",
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/** Sequencer is being stopped. Will move to STOPPED shortly. */
|
|
5
|
+
STOPPING = "STOPPING",
|
|
6
|
+
/** Sequencer is awaiting the next call to work(). */
|
|
9
7
|
IDLE = "IDLE",
|
|
10
|
-
/**
|
|
11
|
-
* Synchronizing with the L2 chain.
|
|
12
|
-
*/
|
|
8
|
+
/** Synchronizing with the L2 chain. */
|
|
13
9
|
SYNCHRONIZING = "SYNCHRONIZING",
|
|
14
|
-
/**
|
|
15
|
-
* Checking if we are the proposer for the current slot.
|
|
16
|
-
*/
|
|
10
|
+
/** Checking if we are the proposer for the current slot. */
|
|
17
11
|
PROPOSER_CHECK = "PROPOSER_CHECK",
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
24
|
-
*/
|
|
12
|
+
/** Initializing the checkpoint proposal. */
|
|
13
|
+
INITIALIZING_CHECKPOINT = "INITIALIZING_CHECKPOINT",
|
|
14
|
+
/** Waiting for transactions to arrive in the pool. */
|
|
15
|
+
WAITING_FOR_TXS = "WAITING_FOR_TXS",
|
|
16
|
+
/** Creating a new L2 block. Includes processing public function calls. */
|
|
25
17
|
CREATING_BLOCK = "CREATING_BLOCK",
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
/** Waiting until the next block can be created. */
|
|
19
|
+
WAITING_UNTIL_NEXT_BLOCK = "WAITING_UNTIL_NEXT_BLOCK",
|
|
20
|
+
/** Assembling and broadcasting the checkpoint. */
|
|
21
|
+
ASSEMBLING_CHECKPOINT = "ASSEMBLING_CHECKPOINT",
|
|
22
|
+
/** Collecting attestations from its peers. */
|
|
29
23
|
COLLECTING_ATTESTATIONS = "COLLECTING_ATTESTATIONS",
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
PUBLISHING_BLOCK = "PUBLISHING_BLOCK"
|
|
24
|
+
/** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */
|
|
25
|
+
PUBLISHING_CHECKPOINT = "PUBLISHING_CHECKPOINT"
|
|
34
26
|
}
|
|
35
|
-
export type SequencerStateWithSlot = SequencerState.
|
|
27
|
+
export type SequencerStateWithSlot = SequencerState.INITIALIZING_CHECKPOINT | SequencerState.WAITING_FOR_TXS | SequencerState.CREATING_BLOCK | SequencerState.WAITING_UNTIL_NEXT_BLOCK | SequencerState.COLLECTING_ATTESTATIONS | SequencerState.PUBLISHING_CHECKPOINT | SequencerState.PROPOSER_CHECK | SequencerState.ASSEMBLING_CHECKPOINT;
|
|
36
28
|
export type SequencerStateCallback = () => SequencerState;
|
|
37
29
|
export declare function sequencerStateToNumber(state: SequencerState): number;
|
|
38
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3Qi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|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,qEAAqE;IACrE,OAAO,YAAY;IACnB,gEAAgE;IAChE,QAAQ,aAAa;IACrB,qDAAqD;IACrD,IAAI,SAAS;IACb,uCAAuC;IACvC,aAAa,kBAAkB;IAC/B,4DAA4D;IAC5D,cAAc,mBAAmB;IACjC,4CAA4C;IAC5C,uBAAuB,4BAA4B;IACnD,sDAAsD;IACtD,eAAe,oBAAoB;IACnC,0EAA0E;IAC1E,cAAc,mBAAmB;IACjC,mDAAmD;IACnD,wBAAwB,6BAA6B;IACrD,kDAAkD;IAClD,qBAAqB,0BAA0B;IAC/C,8CAA8C;IAC9C,uBAAuB,4BAA4B;IACnD,qFAAqF;IACrF,qBAAqB,0BAA0B;CAChD;AAED,MAAM,MAAM,sBAAsB,GAC9B,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,eAAe,GAC9B,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,wBAAwB,GACvC,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,qBAAqB,GACpC,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,qBAAqB,CAAC;AAEzC,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE"}
|
package/dest/sequencer/utils.js
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
|
|
16
|
-
*/ SequencerState["INITIALIZING_PROPOSAL"] = "INITIALIZING_PROPOSAL";
|
|
17
|
-
/**
|
|
18
|
-
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
19
|
-
*/ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
|
|
20
|
-
/**
|
|
21
|
-
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
|
|
22
|
-
*/ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
|
|
23
|
-
/**
|
|
24
|
-
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
|
|
25
|
-
*/ SequencerState["PUBLISHING_BLOCK"] = "PUBLISHING_BLOCK";
|
|
2
|
+
/** Sequencer is stopped and not processing any txs from the pool. */ SequencerState["STOPPED"] = "STOPPED";
|
|
3
|
+
/** Sequencer is being stopped. Will move to STOPPED shortly. */ SequencerState["STOPPING"] = "STOPPING";
|
|
4
|
+
/** Sequencer is awaiting the next call to work(). */ SequencerState["IDLE"] = "IDLE";
|
|
5
|
+
/** Synchronizing with the L2 chain. */ SequencerState["SYNCHRONIZING"] = "SYNCHRONIZING";
|
|
6
|
+
/** Checking if we are the proposer for the current slot. */ SequencerState["PROPOSER_CHECK"] = "PROPOSER_CHECK";
|
|
7
|
+
/** Initializing the checkpoint proposal. */ SequencerState["INITIALIZING_CHECKPOINT"] = "INITIALIZING_CHECKPOINT";
|
|
8
|
+
/** Waiting for transactions to arrive in the pool. */ SequencerState["WAITING_FOR_TXS"] = "WAITING_FOR_TXS";
|
|
9
|
+
/** Creating a new L2 block. Includes processing public function calls. */ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
|
|
10
|
+
/** Waiting until the next block can be created. */ SequencerState["WAITING_UNTIL_NEXT_BLOCK"] = "WAITING_UNTIL_NEXT_BLOCK";
|
|
11
|
+
/** Assembling and broadcasting the checkpoint. */ SequencerState["ASSEMBLING_CHECKPOINT"] = "ASSEMBLING_CHECKPOINT";
|
|
12
|
+
/** Collecting attestations from its peers. */ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
|
|
13
|
+
/** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */ SequencerState["PUBLISHING_CHECKPOINT"] = "PUBLISHING_CHECKPOINT";
|
|
26
14
|
return SequencerState;
|
|
27
15
|
}({});
|
|
28
16
|
export function sequencerStateToNumber(state) {
|
package/dest/test/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { PublisherManager } from '@aztec/ethereum';
|
|
2
1
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
2
|
+
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
3
3
|
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
4
4
|
import type { ValidatorClient } from '@aztec/validator-client';
|
|
5
5
|
import { SequencerClient } from '../client/sequencer-client.js';
|
|
6
6
|
import type { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
7
7
|
import type { SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
8
|
+
import type { FullNodeCheckpointsBuilder } from '../sequencer/checkpoint_builder.js';
|
|
8
9
|
import { Sequencer } from '../sequencer/sequencer.js';
|
|
9
10
|
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
10
11
|
declare class TestSequencer_ extends Sequencer {
|
|
@@ -13,6 +14,7 @@ declare class TestSequencer_ extends Sequencer {
|
|
|
13
14
|
publisher: SequencerPublisher;
|
|
14
15
|
publisherFactory: SequencerPublisherFactory;
|
|
15
16
|
validatorClient: ValidatorClient;
|
|
17
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
16
18
|
}
|
|
17
19
|
export type TestSequencer = TestSequencer_;
|
|
18
20
|
declare class TestSequencerClient_ extends SequencerClient {
|
|
@@ -21,4 +23,4 @@ declare class TestSequencerClient_ extends SequencerClient {
|
|
|
21
23
|
}
|
|
22
24
|
export type TestSequencerClient = TestSequencerClient_;
|
|
23
25
|
export {};
|
|
24
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMxRSxPQUFPLEtBQUssRUFBRSxzQkFBc0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3RFLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRS9ELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxNQUFNLDZDQUE2QyxDQUFDO0FBQzdGLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFDOUUsT0FBTyxLQUFLLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUNyRixPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVwRSxjQUFNLGNBQWUsU0FBUSxTQUFTO0lBQ3JCLHNCQUFzQixFQUFFLHNCQUFzQixDQUFDO0lBQy9DLFNBQVMsRUFBRSxrQkFBa0IsQ0FBQztJQUM5QixTQUFTLEVBQUUsa0JBQWtCLENBQUM7SUFDOUIsZ0JBQWdCLEVBQUUseUJBQXlCLENBQUM7SUFDNUMsZUFBZSxFQUFFLGVBQWUsQ0FBQztJQUNqQyxrQkFBa0IsRUFBRSwwQkFBMEIsQ0FBQztDQUMvRDtBQUVELE1BQU0sTUFBTSxhQUFhLEdBQUcsY0FBYyxDQUFDO0FBRTNDLGNBQU0sb0JBQXFCLFNBQVEsZUFBZTtJQUNqQyxTQUFTLEVBQUUsYUFBYSxDQUFDO0lBQ3pCLGdCQUFnQixFQUFFLGdCQUFnQixDQUFDLGtCQUFrQixDQUFDLENBQUM7Q0FDdkU7QUFFRCxNQUFNLE1BQU0sbUJBQW1CLEdBQUcsb0JBQW9CLENBQUMifQ==
|
package/dest/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,0BAA0B,CAAC;CAC/D;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,cAAM,oBAAqB,SAAQ,eAAe;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACvE;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|