@aztec/sequencer-client 0.56.0 → 0.58.0
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/block_builder/index.d.ts +2 -2
- package/dest/block_builder/index.d.ts.map +1 -1
- package/dest/block_builder/light.d.ts +8 -12
- package/dest/block_builder/light.d.ts.map +1 -1
- package/dest/block_builder/light.js +11 -15
- package/dest/block_builder/orchestrator.d.ts +8 -11
- package/dest/block_builder/orchestrator.d.ts.map +1 -1
- package/dest/block_builder/orchestrator.js +3 -10
- package/dest/client/sequencer-client.d.ts +2 -2
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +3 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -9
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +2 -1
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +7 -2
- package/dest/publisher/index.d.ts +1 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -1
- package/dest/publisher/l1-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/l1-publisher-metrics.js +2 -1
- package/dest/publisher/l1-publisher.d.ts +52 -36
- package/dest/publisher/l1-publisher.d.ts.map +1 -1
- package/dest/publisher/l1-publisher.js +305 -117
- package/dest/publisher/utils.d.ts +1 -1
- package/dest/publisher/utils.js +1 -1
- package/dest/sequencer/sequencer.d.ts +6 -6
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +142 -88
- package/dest/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/tx_validator/gas_validator.js +7 -5
- package/dest/tx_validator/phases_validator.d.ts +1 -1
- package/dest/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/tx_validator/phases_validator.js +1 -1
- package/dest/tx_validator/tx_validator_factory.d.ts +9 -7
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +20 -10
- package/package.json +22 -19
- package/src/block_builder/index.ts +2 -2
- package/src/block_builder/light.ts +16 -24
- package/src/block_builder/orchestrator.ts +10 -18
- package/src/client/sequencer-client.ts +3 -9
- package/src/config.ts +10 -8
- package/src/global_variable_builder/global_builder.ts +1 -0
- package/src/publisher/config.ts +6 -1
- package/src/publisher/index.ts +1 -1
- package/src/publisher/l1-publisher-metrics.ts +1 -0
- package/src/publisher/l1-publisher.ts +435 -144
- package/src/publisher/utils.ts +1 -1
- package/src/sequencer/sequencer.ts +173 -108
- package/src/tx_validator/gas_validator.ts +6 -7
- package/src/tx_validator/phases_validator.ts +1 -1
- package/src/tx_validator/tx_validator_factory.ts +39 -15
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { type L2Block, type TxHash } from '@aztec/circuit-types';
|
|
3
|
-
import { EthAddress, type Header, type Proof } from '@aztec/circuits.js';
|
|
2
|
+
import { type EpochProofClaim, type EpochProofQuote, type L2Block, type TxHash } from '@aztec/circuit-types';
|
|
3
|
+
import { AZTEC_EPOCH_DURATION, EthAddress, type FeeRecipient, type Header, type Proof, type RootRollupPublicInputs } from '@aztec/circuits.js';
|
|
4
4
|
import { type Signature } from '@aztec/foundation/eth-signature';
|
|
5
|
-
import {
|
|
5
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
6
|
+
import { type Tuple } from '@aztec/foundation/serialize';
|
|
7
|
+
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
6
8
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
9
|
+
import { type Chain, type Client, type GetContractReturnType, type HttpTransport, type PrivateKeyAccount, type PublicActions, type PublicRpcSchema, type WalletActions, type WalletClient, type WalletRpcSchema } from 'viem';
|
|
10
|
+
import type * as chains from 'viem/chains';
|
|
7
11
|
import { type PublisherConfig, type TxSenderConfig } from './config.js';
|
|
8
12
|
/**
|
|
9
13
|
* Stats for a sent transaction.
|
|
10
14
|
*/
|
|
11
15
|
export type TransactionStats = {
|
|
16
|
+
/** Address of the sender. */
|
|
17
|
+
sender: string;
|
|
12
18
|
/** Hash of the transaction. */
|
|
13
19
|
transactionHash: string;
|
|
14
20
|
/** Size in bytes of the tx calldata */
|
|
@@ -23,41 +29,28 @@ export type MinimalTransactionReceipt = {
|
|
|
23
29
|
/** True if the tx was successful, false if reverted. */
|
|
24
30
|
status: boolean;
|
|
25
31
|
/** Hash of the transaction. */
|
|
26
|
-
transactionHash: string
|
|
32
|
+
transactionHash: `0x${string}`;
|
|
27
33
|
/** Effective gas used by the tx. */
|
|
28
34
|
gasUsed: bigint;
|
|
29
35
|
/** Effective gas price paid by the tx. */
|
|
30
36
|
gasPrice: bigint;
|
|
31
37
|
/** Logs emitted in this tx. */
|
|
32
38
|
logs: any[];
|
|
39
|
+
/** Block number in which this tx was mined. */
|
|
40
|
+
blockNumber: bigint;
|
|
33
41
|
};
|
|
34
|
-
/** Arguments to the
|
|
35
|
-
export type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Attestations */
|
|
47
|
-
attestations?: Signature[];
|
|
48
|
-
};
|
|
49
|
-
/** Arguments to the submitProof method of the rollup contract */
|
|
50
|
-
export type L1SubmitProofArgs = {
|
|
51
|
-
/** The L2 block header. */
|
|
52
|
-
header: Buffer;
|
|
53
|
-
/** A root of the archive tree after the L2 block is applied. */
|
|
54
|
-
archive: Buffer;
|
|
55
|
-
/** Identifier of the prover. */
|
|
56
|
-
proverId: Buffer;
|
|
57
|
-
/** The proof for the block. */
|
|
58
|
-
proof: Buffer;
|
|
59
|
-
/** The aggregation object for the block's proof. */
|
|
60
|
-
aggregationObject: Buffer;
|
|
42
|
+
/** Arguments to the submitEpochProof method of the rollup contract */
|
|
43
|
+
export type L1SubmitEpochProofArgs = {
|
|
44
|
+
epochSize: number;
|
|
45
|
+
previousArchive: Fr;
|
|
46
|
+
endArchive: Fr;
|
|
47
|
+
previousBlockHash: Fr;
|
|
48
|
+
endBlockHash: Fr;
|
|
49
|
+
endTimestamp: Fr;
|
|
50
|
+
outHash: Fr;
|
|
51
|
+
proverId: Fr;
|
|
52
|
+
fees: Tuple<FeeRecipient, typeof AZTEC_EPOCH_DURATION>;
|
|
53
|
+
proof: Proof;
|
|
61
54
|
};
|
|
62
55
|
/**
|
|
63
56
|
* Publishes L2 blocks to L1. This implementation does *not* retry a transaction in
|
|
@@ -72,13 +65,20 @@ export declare class L1Publisher {
|
|
|
72
65
|
private sleepTimeMs;
|
|
73
66
|
private interrupted;
|
|
74
67
|
private metrics;
|
|
75
|
-
|
|
68
|
+
protected log: import("@aztec/foundation/log").Logger;
|
|
76
69
|
private rollupContract;
|
|
77
70
|
private publicClient;
|
|
71
|
+
private walletClient;
|
|
78
72
|
private account;
|
|
79
73
|
static PROPOSE_GAS_GUESS: bigint;
|
|
74
|
+
static PROPOSE_AND_CLAIM_GAS_GUESS: bigint;
|
|
80
75
|
constructor(config: TxSenderConfig & PublisherConfig, client: TelemetryClient);
|
|
81
|
-
getSenderAddress():
|
|
76
|
+
getSenderAddress(): EthAddress;
|
|
77
|
+
getClient(): Client<HttpTransport, Chain, PrivateKeyAccount, [
|
|
78
|
+
...WalletRpcSchema,
|
|
79
|
+
...PublicRpcSchema
|
|
80
|
+
], PublicActions<HttpTransport, Chain> & WalletActions<Chain, PrivateKeyAccount>>;
|
|
81
|
+
getRollupContract(): GetContractReturnType<typeof RollupAbi, WalletClient<HttpTransport, chains.Chain, PrivateKeyAccount>>;
|
|
82
82
|
/**
|
|
83
83
|
* @notice Calls `canProposeAtTime` with the time of the next Ethereum block and the sender address
|
|
84
84
|
*
|
|
@@ -89,6 +89,11 @@ export declare class L1Publisher {
|
|
|
89
89
|
* @return blockNumber - The L2 block number of the next L2 block
|
|
90
90
|
*/
|
|
91
91
|
canProposeAtNextEthBlock(archive: Buffer): Promise<[bigint, bigint]>;
|
|
92
|
+
nextEpochToClaim(): Promise<bigint>;
|
|
93
|
+
getEpochForSlotNumber(slotNumber: bigint): Promise<bigint>;
|
|
94
|
+
getEpochToProve(): Promise<bigint | undefined>;
|
|
95
|
+
getProofClaim(): Promise<EpochProofClaim | undefined>;
|
|
96
|
+
validateProofQuote(quote: EpochProofQuote): Promise<EpochProofQuote | undefined>;
|
|
92
97
|
/**
|
|
93
98
|
* @notice Will call `validateHeader` to make sure that it is possible to propose
|
|
94
99
|
*
|
|
@@ -109,8 +114,16 @@ export declare class L1Publisher {
|
|
|
109
114
|
* @param block - L2 block to propose.
|
|
110
115
|
* @returns True once the tx has been confirmed and is successful, false on revert or interrupt, blocks otherwise.
|
|
111
116
|
*/
|
|
112
|
-
proposeL2Block(block: L2Block, attestations?: Signature[], txHashes?: TxHash[]): Promise<boolean>;
|
|
113
|
-
|
|
117
|
+
proposeL2Block(block: L2Block, attestations?: Signature[], txHashes?: TxHash[], proofQuote?: EpochProofQuote): Promise<boolean>;
|
|
118
|
+
private tryGetErrorFromRevertedTx;
|
|
119
|
+
submitEpochProof(args: {
|
|
120
|
+
epochNumber: number;
|
|
121
|
+
fromBlock: number;
|
|
122
|
+
toBlock: number;
|
|
123
|
+
publicInputs: RootRollupPublicInputs;
|
|
124
|
+
proof: Proof;
|
|
125
|
+
}): Promise<boolean>;
|
|
126
|
+
private validateEpochProofSubmission;
|
|
114
127
|
/**
|
|
115
128
|
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
116
129
|
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
|
@@ -120,8 +133,11 @@ export declare class L1Publisher {
|
|
|
120
133
|
interrupt(): void;
|
|
121
134
|
/** Restarts the publisher after calling `interrupt`. */
|
|
122
135
|
restart(): void;
|
|
123
|
-
private
|
|
136
|
+
private sendSubmitEpochProofTx;
|
|
137
|
+
private prepareProposeTx;
|
|
138
|
+
private getSubmitEpochProofArgs;
|
|
124
139
|
private sendProposeTx;
|
|
140
|
+
private sendProposeAndClaimTx;
|
|
125
141
|
/**
|
|
126
142
|
* Returns a tx receipt if the tx has been mined.
|
|
127
143
|
* @param txHash - Hash of the tx to look for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l1-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/l1-publisher.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"l1-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/l1-publisher.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,oBAAoB,EAEpB,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,KAAK,EAAqC,MAAM,6BAA6B,CAAC;AAG5F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,MAAM,EAGX,KAAK,qBAAqB,EAE1B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EAUrB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,a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