-
Notifications
You must be signed in to change notification settings - Fork 595
Expand file tree
/
Copy pathutils.ts
More file actions
47 lines (44 loc) · 1.48 KB
/
utils.ts
File metadata and controls
47 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
export enum SequencerState {
/**
* Sequencer is stopped and not processing any txs from the pool.
*/
STOPPED = 'STOPPED',
/**
* Sequencer is awaiting the next call to work().
*/
IDLE = 'IDLE',
/**
* Synchronizing with the L2 chain.
*/
SYNCHRONIZING = 'SYNCHRONIZING',
/**
* Checking if we are the proposer for the current slot.
*/
PROPOSER_CHECK = 'PROPOSER_CHECK',
/**
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
*/
INITIALIZING_PROPOSAL = 'INITIALIZING_PROPOSAL',
/**
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
*/
CREATING_BLOCK = 'CREATING_BLOCK',
/**
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
*/
COLLECTING_ATTESTATIONS = 'COLLECTING_ATTESTATIONS',
/**
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
*/
PUBLISHING_BLOCK = 'PUBLISHING_BLOCK',
}
export type SequencerStateWithSlot =
| SequencerState.INITIALIZING_PROPOSAL
| SequencerState.CREATING_BLOCK
| SequencerState.COLLECTING_ATTESTATIONS
| SequencerState.PUBLISHING_BLOCK
| SequencerState.PROPOSER_CHECK;
export type SequencerStateCallback = () => SequencerState;
export function sequencerStateToNumber(state: SequencerState): number {
return Object.values(SequencerState).indexOf(state);
}