@aztec/sequencer-client 0.77.0-testnet-ignition.28 → 0.77.0-testnet-ignition.30
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 +2 -0
- package/dest/client/index.d.ts.map +1 -0
- package/dest/client/sequencer-client.d.ts +71 -0
- package/dest/client/sequencer-client.d.ts.map +1 -0
- package/dest/config.d.ts +29 -0
- package/dest/config.d.ts.map +1 -0
- package/dest/global_variable_builder/global_builder.d.ts +32 -0
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -0
- package/dest/global_variable_builder/index.d.ts +2 -0
- package/dest/global_variable_builder/index.d.ts.map +1 -0
- package/dest/index.d.ts +8 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/publisher/config.d.ts +35 -0
- package/dest/publisher/config.d.ts.map +1 -0
- package/dest/publisher/index.d.ts +2 -0
- package/dest/publisher/index.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts +25 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher.d.ts +152 -0
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -0
- package/dest/sequencer/allowed.d.ts +3 -0
- package/dest/sequencer/allowed.d.ts.map +1 -0
- package/dest/sequencer/config.d.ts +2 -0
- package/dest/sequencer/config.d.ts.map +1 -0
- package/dest/sequencer/index.d.ts +4 -0
- package/dest/sequencer/index.d.ts.map +1 -0
- package/dest/sequencer/metrics.d.ts +24 -0
- package/dest/sequencer/metrics.d.ts.map +1 -0
- package/dest/sequencer/sequencer.d.ts +180 -0
- package/dest/sequencer/sequencer.d.ts.map +1 -0
- package/dest/sequencer/timetable.d.ts +38 -0
- package/dest/sequencer/timetable.d.ts.map +1 -0
- package/dest/sequencer/utils.d.ts +48 -0
- package/dest/sequencer/utils.d.ts.map +1 -0
- package/dest/slasher/factory.d.ts +7 -0
- package/dest/slasher/factory.d.ts.map +1 -0
- package/dest/slasher/index.d.ts +3 -0
- package/dest/slasher/index.d.ts.map +1 -0
- package/dest/slasher/slasher_client.d.ts +75 -0
- package/dest/slasher/slasher_client.d.ts.map +1 -0
- package/dest/test/index.d.ts +17 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/tx_validator/archive_cache.d.ts +14 -0
- package/dest/tx_validator/archive_cache.d.ts.map +1 -0
- package/dest/tx_validator/gas_validator.d.ts +14 -0
- package/dest/tx_validator/gas_validator.d.ts.map +1 -0
- package/dest/tx_validator/nullifier_cache.d.ts +16 -0
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/tx_validator/phases_validator.d.ts +12 -0
- package/dest/tx_validator/phases_validator.d.ts.map +1 -0
- package/dest/tx_validator/test_utils.d.ts +23 -0
- package/dest/tx_validator/test_utils.d.ts.map +1 -0
- package/dest/tx_validator/tx_validator_factory.d.ts +18 -0
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
- package/package.json +25 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
2
|
+
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
+
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
|
+
import type { P2P } from '@aztec/p2p';
|
|
7
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
+
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
+
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
12
|
+
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
13
|
+
import type { ValidatorClient } from '@aztec/validator-client';
|
|
14
|
+
import type { SequencerClientConfig } from '../config.js';
|
|
15
|
+
import { SequencerPublisher } from '../publisher/index.js';
|
|
16
|
+
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
17
|
+
import type { SlasherClient } from '../slasher/index.js';
|
|
18
|
+
/**
|
|
19
|
+
* Encapsulates the full sequencer and publisher.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SequencerClient {
|
|
22
|
+
protected sequencer: Sequencer;
|
|
23
|
+
constructor(sequencer: Sequencer);
|
|
24
|
+
/**
|
|
25
|
+
* Initializes and starts a new instance.
|
|
26
|
+
* @param config - Configuration for the sequencer, publisher, and L1 tx sender.
|
|
27
|
+
* @param p2pClient - P2P client that provides the txs to be sequenced.
|
|
28
|
+
* @param validatorClient - Validator client performs attestation duties when rotating proposers.
|
|
29
|
+
* @param worldStateSynchronizer - Provides access to world state.
|
|
30
|
+
* @param contractDataSource - Provides access to contract bytecode for public executions.
|
|
31
|
+
* @param l2BlockSource - Provides information about the previously published blocks.
|
|
32
|
+
* @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
|
|
33
|
+
* @param prover - An instance of a block prover
|
|
34
|
+
* @param simulationProvider - An instance of a simulation provider
|
|
35
|
+
* @returns A new running instance.
|
|
36
|
+
*/
|
|
37
|
+
static new(config: SequencerClientConfig, deps: {
|
|
38
|
+
validatorClient: ValidatorClient | undefined;
|
|
39
|
+
p2pClient: P2P;
|
|
40
|
+
worldStateSynchronizer: WorldStateSynchronizer;
|
|
41
|
+
slasherClient: SlasherClient;
|
|
42
|
+
contractDataSource: ContractDataSource;
|
|
43
|
+
l2BlockSource: L2BlockSource;
|
|
44
|
+
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
45
|
+
telemetry: TelemetryClient;
|
|
46
|
+
publisher?: SequencerPublisher;
|
|
47
|
+
blobSinkClient?: BlobSinkClientInterface;
|
|
48
|
+
dateProvider: DateProvider;
|
|
49
|
+
epochCache?: EpochCache;
|
|
50
|
+
l1TxUtils?: L1TxUtilsWithBlobs;
|
|
51
|
+
}): Promise<SequencerClient>;
|
|
52
|
+
/**
|
|
53
|
+
* Updates sequencer config.
|
|
54
|
+
* @param config - New parameters.
|
|
55
|
+
*/
|
|
56
|
+
updateSequencerConfig(config: SequencerConfig): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Stops the sequencer from processing new txs.
|
|
59
|
+
*/
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
/** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
|
|
62
|
+
flush(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Restarts the sequencer after being stopped.
|
|
65
|
+
*/
|
|
66
|
+
restart(): void;
|
|
67
|
+
get coinbase(): EthAddress;
|
|
68
|
+
get feeRecipient(): AztecAddress;
|
|
69
|
+
get forwarderAddress(): EthAddress;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=sequencer-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa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MAAM,EAAE,eAAe;IAIpD;;OAEG;IACU,IAAI;IAIjB,uGAAuG;IAChG,KAAK;IAIZ;;OAEG;IACI,OAAO;IAId,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,gBAAgB,IAAI,UAAU,CAEjC;CACF"}
|
package/dest/config.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
|
|
2
|
+
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
3
|
+
import { type AllowedElement, type ChainConfig, type SequencerConfig } from '@aztec/stdlib/config';
|
|
4
|
+
import { type PublisherConfig, type TxSenderConfig } from './publisher/config.js';
|
|
5
|
+
export * from './publisher/config.js';
|
|
6
|
+
export type { SequencerConfig };
|
|
7
|
+
/**
|
|
8
|
+
* Configuration settings for the SequencerClient.
|
|
9
|
+
*/
|
|
10
|
+
export type SequencerClientConfig = PublisherConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
11
|
+
export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
|
|
12
|
+
export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getConfigEnvVars(): SequencerClientConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Parses a string to a list of allowed elements.
|
|
19
|
+
* Each encoded is expected to be of one of the following formats
|
|
20
|
+
* `I:${address}`
|
|
21
|
+
* `I:${address}:${selector}`
|
|
22
|
+
* `C:${classId}`
|
|
23
|
+
* `C:${classId}:${selector}`
|
|
24
|
+
*
|
|
25
|
+
* @param value The string to parse
|
|
26
|
+
* @returns A list of allowed elements
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseSequencerAllowList(value: string): AllowedElement[];
|
|
29
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AAExH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GACjD,cAAc,GACd,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAyEvE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAOnF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAqCvE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
6
|
+
import type { GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
|
|
7
|
+
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
8
|
+
/**
|
|
9
|
+
* Simple global variables builder.
|
|
10
|
+
*/
|
|
11
|
+
export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
12
|
+
private log;
|
|
13
|
+
private rollupContract;
|
|
14
|
+
private publicClient;
|
|
15
|
+
private ethereumSlotDuration;
|
|
16
|
+
constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
|
|
17
|
+
/**
|
|
18
|
+
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
19
|
+
* @returns Base fees for the expected next block
|
|
20
|
+
*/
|
|
21
|
+
getCurrentBaseFees(): Promise<GasFees>;
|
|
22
|
+
/**
|
|
23
|
+
* Simple builder of global variables that use the minimum time possible.
|
|
24
|
+
* @param blockNumber - The block number to build global variables for.
|
|
25
|
+
* @param coinbase - The address to receive block reward.
|
|
26
|
+
* @param feeRecipient - The address to receive fees.
|
|
27
|
+
* @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
|
|
28
|
+
* @returns The global variables for the given block number.
|
|
29
|
+
*/
|
|
30
|
+
buildGlobalVariables(blockNumber: Fr, coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber?: bigint): Promise<GlobalVariables>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=global_builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,8BAA8B;IAC1E,OAAO,CAAC,GAAG,CAAqD;IAEhE,OAAO,CAAC,cAAc,CAA4D;IAClF,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAoBpF;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAanD;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC;CA8B5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dest/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './client/index.js';
|
|
2
|
+
export * from './config.js';
|
|
3
|
+
export * from './publisher/index.js';
|
|
4
|
+
export * from './tx_validator/tx_validator_factory.js';
|
|
5
|
+
export * from './slasher/index.js';
|
|
6
|
+
export { Sequencer, SequencerState, getDefaultAllowedSetupFunctions } from './sequencer/index.js';
|
|
7
|
+
export * from './global_variable_builder/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAIlG,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BlobSinkConfig } from '@aztec/blob-sink/client';
|
|
2
|
+
import { type L1ReaderConfig, type L1TxUtilsConfig } from '@aztec/ethereum';
|
|
3
|
+
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
/**
|
|
6
|
+
* The configuration of the rollup transaction publisher.
|
|
7
|
+
*/
|
|
8
|
+
export type TxSenderConfig = L1ReaderConfig & {
|
|
9
|
+
/**
|
|
10
|
+
* The private key to be used by the publisher.
|
|
11
|
+
*/
|
|
12
|
+
publisherPrivateKey: `0x${string}`;
|
|
13
|
+
/**
|
|
14
|
+
* The number of confirmations required.
|
|
15
|
+
*/
|
|
16
|
+
requiredConfirmations: number;
|
|
17
|
+
/**
|
|
18
|
+
* The address of the custom forwarder contract.
|
|
19
|
+
*/
|
|
20
|
+
customForwarderContractAddress: EthAddress;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Configuration of the L1Publisher.
|
|
24
|
+
*/
|
|
25
|
+
export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
|
|
26
|
+
/**
|
|
27
|
+
* The interval to wait between publish retries.
|
|
28
|
+
*/
|
|
29
|
+
l1PublishRetryIntervalMS: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const getTxSenderConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>>;
|
|
32
|
+
export declare function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'>;
|
|
33
|
+
export declare const getPublisherConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig>;
|
|
34
|
+
export declare function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig;
|
|
35
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAIrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,mBAAmB,EAAE,KAAK,MAAM,EAAE,CAAC;IAEnC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,8BAA8B,EAAE,UAAU,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAC3C,cAAc,GAAG;IACf;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,yBAAyB,EAAE,CACtC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAoBzD,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAErG;AAED,eAAO,MAAM,0BAA0B,EAAE,CACvC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,eAAe,GAAG,eAAe,CASvD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,eAAe,CAElF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { L1PublishBlockStats } from '@aztec/stdlib/stats';
|
|
2
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
+
export type L1TxType = 'process';
|
|
4
|
+
export declare class SequencerPublisherMetrics {
|
|
5
|
+
private logger;
|
|
6
|
+
private gasPrice;
|
|
7
|
+
private txCount;
|
|
8
|
+
private txDuration;
|
|
9
|
+
private txGas;
|
|
10
|
+
private txCalldataSize;
|
|
11
|
+
private txCalldataGas;
|
|
12
|
+
private txBlobDataGasUsed;
|
|
13
|
+
private txBlobDataGasCost;
|
|
14
|
+
private readonly blobCountHistogram;
|
|
15
|
+
private readonly blobInclusionBlocksHistogram;
|
|
16
|
+
private readonly blobTxSuccessCounter;
|
|
17
|
+
private readonly blobTxFailureCounter;
|
|
18
|
+
private senderBalance;
|
|
19
|
+
constructor(client: TelemetryClient, name?: string, logger?: import("@aztec/aztec.js").Logger);
|
|
20
|
+
recordFailedTx(txType: L1TxType): void;
|
|
21
|
+
recordProcessBlockTx(durationMs: number, stats: L1PublishBlockStats): void;
|
|
22
|
+
recordSenderBalance(wei: bigint, senderAddress: string): void;
|
|
23
|
+
private recordTx;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sequencer-publisher-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencer-publisher-metrics.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEjC,qBAAa,yBAAyB;IAqBlC,OAAO,CAAC,MAAM;IApBhB,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAY;IACzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IAErD,OAAO,CAAC,aAAa,CAAQ;gBAG3B,MAAM,EAAE,eAAe,EACvB,IAAI,SAAuB,EACnB,MAAM,mCAA8C;IA6E9D,cAAc,CAAC,MAAM,EAAE,QAAQ;IAW/B,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAcnE,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAOtD,OAAO,CAAC,QAAQ;CA6BjB"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { L2Block } from '@aztec/aztec.js';
|
|
4
|
+
import { Blob } from '@aztec/blob-lib';
|
|
5
|
+
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
6
|
+
import type { EpochCache } from '@aztec/epoch-cache';
|
|
7
|
+
import { type ForwarderContract, type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type SlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
8
|
+
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
9
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
11
|
+
import { type BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
12
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
13
|
+
import { type TransactionReceipt } from 'viem';
|
|
14
|
+
import type { PublisherConfig, TxSenderConfig } from './config.js';
|
|
15
|
+
export declare enum VoteType {
|
|
16
|
+
GOVERNANCE = 0,
|
|
17
|
+
SLASHING = 1
|
|
18
|
+
}
|
|
19
|
+
type GetSlashPayloadCallBack = (slotNumber: bigint) => Promise<EthAddress | undefined>;
|
|
20
|
+
type Action = 'propose' | 'governance-vote' | 'slashing-vote';
|
|
21
|
+
interface RequestWithExpiry {
|
|
22
|
+
action: Action;
|
|
23
|
+
request: L1TxRequest;
|
|
24
|
+
lastValidL2Slot: bigint;
|
|
25
|
+
gasConfig?: L1GasConfig;
|
|
26
|
+
blobConfig?: L1BlobInputs;
|
|
27
|
+
onResult?: (request: L1TxRequest, result?: {
|
|
28
|
+
receipt: TransactionReceipt;
|
|
29
|
+
gasPrice: GasPrice;
|
|
30
|
+
stats?: TransactionStats;
|
|
31
|
+
errorMsg?: string;
|
|
32
|
+
}) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare class SequencerPublisher {
|
|
35
|
+
private interrupted;
|
|
36
|
+
private metrics;
|
|
37
|
+
private epochCache;
|
|
38
|
+
private forwarderContract;
|
|
39
|
+
protected governanceLog: import("@aztec/aztec.js").Logger;
|
|
40
|
+
protected governanceProposerAddress?: EthAddress;
|
|
41
|
+
private governancePayload;
|
|
42
|
+
protected slashingLog: import("@aztec/aztec.js").Logger;
|
|
43
|
+
protected slashingProposerAddress?: EthAddress;
|
|
44
|
+
private getSlashPayload?;
|
|
45
|
+
private myLastVotes;
|
|
46
|
+
protected log: import("@aztec/aztec.js").Logger;
|
|
47
|
+
protected ethereumSlotDuration: bigint;
|
|
48
|
+
private blobSinkClient;
|
|
49
|
+
static PROPOSE_GAS_GUESS: bigint;
|
|
50
|
+
l1TxUtils: L1TxUtilsWithBlobs;
|
|
51
|
+
rollupContract: RollupContract;
|
|
52
|
+
govProposerContract: GovernanceProposerContract;
|
|
53
|
+
slashingProposerContract: SlashingProposerContract;
|
|
54
|
+
protected requests: RequestWithExpiry[];
|
|
55
|
+
constructor(config: TxSenderConfig & PublisherConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>, deps: {
|
|
56
|
+
telemetry?: TelemetryClient;
|
|
57
|
+
blobSinkClient?: BlobSinkClientInterface;
|
|
58
|
+
forwarderContract: ForwarderContract;
|
|
59
|
+
l1TxUtils: L1TxUtilsWithBlobs;
|
|
60
|
+
rollupContract: RollupContract;
|
|
61
|
+
slashingProposerContract: SlashingProposerContract;
|
|
62
|
+
governanceProposerContract: GovernanceProposerContract;
|
|
63
|
+
epochCache: EpochCache;
|
|
64
|
+
});
|
|
65
|
+
registerSlashPayloadGetter(callback: GetSlashPayloadCallBack): void;
|
|
66
|
+
getForwarderAddress(): EthAddress;
|
|
67
|
+
getSenderAddress(): EthAddress;
|
|
68
|
+
getGovernancePayload(): EthAddress;
|
|
69
|
+
setGovernancePayload(payload: EthAddress): void;
|
|
70
|
+
addRequest(request: RequestWithExpiry): void;
|
|
71
|
+
getCurrentL2Slot(): bigint;
|
|
72
|
+
/**
|
|
73
|
+
* Sends all requests that are still valid.
|
|
74
|
+
* @returns one of:
|
|
75
|
+
* - A receipt and stats if the tx succeeded
|
|
76
|
+
* - a receipt and errorMsg if it failed on L1
|
|
77
|
+
* - undefined if no valid requests are found OR the tx failed to send.
|
|
78
|
+
*/
|
|
79
|
+
sendRequests(): Promise<{
|
|
80
|
+
receipt: TransactionReceipt<bigint, number, "success" | "reverted", import("viem").TransactionType>;
|
|
81
|
+
gasPrice: GasPrice;
|
|
82
|
+
stats: TransactionStats | undefined;
|
|
83
|
+
errorMsg?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
receipt: TransactionReceipt<bigint, number, "success" | "reverted", import("viem").TransactionType>;
|
|
86
|
+
gasPrice: GasPrice;
|
|
87
|
+
errorMsg: string | undefined;
|
|
88
|
+
stats?: undefined;
|
|
89
|
+
} | undefined>;
|
|
90
|
+
private callbackBundledTransactions;
|
|
91
|
+
/**
|
|
92
|
+
* @notice Will call `canProposeAtNextEthBlock` to make sure that it is possible to propose
|
|
93
|
+
* @param tipArchive - The archive to check
|
|
94
|
+
* @returns The slot and block number if it is possible to propose, undefined otherwise
|
|
95
|
+
*/
|
|
96
|
+
canProposeAtNextEthBlock(tipArchive: Buffer): Promise<[bigint, bigint] | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* @notice Will call `validateHeader` to make sure that it is possible to propose
|
|
99
|
+
*
|
|
100
|
+
* @dev Throws if unable to propose
|
|
101
|
+
*
|
|
102
|
+
* @param header - The header to propose
|
|
103
|
+
* @param digest - The digest that attestations are signing over
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
validateBlockForSubmission(header: BlockHeader, attestationData?: {
|
|
107
|
+
digest: Buffer;
|
|
108
|
+
signatures: Signature[];
|
|
109
|
+
}): Promise<bigint>;
|
|
110
|
+
getCurrentEpochCommittee(): Promise<EthAddress[]>;
|
|
111
|
+
private enqueueCastVoteHelper;
|
|
112
|
+
private getVoteConfig;
|
|
113
|
+
/**
|
|
114
|
+
* Enqueues a castVote transaction to cast a vote for a given slot number.
|
|
115
|
+
* @param slotNumber - The slot number to cast a vote for.
|
|
116
|
+
* @param timestamp - The timestamp of the slot to cast a vote for.
|
|
117
|
+
* @param voteType - The type of vote to cast.
|
|
118
|
+
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
119
|
+
*/
|
|
120
|
+
enqueueCastVote(slotNumber: bigint, timestamp: bigint, voteType: VoteType): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Proposes a L2 block on L1.
|
|
123
|
+
*
|
|
124
|
+
* @param block - L2 block to propose.
|
|
125
|
+
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
126
|
+
*/
|
|
127
|
+
enqueueProposeL2Block(block: L2Block, attestations?: Signature[], txHashes?: TxHash[], opts?: {
|
|
128
|
+
txTimeoutAt?: Date;
|
|
129
|
+
}): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
132
|
+
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
|
133
|
+
* In practice this shouldn't matter, as we'll only ever be calling `interrupt` when we know it's going to fail.
|
|
134
|
+
* A call to `restart` is required before you can continue publishing.
|
|
135
|
+
*/
|
|
136
|
+
interrupt(): void;
|
|
137
|
+
/** Restarts the publisher after calling `interrupt`. */
|
|
138
|
+
restart(): void;
|
|
139
|
+
private prepareProposeTx;
|
|
140
|
+
private addProposeTx;
|
|
141
|
+
/**
|
|
142
|
+
* Send blobs to the blob sink
|
|
143
|
+
*
|
|
144
|
+
* If a blob sink url is configured, then we send blobs to the blob sink
|
|
145
|
+
* - for now we use the blockHash as the identifier for the blobs;
|
|
146
|
+
* In the future this will move to be the beacon block id - which takes a bit more work
|
|
147
|
+
* to calculate and will need to be mocked in e2e tests
|
|
148
|
+
*/
|
|
149
|
+
protected sendBlobsToBlobSink(blockHash: string, blobs: Blob[]): Promise<boolean>;
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=sequencer-publisher.d.ts.map
|
|
@@ -0,0 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,CAAC,OAAO,CAAC;IA8BnB;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;YAKA,gBAAgB;YAiGhB,YAAY;IAsE1B;;;;;;;OAOG;IACH,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowed.d.ts","sourceRoot":"","sources":["../../src/sequencer/allowed.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CA2BjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/sequencer/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sequencer/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
2
|
+
import { type SequencerState, type SequencerStateCallback } from './utils.js';
|
|
3
|
+
export declare class SequencerMetrics {
|
|
4
|
+
readonly tracer: Tracer;
|
|
5
|
+
private blockCounter;
|
|
6
|
+
private blockBuildDuration;
|
|
7
|
+
private blockBuildManaPerSecond;
|
|
8
|
+
private stateTransitionBufferDuration;
|
|
9
|
+
private currentBlockNumber;
|
|
10
|
+
private currentBlockSize;
|
|
11
|
+
private blockBuilderInsertions;
|
|
12
|
+
private timeToCollectAttestations;
|
|
13
|
+
constructor(client: TelemetryClient, getState: SequencerStateCallback, name?: string);
|
|
14
|
+
startCollectingAttestationsTimer(): () => void;
|
|
15
|
+
recordTimeToCollectAttestations(time: number): void;
|
|
16
|
+
recordBlockBuilderTreeInsertions(timeUs: number): void;
|
|
17
|
+
recordCancelledBlock(): void;
|
|
18
|
+
recordBuiltBlock(buildDurationMs: number, totalMana: number): void;
|
|
19
|
+
recordFailedBlock(): void;
|
|
20
|
+
recordNewBlock(blockNumber: number, txCount: number): void;
|
|
21
|
+
recordStateTransitionBufferMs(durationMs: number, state: SequencerState): void;
|
|
22
|
+
private setCurrentBlock;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAA0B,MAAM,YAAY,CAAC;AAEtG,qBAAa,gBAAgB;IAC3B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IACjD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,sBAAsB,CAAY;IAE1C,OAAO,CAAC,yBAAyB,CAAQ;gBAE7B,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,SAAc;IAyDzF,gCAAgC,IAAI,MAAM,IAAI;IAS9C,+BAA+B,CAAC,IAAI,EAAE,MAAM;IAI5C,gCAAgC,CAAC,MAAM,EAAE,MAAM;IAI/C,oBAAoB;IAOpB,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ3D,iBAAiB;IAOjB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAInD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;IAMvE,OAAO,CAAC,eAAe;CAIxB"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { L2Block } from '@aztec/aztec.js';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
6
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
7
|
+
import { type DateProvider, Timer } from '@aztec/foundation/timer';
|
|
8
|
+
import type { P2P } from '@aztec/p2p';
|
|
9
|
+
import type { BlockBuilderFactory } from '@aztec/prover-client/block-builder';
|
|
10
|
+
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
11
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
+
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
13
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
14
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
15
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
16
|
+
import { type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
17
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
18
|
+
import { type GlobalVariables, Tx, type TxHash } from '@aztec/stdlib/tx';
|
|
19
|
+
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
20
|
+
import type { ValidatorClient } from '@aztec/validator-client';
|
|
21
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
|
|
22
|
+
import { type SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
23
|
+
import type { SlasherClient } from '../slasher/slasher_client.js';
|
|
24
|
+
import type { SequencerConfig } from './config.js';
|
|
25
|
+
import { SequencerTimetable } from './timetable.js';
|
|
26
|
+
import { SequencerState } from './utils.js';
|
|
27
|
+
export { SequencerState };
|
|
28
|
+
type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration'>;
|
|
29
|
+
/**
|
|
30
|
+
* Sequencer client
|
|
31
|
+
* - Wins a period of time to become the sequencer (depending on finalized protocol).
|
|
32
|
+
* - Chooses a set of txs from the tx pool to be in the rollup.
|
|
33
|
+
* - Simulate the rollup of txs.
|
|
34
|
+
* - Adds proof requests to the request pool (not for this milestone).
|
|
35
|
+
* - Receives results to those proofs from the network (repeats as necessary) (not for this milestone).
|
|
36
|
+
* - Publishes L1 tx(s) to the rollup contract via RollupPublisher.
|
|
37
|
+
*/
|
|
38
|
+
export declare class Sequencer {
|
|
39
|
+
protected publisher: SequencerPublisher;
|
|
40
|
+
protected validatorClient: ValidatorClient | undefined;
|
|
41
|
+
protected globalsBuilder: GlobalVariableBuilder;
|
|
42
|
+
protected p2pClient: P2P;
|
|
43
|
+
protected worldState: WorldStateSynchronizer;
|
|
44
|
+
protected slasherClient: SlasherClient;
|
|
45
|
+
protected blockBuilderFactory: BlockBuilderFactory;
|
|
46
|
+
protected l2BlockSource: L2BlockSource;
|
|
47
|
+
protected l1ToL2MessageSource: L1ToL2MessageSource;
|
|
48
|
+
protected publicProcessorFactory: PublicProcessorFactory;
|
|
49
|
+
protected contractDataSource: ContractDataSource;
|
|
50
|
+
protected l1Constants: SequencerRollupConstants;
|
|
51
|
+
protected dateProvider: DateProvider;
|
|
52
|
+
protected config: SequencerConfig;
|
|
53
|
+
protected log: import("@aztec/aztec.js").Logger;
|
|
54
|
+
private runningPromise?;
|
|
55
|
+
private pollingIntervalMs;
|
|
56
|
+
private maxTxsPerBlock;
|
|
57
|
+
private minTxsPerBlock;
|
|
58
|
+
private maxL1TxInclusionTimeIntoSlot;
|
|
59
|
+
private _coinbase;
|
|
60
|
+
private _feeRecipient;
|
|
61
|
+
private state;
|
|
62
|
+
private allowedInSetup;
|
|
63
|
+
private maxBlockSizeInBytes;
|
|
64
|
+
private maxBlockGas;
|
|
65
|
+
private metrics;
|
|
66
|
+
private isFlushing;
|
|
67
|
+
/** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */
|
|
68
|
+
protected timetable: SequencerTimetable;
|
|
69
|
+
protected enforceTimeTable: boolean;
|
|
70
|
+
constructor(publisher: SequencerPublisher, validatorClient: ValidatorClient | undefined, // During migration the validator client can be inactive
|
|
71
|
+
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/aztec.js").Logger);
|
|
72
|
+
get tracer(): Tracer;
|
|
73
|
+
/**
|
|
74
|
+
* Updates sequencer config.
|
|
75
|
+
* @param config - New parameters.
|
|
76
|
+
*/
|
|
77
|
+
updateConfig(config: SequencerConfig): Promise<void>;
|
|
78
|
+
private setTimeTable;
|
|
79
|
+
/**
|
|
80
|
+
* Starts the sequencer and moves to IDLE state.
|
|
81
|
+
*/
|
|
82
|
+
start(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Stops the sequencer from processing txs and moves to STOPPED state.
|
|
85
|
+
*/
|
|
86
|
+
stop(): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Starts a previously stopped sequencer.
|
|
89
|
+
*/
|
|
90
|
+
restart(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the current state of the sequencer.
|
|
93
|
+
* @returns An object with a state entry with one of SequencerState.
|
|
94
|
+
*/
|
|
95
|
+
status(): {
|
|
96
|
+
state: SequencerState;
|
|
97
|
+
};
|
|
98
|
+
/** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
|
|
99
|
+
flush(): void;
|
|
100
|
+
/**
|
|
101
|
+
* @notice Performs most of the sequencer duties:
|
|
102
|
+
* - Checks if we are up to date
|
|
103
|
+
* - If we are and we are the sequencer, collect txs and build a block
|
|
104
|
+
* - Collect attestations for the block
|
|
105
|
+
* - Submit block
|
|
106
|
+
* - If our block for some reason is not included, revert the state
|
|
107
|
+
*/
|
|
108
|
+
protected doRealWork(): Promise<void>;
|
|
109
|
+
protected work(): Promise<void>;
|
|
110
|
+
getForwarderAddress(): EthAddress;
|
|
111
|
+
/**
|
|
112
|
+
* Checks if we can propose at the next block and returns the slot number if we can.
|
|
113
|
+
* @param tipArchive - The archive of the previous block.
|
|
114
|
+
* @param proposalBlockNumber - The block number of the proposal.
|
|
115
|
+
* @returns The slot number if we can propose at the next block, otherwise undefined.
|
|
116
|
+
*/
|
|
117
|
+
slotForProposal(tipArchive: Buffer, proposalBlockNumber: bigint): Promise<bigint | undefined>;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
120
|
+
* @param proposedState - The new state to transition to.
|
|
121
|
+
* @param currentSlotNumber - The current slot number.
|
|
122
|
+
* @param force - Whether to force the transition even if the sequencer is stopped.
|
|
123
|
+
*
|
|
124
|
+
* @dev If the `currentSlotNumber` doesn't matter (e.g. transitioning to IDLE), pass in `0n`;
|
|
125
|
+
* it is only used to check if we have enough time left in the slot to transition to the new state.
|
|
126
|
+
*/
|
|
127
|
+
setState(proposedState: SequencerState, currentSlotNumber: bigint, force?: boolean): void;
|
|
128
|
+
/**
|
|
129
|
+
* Build a block
|
|
130
|
+
*
|
|
131
|
+
* Shared between the sequencer and the validator for re-execution
|
|
132
|
+
*
|
|
133
|
+
* @param pendingTxs - The pending transactions to construct the block from
|
|
134
|
+
* @param newGlobalVariables - The global variables for the new block
|
|
135
|
+
* @param historicalHeader - The historical header of the parent
|
|
136
|
+
* @param opts - Whether to just validate the block as a validator, as opposed to building it as a proposal
|
|
137
|
+
*/
|
|
138
|
+
protected buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, newGlobalVariables: GlobalVariables, opts?: {
|
|
139
|
+
validateOnly?: boolean;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
block: L2Block;
|
|
142
|
+
publicGas: Gas;
|
|
143
|
+
publicProcessorDuration: number;
|
|
144
|
+
numMsgs: number;
|
|
145
|
+
numTxs: number;
|
|
146
|
+
numFailedTxs: number;
|
|
147
|
+
blockBuildingTimer: Timer;
|
|
148
|
+
}>;
|
|
149
|
+
/**
|
|
150
|
+
* @notice Build and propose a block to the chain
|
|
151
|
+
*
|
|
152
|
+
* @dev MUST throw instead of exiting early to ensure that world-state
|
|
153
|
+
* is being rolled back if the block is dropped.
|
|
154
|
+
*
|
|
155
|
+
* @param pendingTxs - Iterable of pending transactions to construct the block from
|
|
156
|
+
* @param proposalHeader - The partial header constructed for the proposal
|
|
157
|
+
*/
|
|
158
|
+
private buildBlockAndEnqueuePublish;
|
|
159
|
+
protected collectAttestations(block: L2Block, txHashes: TxHash[]): Promise<Signature[] | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* Publishes the L2Block to the rollup contract.
|
|
162
|
+
* @param block - The L2Block to be published.
|
|
163
|
+
*/
|
|
164
|
+
protected enqueuePublishL2Block(block: L2Block, attestations?: Signature[], txHashes?: TxHash[]): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Returns whether all dependencies have caught up.
|
|
167
|
+
* We don't check against the previous block submitted since it may have been reorg'd out.
|
|
168
|
+
* @returns Boolean indicating if our dependencies are synced to the latest block.
|
|
169
|
+
*/
|
|
170
|
+
protected getChainTip(): Promise<{
|
|
171
|
+
blockNumber: number;
|
|
172
|
+
archive: Fr;
|
|
173
|
+
} | undefined>;
|
|
174
|
+
private getSlotStartTimestamp;
|
|
175
|
+
private getSecondsIntoSlot;
|
|
176
|
+
get aztecSlotDuration(): number;
|
|
177
|
+
get coinbase(): EthAddress;
|
|
178
|
+
get feeRecipient(): AztecAddress;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=sequencer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAW,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAGL,KAAK,sBAAsB,EAE5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAGL,KAAK,eAAe,EAEpB,EAAE,EACF,KAAK,MAAM,EACZ,MA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|
3
|
+
export declare class SequencerTimetable {
|
|
4
|
+
private readonly ethereumSlotDuration;
|
|
5
|
+
private readonly aztecSlotDuration;
|
|
6
|
+
private readonly maxL1TxInclusionTimeIntoSlot;
|
|
7
|
+
private readonly enforce;
|
|
8
|
+
private readonly metrics?;
|
|
9
|
+
private readonly log;
|
|
10
|
+
/** How late into the slot can we be to start working */
|
|
11
|
+
readonly initialTime = 3;
|
|
12
|
+
/** How long it takes to get ready to start building */
|
|
13
|
+
readonly blockPrepareTime = 1;
|
|
14
|
+
/** How long it takes to for proposals and attestations to travel across the p2p layer (one-way) */
|
|
15
|
+
readonly attestationPropagationTime = 2;
|
|
16
|
+
/** How much time we spend validating and processing a block after building it, and assembling the proposal to send to attestors */
|
|
17
|
+
readonly blockValidationTime = 1;
|
|
18
|
+
/**
|
|
19
|
+
* How long it takes to get a published block into L1. L1 builders typically accept txs up to 4 seconds into their slot,
|
|
20
|
+
* but we'll timeout sooner to give it more time to propagate (remember we also have blobs!). Still, when working in anvil,
|
|
21
|
+
* we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
|
|
22
|
+
*/
|
|
23
|
+
readonly l1PublishingTime: number;
|
|
24
|
+
constructor(ethereumSlotDuration: number, aztecSlotDuration: number, maxL1TxInclusionTimeIntoSlot: number, enforce?: boolean, metrics?: SequencerMetrics | undefined, log?: import("@aztec/aztec.js").Logger);
|
|
25
|
+
private get afterBlockBuildingTimeNeededWithoutReexec();
|
|
26
|
+
getBlockProposalExecTimeEnd(secondsIntoSlot: number): number;
|
|
27
|
+
private get afterBlockReexecTimeNeeded();
|
|
28
|
+
getValidatorReexecTimeEnd(secondsIntoSlot: number): number;
|
|
29
|
+
getMaxAllowedTime(state: SequencerState): number | undefined;
|
|
30
|
+
assertTimeLeft(newState: SequencerState, secondsIntoSlot: number): void;
|
|
31
|
+
}
|
|
32
|
+
export declare class SequencerTooSlowError extends Error {
|
|
33
|
+
readonly proposedState: SequencerState;
|
|
34
|
+
readonly maxAllowedTime: number;
|
|
35
|
+
readonly currentTime: number;
|
|
36
|
+
constructor(proposedState: SequencerState, maxAllowedTime: number, currentTime: number);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=timetable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,qBAAa,kBAAkB;IAqB3B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,4BAA4B;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAzBtB,wDAAwD;IACxD,SAAgB,WAAW,KAAK;IAEhC,uDAAuD;IACvD,SAAgB,gBAAgB,KAAK;IAErC,mGAAmG;IACnG,SAAgB,0BAA0B,KAAK;IAE/C,mIAAmI;IACnI,SAAgB,mBAAmB,KAAK;IAExC;;;;OAIG;IACH,SAAgB,gBAAgB,SAAC;gBAGd,oBAAoB,EAAE,MAAM,EAC5B,iBAAiB,EAAE,MAAM,EACzB,4BAA4B,EAAE,MAAM,EACpC,OAAO,GAAE,OAAc,EACvB,OAAO,CAAC,8BAAkB,EAC1B,GAAG,mCAAsC;IAK5D,OAAO,KAAK,yCAAyC,GAEpD;IAEM,2BAA2B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAenE,OAAO,KAAK,0BAA0B,GAErC;IAEM,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAU1D,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAsB5D,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;CAkBxE;AAED,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,aAAa,EAAE,cAAc;aAC7B,cAAc,EAAE,MAAM;aACtB,WAAW,EAAE,MAAM;gBAFnB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM;CAOtC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
3
|
+
import type { BlockAttestation } from '@aztec/stdlib/p2p';
|
|
4
|
+
export declare enum SequencerState {
|
|
5
|
+
/**
|
|
6
|
+
* Sequencer is stopped and not processing any txs from the pool.
|
|
7
|
+
*/
|
|
8
|
+
STOPPED = "STOPPED",
|
|
9
|
+
/**
|
|
10
|
+
* Sequencer is awaiting the next call to work().
|
|
11
|
+
*/
|
|
12
|
+
IDLE = "IDLE",
|
|
13
|
+
/**
|
|
14
|
+
* Synchronizing with the L2 chain.
|
|
15
|
+
*/
|
|
16
|
+
SYNCHRONIZING = "SYNCHRONIZING",
|
|
17
|
+
/**
|
|
18
|
+
* Checking if we are the proposer for the current slot.
|
|
19
|
+
*/
|
|
20
|
+
PROPOSER_CHECK = "PROPOSER_CHECK",
|
|
21
|
+
/**
|
|
22
|
+
* Initializing the block proposal. Will move to CREATING_BLOCK if there are valid txs to include, or back to SYNCHRONIZING otherwise.
|
|
23
|
+
*/
|
|
24
|
+
INITIALIZING_PROPOSAL = "INITIALIZING_PROPOSAL",
|
|
25
|
+
/**
|
|
26
|
+
* Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
|
|
27
|
+
*/
|
|
28
|
+
CREATING_BLOCK = "CREATING_BLOCK",
|
|
29
|
+
/**
|
|
30
|
+
* Collecting attestations from its peers. Will move to PUBLISHING_BLOCK.
|
|
31
|
+
*/
|
|
32
|
+
COLLECTING_ATTESTATIONS = "COLLECTING_ATTESTATIONS",
|
|
33
|
+
/**
|
|
34
|
+
* Sending the tx to L1 with the L2 block data and awaiting it to be mined. Will move to SYNCHRONIZING.
|
|
35
|
+
*/
|
|
36
|
+
PUBLISHING_BLOCK = "PUBLISHING_BLOCK"
|
|
37
|
+
}
|
|
38
|
+
export type SequencerStateCallback = () => SequencerState;
|
|
39
|
+
export declare function sequencerStateToNumber(state: SequencerState): number;
|
|
40
|
+
/** Order Attestations
|
|
41
|
+
*
|
|
42
|
+
* Returns attestation signatures in the order of a series of provided ethereum addresses
|
|
43
|
+
* The rollup smart contract expects attestations to appear in the order of the committee
|
|
44
|
+
*
|
|
45
|
+
* @todo: perform this logic within the memory attestation store instead?
|
|
46
|
+
*/
|
|
47
|
+
export declare function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]): Promise<Signature[]>;
|
|
48
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,oBAAY,cAAc;IACxB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,aAAa,kBAAkB;IAC/B;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,qBAAqB,0BAA0B;IAC/C;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,uBAAuB,4BAA4B;IACnD;;OAEG;IACH,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,gBAAgB,EAAE,EAChC,cAAc,EAAE,UAAU,EAAE,GAC3B,OAAO,CAAC,SAAS,EAAE,CAAC,CAkBtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { L1ContractsConfig, L1ReaderConfig } from '@aztec/ethereum';
|
|
2
|
+
import type { L2BlockSourceEventEmitter } from '@aztec/stdlib/block';
|
|
3
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
4
|
+
import { SlasherClient } from './slasher_client.js';
|
|
5
|
+
import type { SlasherConfig } from './slasher_client.js';
|
|
6
|
+
export declare const createSlasherClient: (_config: SlasherConfig & L1ContractsConfig & L1ReaderConfig, l2BlockSource: L2BlockSourceEventEmitter, telemetry?: TelemetryClient) => SlasherClient;
|
|
7
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/slasher/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,mBAAmB,YACrB,aAAa,GAAG,iBAAiB,GAAG,cAAc,iBAC5C,yBAAyB,cAC7B,eAAe,kBAI3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slasher/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type L1ContractsConfig, type L1ReaderConfig, type ViemPublicClient } from '@aztec/ethereum';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { SlashFactoryAbi } from '@aztec/l1-artifacts';
|
|
4
|
+
import { type L2BlockId, type L2BlockSourceEvent, type L2BlockSourceEventEmitter } from '@aztec/stdlib/block';
|
|
5
|
+
import { type TelemetryClient, WithTracer } from '@aztec/telemetry-client';
|
|
6
|
+
import { type GetContractReturnType } from 'viem';
|
|
7
|
+
/**
|
|
8
|
+
* Enum defining the possible states of the Slasher client.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum SlasherClientState {
|
|
11
|
+
IDLE = 0,
|
|
12
|
+
RUNNING = 1,
|
|
13
|
+
STOPPED = 2
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The synchronization status of the Slasher client.
|
|
17
|
+
*/
|
|
18
|
+
export interface SlasherSyncState {
|
|
19
|
+
/**
|
|
20
|
+
* The current state of the slasher client.
|
|
21
|
+
*/
|
|
22
|
+
state: SlasherClientState;
|
|
23
|
+
/**
|
|
24
|
+
* The block number that the slasher client is synced to.
|
|
25
|
+
*/
|
|
26
|
+
syncedToL2Block: L2BlockId;
|
|
27
|
+
}
|
|
28
|
+
export interface SlasherConfig {
|
|
29
|
+
blockCheckIntervalMS: number;
|
|
30
|
+
blockRequestBatchSize: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @notice A Hypomeiones slasher client implementation
|
|
34
|
+
*
|
|
35
|
+
* Hypomeiones: a class of individuals in ancient Sparta who were considered inferior or lesser citizens compared
|
|
36
|
+
* to the full Spartan citizens.
|
|
37
|
+
*
|
|
38
|
+
* The implementation here is less than ideal. It exists, not to be the end all be all, but to show that
|
|
39
|
+
* slashing can be done with this mechanism.
|
|
40
|
+
*
|
|
41
|
+
* The implementation is VERY brute in the sense that it only looks for pruned blocks and then tries to slash
|
|
42
|
+
* the full committee of that.
|
|
43
|
+
* If it sees a prune, it will mark the full epoch as "to be slashed".
|
|
44
|
+
*
|
|
45
|
+
* Also, it is not particularly smart around what it should if there were to be multiple slashing events.
|
|
46
|
+
*
|
|
47
|
+
* A few improvements:
|
|
48
|
+
* - Only vote on the proposal if it is possible to reach, e.g., if 6 votes are needed and only 4 slots are left don't vote.
|
|
49
|
+
* - Stop voting on a payload once it is processed.
|
|
50
|
+
* - Only vote on the proposal if it have not already been executed
|
|
51
|
+
* - Caveat, we need to fully decide if it is acceptable to have the same payload address multiple times. In the current
|
|
52
|
+
* slash factory that could mean slashing the same committee for the same error multiple times.
|
|
53
|
+
* - Decide how to deal with multiple slashing events in the same round.
|
|
54
|
+
* - This could be that multiple epochs are pruned in the same round, but with the current naive implementation we could end up
|
|
55
|
+
* slashing only the first, because the "lifetime" of the second would have passed after that vote
|
|
56
|
+
*/
|
|
57
|
+
export declare class SlasherClient extends WithTracer {
|
|
58
|
+
private config;
|
|
59
|
+
private l2BlockSource;
|
|
60
|
+
private log;
|
|
61
|
+
private slashEvents;
|
|
62
|
+
protected slashFactoryContract?: GetContractReturnType<typeof SlashFactoryAbi, ViemPublicClient>;
|
|
63
|
+
private slashingAmount;
|
|
64
|
+
constructor(config: SlasherConfig & L1ContractsConfig & L1ReaderConfig, l2BlockSource: L2BlockSourceEventEmitter, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
65
|
+
start(): void;
|
|
66
|
+
getSlashPayload(slotNumber: bigint): Promise<EthAddress | undefined>;
|
|
67
|
+
handleBlockStreamEvent(event: L2BlockSourceEvent): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Allows consumers to stop the instance of the slasher client.
|
|
70
|
+
* 'ready' will now return 'false' and the running promise that keeps the client synced is interrupted.
|
|
71
|
+
*/
|
|
72
|
+
stop(): void;
|
|
73
|
+
private handlePruneL2Blocks;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=slasher_client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slasher_client.d.ts","sourceRoot":"","sources":["../../src/slasher/slasher_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAE/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,eAAe,EAAE,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,KAAK,qBAAqB,EAA+D,MAAM,MAAM,CAAC;AAE/G;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;CACR;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAQD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,aAAc,SAAQ,UAAU;IAWzC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IAErB,OAAO,CAAC,GAAG;IAbb,OAAO,CAAC,WAAW,CAAoB;IAEvC,SAAS,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,CAAC,OAAO,eAAe,EAAE,gBAAgB,CAAC,CAAa;IAK7G,OAAO,CAAC,cAAc,CAAc;gBAG1B,MAAM,EAAE,aAAa,GAAG,iBAAiB,GAAG,cAAc,EAC1D,aAAa,EAAE,yBAAyB,EAChD,SAAS,GAAE,eAAsC,EACzC,GAAG,yCAA0B;IAwBhC,KAAK;IAMC,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IA8B1E,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAavE;;;OAGG;IACI,IAAI;IAOX,OAAO,CAAC,mBAAmB;CAgB5B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
2
|
+
import { SequencerClient } from '../client/sequencer-client.js';
|
|
3
|
+
import type { SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
4
|
+
import { Sequencer } from '../sequencer/sequencer.js';
|
|
5
|
+
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
6
|
+
declare class TestSequencer_ extends Sequencer {
|
|
7
|
+
publicProcessorFactory: PublicProcessorFactory;
|
|
8
|
+
timetable: SequencerTimetable;
|
|
9
|
+
publisher: SequencerPublisher;
|
|
10
|
+
}
|
|
11
|
+
export type TestSequencer = TestSequencer_;
|
|
12
|
+
declare class TestSequencerClient_ extends SequencerClient {
|
|
13
|
+
sequencer: TestSequencer;
|
|
14
|
+
}
|
|
15
|
+
export type TestSequencerClient = TestSequencerClient_;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;IACpB,sBAAsB,EAAG,sBAAsB,CAAC;IAChD,SAAS,EAAG,kBAAkB,CAAC;IAC/B,SAAS,EAAG,kBAAkB,CAAC;CAChD;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,cAAM,oBAAqB,SAAQ,eAAe;IAChC,SAAS,EAAG,aAAa,CAAC;CAC3C;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { ArchiveSource } from '@aztec/p2p';
|
|
3
|
+
import type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
|
+
/**
|
|
5
|
+
* Implements an archive source by checking a DB and an in-memory collection.
|
|
6
|
+
* Intended for validating transactions as they are added to a block.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ArchiveCache implements ArchiveSource {
|
|
9
|
+
private db;
|
|
10
|
+
archives: Map<string, bigint>;
|
|
11
|
+
constructor(db: MerkleTreeReadOperations);
|
|
12
|
+
getArchiveIndices(archives: Fr[]): Promise<(bigint | undefined)[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=archive_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive_cache.d.ts","sourceRoot":"","sources":["../../src/tx_validator/archive_cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAGhF;;;GAGG;AACH,qBAAa,YAAa,YAAW,aAAa;IAGpC,OAAO,CAAC,EAAE;IAFtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEV,EAAE,EAAE,wBAAwB;IAInC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAWhF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
4
|
+
import { type Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
5
|
+
/** Provides a view into public contract state */
|
|
6
|
+
export interface PublicStateSource {
|
|
7
|
+
storageRead: (contractAddress: AztecAddress, slot: Fr) => Promise<Fr>;
|
|
8
|
+
}
|
|
9
|
+
export declare class GasTxValidator implements TxValidator<Tx> {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(publicDataSource: PublicStateSource, feeJuiceAddress: AztecAddress, gasFees: GasFees);
|
|
12
|
+
validateTx(tx: Tx): Promise<TxValidationResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=gas_validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gas_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/gas_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,EAAoB,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExG,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;CACvE;AAED,qBAAa,cAAe,YAAW,WAAW,CAAC,EAAE,CAAC;;gBAMxC,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO;IAM1F,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA0EtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { NullifierSource } from '@aztec/p2p';
|
|
4
|
+
import type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
/**
|
|
6
|
+
* Implements a nullifier source by checking a DB and an in-memory collection.
|
|
7
|
+
* Intended for validating transactions as they are added to a block.
|
|
8
|
+
*/
|
|
9
|
+
export declare class NullifierCache implements NullifierSource {
|
|
10
|
+
private db;
|
|
11
|
+
nullifiers: Set<string>;
|
|
12
|
+
constructor(db: MerkleTreeReadOperations);
|
|
13
|
+
nullifiersExist(nullifiers: Buffer[]): Promise<boolean[]>;
|
|
14
|
+
addNullifiers(nullifiers: Buffer[]): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=nullifier_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullifier_cache.d.ts","sourceRoot":"","sources":["../../src/tx_validator/nullifier_cache.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAGhF;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAGxC,OAAO,CAAC,EAAE;IAFtB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEJ,EAAE,EAAE,wBAAwB;IAInC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAS/D,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE;CAK1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
2
|
+
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
3
|
+
import { type PublicExecutionRequest, Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
|
+
export declare class PhasesTxValidator implements TxValidator<Tx> {
|
|
5
|
+
#private;
|
|
6
|
+
private setupAllowList;
|
|
7
|
+
private contractDataSource;
|
|
8
|
+
constructor(contracts: ContractDataSource, setupAllowList: AllowedElement[]);
|
|
9
|
+
validateTx(tx: Tx): Promise<TxValidationResult>;
|
|
10
|
+
isOnAllowList(publicCall: PublicExecutionRequest, allowList: AllowedElement[]): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=phases_validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phases_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/phases_validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACL,KAAK,sBAAsB,EAC3B,EAAE,EAEF,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,WAAW,CAAC,EAAE,CAAC;;IAIZ,OAAO,CAAC,cAAc;IAFjE,OAAO,CAAC,kBAAkB,CAA8B;gBAE5C,SAAS,EAAE,kBAAkB,EAAU,cAAc,EAAE,cAAc,EAAE;IAI7E,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgC/C,aAAa,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CA6CvG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { Tx } from '@aztec/stdlib/tx';
|
|
5
|
+
export declare function patchNonRevertibleFn(tx: Tx, index: number, overrides: {
|
|
6
|
+
address?: AztecAddress;
|
|
7
|
+
selector: FunctionSelector;
|
|
8
|
+
args?: Fr[];
|
|
9
|
+
msgSender?: AztecAddress;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
address: AztecAddress;
|
|
12
|
+
selector: FunctionSelector;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function patchRevertibleFn(tx: Tx, index: number, overrides: {
|
|
15
|
+
address?: AztecAddress;
|
|
16
|
+
selector: FunctionSelector;
|
|
17
|
+
args?: Fr[];
|
|
18
|
+
msgSender?: AztecAddress;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
address: AztecAddress;
|
|
21
|
+
selector: FunctionSelector;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=test_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_utils.d.ts","sourceRoot":"","sources":["../../src/tx_validator/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,EACb,SAAS,EAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,GACvG,OAAO,CAAC;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAEhE;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,EACb,SAAS,EAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,GACvG,OAAO,CAAC;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAEhE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
2
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
3
|
+
import type { AllowedElement, ClientProtocolCircuitVerifier, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
|
+
import { GlobalVariables, type ProcessedTx, type Tx, type TxValidator } from '@aztec/stdlib/tx';
|
|
5
|
+
import { NullifierCache } from './nullifier_cache.js';
|
|
6
|
+
export declare function createValidatorForAcceptingTxs(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, verifier: ClientProtocolCircuitVerifier | undefined, { blockNumber, l1ChainId, setupAllowList, gasFees, skipFeeEnforcement, }: {
|
|
7
|
+
blockNumber: number;
|
|
8
|
+
l1ChainId: number;
|
|
9
|
+
setupAllowList: AllowedElement[];
|
|
10
|
+
gasFees: GasFees;
|
|
11
|
+
skipFeeEnforcement?: boolean;
|
|
12
|
+
}): TxValidator<Tx>;
|
|
13
|
+
export declare function createValidatorsForBlockBuilding(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, globalVariables: GlobalVariables, setupAllowList: AllowedElement[]): {
|
|
14
|
+
preprocessValidator: TxValidator<Tx>;
|
|
15
|
+
postprocessValidator: TxValidator<ProcessedTx>;
|
|
16
|
+
nullifierCache: NullifierCache;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=tx_validator_factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx_validator_factory.d.ts","sourceRoot":"","sources":["../../src/tx_validator/tx_validator_factory.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIhG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,6BAA6B,GAAG,SAAS,EACnD,EACE,WAAW,EACX,SAAS,EACT,cAAc,EACd,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GACA,WAAW,CAAC,EAAE,CAAC,CAkBjB;AAED,wBAAgB,gCAAgC,CAC9C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAE,GAC/B;IACD,mBAAmB,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IACrC,oBAAoB,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAC/C,cAAc,EAAE,cAAc,CAAC;CAChC,CAiBA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.77.0-testnet-ignition.
|
|
3
|
+
"version": "0.77.0-testnet-ignition.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/aztec.js": "0.77.0-testnet-ignition.
|
|
32
|
-
"@aztec/bb-prover": "0.77.0-testnet-ignition.
|
|
33
|
-
"@aztec/blob-lib": "0.77.0-testnet-ignition.
|
|
34
|
-
"@aztec/blob-sink": "0.77.0-testnet-ignition.
|
|
35
|
-
"@aztec/constants": "0.77.0-testnet-ignition.
|
|
36
|
-
"@aztec/epoch-cache": "0.77.0-testnet-ignition.
|
|
37
|
-
"@aztec/ethereum": "0.77.0-testnet-ignition.
|
|
38
|
-
"@aztec/foundation": "0.77.0-testnet-ignition.
|
|
39
|
-
"@aztec/l1-artifacts": "0.77.0-testnet-ignition.
|
|
40
|
-
"@aztec/merkle-tree": "0.77.0-testnet-ignition.
|
|
41
|
-
"@aztec/noir-contracts.js": "0.77.0-testnet-ignition.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.
|
|
43
|
-
"@aztec/p2p": "0.77.0-testnet-ignition.
|
|
44
|
-
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.
|
|
45
|
-
"@aztec/prover-client": "0.77.0-testnet-ignition.
|
|
46
|
-
"@aztec/simulator": "0.77.0-testnet-ignition.
|
|
47
|
-
"@aztec/stdlib": "0.77.0-testnet-ignition.
|
|
48
|
-
"@aztec/telemetry-client": "0.77.0-testnet-ignition.
|
|
49
|
-
"@aztec/validator-client": "0.77.0-testnet-ignition.
|
|
50
|
-
"@aztec/world-state": "0.77.0-testnet-ignition.
|
|
31
|
+
"@aztec/aztec.js": "0.77.0-testnet-ignition.30",
|
|
32
|
+
"@aztec/bb-prover": "0.77.0-testnet-ignition.30",
|
|
33
|
+
"@aztec/blob-lib": "0.77.0-testnet-ignition.30",
|
|
34
|
+
"@aztec/blob-sink": "0.77.0-testnet-ignition.30",
|
|
35
|
+
"@aztec/constants": "0.77.0-testnet-ignition.30",
|
|
36
|
+
"@aztec/epoch-cache": "0.77.0-testnet-ignition.30",
|
|
37
|
+
"@aztec/ethereum": "0.77.0-testnet-ignition.30",
|
|
38
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.30",
|
|
39
|
+
"@aztec/l1-artifacts": "0.77.0-testnet-ignition.30",
|
|
40
|
+
"@aztec/merkle-tree": "0.77.0-testnet-ignition.30",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.77.0-testnet-ignition.30",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.30",
|
|
43
|
+
"@aztec/p2p": "0.77.0-testnet-ignition.30",
|
|
44
|
+
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.30",
|
|
45
|
+
"@aztec/prover-client": "0.77.0-testnet-ignition.30",
|
|
46
|
+
"@aztec/simulator": "0.77.0-testnet-ignition.30",
|
|
47
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.30",
|
|
48
|
+
"@aztec/telemetry-client": "0.77.0-testnet-ignition.30",
|
|
49
|
+
"@aztec/validator-client": "0.77.0-testnet-ignition.30",
|
|
50
|
+
"@aztec/world-state": "0.77.0-testnet-ignition.30",
|
|
51
51
|
"lodash.chunk": "^4.2.0",
|
|
52
52
|
"lodash.pick": "^4.4.0",
|
|
53
53
|
"tslib": "^2.4.0",
|
|
54
54
|
"viem": "2.22.8",
|
|
55
|
-
"@aztec/noir-acvm_js": "0.77.0-testnet-ignition.
|
|
56
|
-
"@aztec/noir-types": "0.77.0-testnet-ignition.
|
|
55
|
+
"@aztec/noir-acvm_js": "0.77.0-testnet-ignition.30",
|
|
56
|
+
"@aztec/noir-types": "0.77.0-testnet-ignition.30"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.77.0-testnet-ignition.
|
|
60
|
-
"@aztec/kv-store": "0.77.0-testnet-ignition.
|
|
59
|
+
"@aztec/archiver": "0.77.0-testnet-ignition.30",
|
|
60
|
+
"@aztec/kv-store": "0.77.0-testnet-ignition.30",
|
|
61
61
|
"@jest/globals": "^29.5.0",
|
|
62
62
|
"@types/jest": "^29.5.0",
|
|
63
63
|
"@types/levelup": "^5.1.2",
|