@aztec/sequencer-client 0.70.0 → 0.72.1
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.js +2 -2
- package/dest/config.js +2 -2
- package/dest/publisher/l1-publisher.d.ts +1 -1
- package/dest/publisher/l1-publisher.d.ts.map +1 -1
- package/dest/publisher/l1-publisher.js +95 -29
- package/dest/sequencer/allowed.js +3 -3
- package/dest/sequencer/sequencer.d.ts +19 -22
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +53 -131
- package/dest/sequencer/timetable.d.ts +38 -0
- package/dest/sequencer/timetable.d.ts.map +1 -0
- package/dest/sequencer/timetable.js +96 -0
- package/dest/slasher/factory.d.ts.map +1 -1
- package/dest/slasher/factory.js +3 -3
- package/dest/slasher/slasher_client.d.ts.map +1 -1
- package/dest/slasher/slasher_client.js +3 -4
- package/dest/test/index.d.ts +2 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -1
- package/dest/tx_validator/gas_validator.d.ts +1 -1
- package/dest/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/tx_validator/gas_validator.js +8 -4
- package/package.json +21 -21
- package/src/client/sequencer-client.ts +1 -1
- package/src/config.ts +1 -1
- package/src/publisher/l1-publisher.ts +106 -27
- package/src/sequencer/allowed.ts +2 -2
- package/src/sequencer/sequencer.ts +68 -173
- package/src/sequencer/timetable.ts +123 -0
- package/src/slasher/factory.ts +2 -3
- package/src/slasher/slasher_client.ts +2 -3
- package/src/test/index.ts +2 -3
- package/src/tx_validator/gas_validator.ts +15 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { type EpochProofQuote, type L1RollupConstants, type L1ToL2MessageSource, type L2Block, type L2BlockSource, type TxHash, type WorldStateSynchronizer } from '@aztec/circuit-types';
|
|
3
|
+
import { type EpochProofQuote, type L1RollupConstants, type L1ToL2MessageSource, type L2Block, type L2BlockSource, Tx, type TxHash, type WorldStateSynchronizer } from '@aztec/circuit-types';
|
|
4
4
|
import type { Signature } from '@aztec/circuit-types/interfaces';
|
|
5
|
-
import { type ContractDataSource } from '@aztec/circuits.js';
|
|
5
|
+
import { type ContractDataSource, Gas, type GlobalVariables } from '@aztec/circuits.js';
|
|
6
6
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
7
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
|
-
import { type DateProvider } from '@aztec/foundation/timer';
|
|
8
|
+
import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
9
9
|
import { type P2P } from '@aztec/p2p';
|
|
10
10
|
import { type BlockBuilderFactory } from '@aztec/prover-client/block-builder';
|
|
11
11
|
import { type PublicProcessorFactory } from '@aztec/simulator/server';
|
|
@@ -15,15 +15,9 @@ import { type GlobalVariableBuilder } from '../global_variable_builder/global_bu
|
|
|
15
15
|
import { type L1Publisher } from '../publisher/l1-publisher.js';
|
|
16
16
|
import { type SlasherClient } from '../slasher/slasher_client.js';
|
|
17
17
|
import { type SequencerConfig } from './config.js';
|
|
18
|
+
import { SequencerTimetable } from './timetable.js';
|
|
18
19
|
import { SequencerState } from './utils.js';
|
|
19
20
|
export { SequencerState };
|
|
20
|
-
export declare class SequencerTooSlowError extends Error {
|
|
21
|
-
readonly currentState: SequencerState;
|
|
22
|
-
readonly proposedState: SequencerState;
|
|
23
|
-
readonly maxAllowedTime: number;
|
|
24
|
-
readonly currentTime: number;
|
|
25
|
-
constructor(currentState: SequencerState, proposedState: SequencerState, maxAllowedTime: number, currentTime: number);
|
|
26
|
-
}
|
|
27
21
|
type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration'>;
|
|
28
22
|
/**
|
|
29
23
|
* Sequencer client
|
|
@@ -53,7 +47,7 @@ export declare class Sequencer {
|
|
|
53
47
|
private runningPromise?;
|
|
54
48
|
private pollingIntervalMs;
|
|
55
49
|
private maxTxsPerBlock;
|
|
56
|
-
private
|
|
50
|
+
private minTxsPerBlock;
|
|
57
51
|
private maxL1TxInclusionTimeIntoSlot;
|
|
58
52
|
private _coinbase;
|
|
59
53
|
private _feeRecipient;
|
|
@@ -61,18 +55,13 @@ export declare class Sequencer {
|
|
|
61
55
|
private allowedInSetup;
|
|
62
56
|
private maxBlockSizeInBytes;
|
|
63
57
|
private maxBlockGas;
|
|
64
|
-
protected processTxTime: number;
|
|
65
|
-
private attestationPropagationTime;
|
|
66
58
|
private metrics;
|
|
67
59
|
private isFlushing;
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
* For example, in order to transition into WAITING_FOR_ATTESTATIONS, the sequencer can be at most 3 seconds into the slot.
|
|
71
|
-
*/
|
|
72
|
-
protected timeTable: Record<SequencerState, number>;
|
|
60
|
+
/** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */
|
|
61
|
+
protected timetable: SequencerTimetable;
|
|
73
62
|
protected enforceTimeTable: boolean;
|
|
74
63
|
constructor(publisher: L1Publisher, validatorClient: ValidatorClient | undefined, // During migration the validator client can be inactive
|
|
75
|
-
globalsBuilder: GlobalVariableBuilder, p2pClient: P2P, worldState: WorldStateSynchronizer, slasherClient: SlasherClient, blockBuilderFactory: BlockBuilderFactory, l2BlockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, publicProcessorFactory: PublicProcessorFactory, contractDataSource: ContractDataSource, l1Constants: SequencerRollupConstants, dateProvider: DateProvider,
|
|
64
|
+
globalsBuilder: GlobalVariableBuilder, p2pClient: P2P, worldState: WorldStateSynchronizer, slasherClient: SlasherClient, blockBuilderFactory: BlockBuilderFactory, l2BlockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, publicProcessorFactory: PublicProcessorFactory, contractDataSource: ContractDataSource, l1Constants: SequencerRollupConstants, dateProvider: DateProvider, config?: SequencerConfig, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
76
65
|
get tracer(): Tracer;
|
|
77
66
|
/**
|
|
78
67
|
* Updates sequencer config.
|
|
@@ -110,7 +99,6 @@ export declare class Sequencer {
|
|
|
110
99
|
protected doRealWork(): Promise<void>;
|
|
111
100
|
protected work(): Promise<void>;
|
|
112
101
|
mayProposeBlock(tipArchive: Buffer, proposalBlockNumber: bigint): Promise<bigint>;
|
|
113
|
-
doIHaveEnoughTimeLeft(proposedState: SequencerState, secondsIntoSlot: number): boolean;
|
|
114
102
|
/**
|
|
115
103
|
* Sets the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
116
104
|
* @param proposedState - The new state to transition to.
|
|
@@ -131,7 +119,17 @@ export declare class Sequencer {
|
|
|
131
119
|
* @param historicalHeader - The historical header of the parent
|
|
132
120
|
* @param opts - Whether to just validate the block as a validator, as opposed to building it as a proposal
|
|
133
121
|
*/
|
|
134
|
-
|
|
122
|
+
protected buildBlock(pendingTxs: Iterable<Tx>, newGlobalVariables: GlobalVariables, opts?: {
|
|
123
|
+
validateOnly?: boolean;
|
|
124
|
+
}): Promise<{
|
|
125
|
+
block: L2Block;
|
|
126
|
+
publicGas: Gas;
|
|
127
|
+
publicProcessorDuration: number;
|
|
128
|
+
numMsgs: number;
|
|
129
|
+
numTxs: number;
|
|
130
|
+
numFailedTxs: number;
|
|
131
|
+
blockBuildingTimer: Timer;
|
|
132
|
+
}>;
|
|
135
133
|
/**
|
|
136
134
|
* @notice Build and propose a block to the chain
|
|
137
135
|
*
|
|
@@ -140,7 +138,6 @@ export declare class Sequencer {
|
|
|
140
138
|
*
|
|
141
139
|
* @param pendingTxs - Iterable of pending transactions to construct the block from
|
|
142
140
|
* @param proposalHeader - The partial header constructed for the proposal
|
|
143
|
-
* @param historicalHeader - The historical header of the parent
|
|
144
141
|
*/
|
|
145
142
|
private buildBlockAndAttemptToPublish;
|
|
146
143
|
/** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,aAAa,EAElB,EAAE,EACF,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAkB,SAAS,EAAgC,MAAM,iCAAiC,CAAC;AAE/G,OAAO,EAIL,KAAK,kBAAkB,EAEvB,GAAG,EACH,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAW,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,MAAM,EAAiC,MAAM,yBAAyB,CAAC;AACvH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,8BAA8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