@aztec/ethereum 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5a9928
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.d.ts +27 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +63 -8
- package/dest/config.d.ts +17 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +38 -10
- package/dest/contracts/chain_state_override.d.ts +78 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +137 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +656 -0
- package/dest/contracts/governance.d.ts +135 -35
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +229 -18
- package/dest/contracts/governance_proposer.d.ts +33 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +54 -6
- package/dest/contracts/gse.d.ts +4 -2
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/gse.js +2 -2
- package/dest/contracts/inbox.d.ts +3 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +12 -7
- package/dest/contracts/index.d.ts +4 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +3 -2
- package/dest/contracts/multicall.d.ts +127 -12
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +201 -94
- package/dest/contracts/outbox.d.ts +27 -4
- package/dest/contracts/outbox.d.ts.map +1 -1
- package/dest/contracts/outbox.js +34 -7
- package/dest/contracts/registry.d.ts +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +5437 -34
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +448 -104
- package/dest/contracts/slashing_proposer.d.ts +171 -0
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/slashing_proposer.js +753 -0
- package/dest/contracts/watch_event.d.ts +36 -0
- package/dest/contracts/watch_event.d.ts.map +1 -0
- package/dest/contracts/watch_event.js +66 -0
- package/dest/deploy_aztec_l1_contracts.d.ts +5 -9
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +48 -27
- package/dest/deploy_l1_contract.js +3 -3
- package/dest/foundry_binary.d.ts +13 -0
- package/dest/foundry_binary.d.ts.map +1 -0
- package/dest/foundry_binary.js +52 -0
- package/dest/generated/l1-contracts-defaults.d.ts +3 -3
- package/dest/generated/l1-contracts-defaults.js +3 -3
- package/dest/l1_artifacts.d.ts +15524 -15847
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +61 -65
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +101 -82
- package/dest/l1_reader.d.ts +5 -5
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +9 -7
- package/dest/l1_tx_utils/config.d.ts +7 -1
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +17 -4
- package/dest/l1_tx_utils/factory.d.ts +18 -10
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +17 -7
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +15 -15
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +9 -15
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -3
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/index-blobs.js +2 -2
- package/dest/l1_tx_utils/index.d.ts +2 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +156 -79
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +57 -23
- package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +67 -37
- package/dest/publisher_manager.d.ts +34 -8
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +119 -8
- package/dest/queries.d.ts +13 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +62 -3
- package/dest/test/blob_kzg_warmup.d.ts +19 -0
- package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
- package/dest/test/blob_kzg_warmup.js +64 -0
- package/dest/test/chain_monitor.d.ts +55 -4
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +104 -3
- package/dest/test/eth_cheat_codes.d.ts +31 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +67 -44
- package/dest/test/index.d.ts +2 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -2
- package/dest/test/recording_rpc_server.d.ts +18 -0
- package/dest/test/recording_rpc_server.d.ts.map +1 -0
- package/dest/test/recording_rpc_server.js +68 -0
- package/dest/test/rollup_cheat_codes.d.ts +60 -3
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +86 -7
- package/dest/test/start_anvil.d.ts +23 -3
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +182 -32
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/utils.d.ts +9 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +59 -24
- package/package.json +6 -8
- package/src/client.ts +72 -2
- package/src/config.ts +58 -14
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/fee_asset_price_oracle.ts +285 -0
- package/src/contracts/governance.ts +313 -13
- package/src/contracts/governance_proposer.ts +58 -9
- package/src/contracts/gse.ts +7 -2
- package/src/contracts/inbox.ts +13 -5
- package/src/contracts/index.ts +3 -2
- package/src/contracts/multicall.ts +243 -105
- package/src/contracts/outbox.ts +42 -8
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +507 -109
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +119 -45
- package/src/contracts/watch_event.ts +110 -0
- package/src/deploy_aztec_l1_contracts.ts +75 -39
- package/src/deploy_l1_contract.ts +3 -3
- package/src/foundry_binary.ts +57 -0
- package/src/generated/l1-contracts-defaults.ts +3 -3
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +120 -94
- package/src/l1_reader.ts +17 -10
- package/src/l1_tx_utils/config.ts +23 -3
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +1 -1
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +1 -1
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +43 -54
- package/src/l1_tx_utils/index-blobs.ts +2 -2
- package/src/l1_tx_utils/index.ts +1 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +149 -64
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +57 -17
- package/src/{test → l1_tx_utils}/tx_delayer.ts +93 -56
- package/src/publisher_manager.ts +143 -12
- package/src/queries.ts +70 -4
- package/src/test/blob_kzg_warmup.ts +65 -0
- package/src/test/chain_monitor.ts +148 -3
- package/src/test/eth_cheat_codes.ts +63 -47
- package/src/test/index.ts +1 -2
- package/src/test/recording_rpc_server.ts +69 -0
- package/src/test/rollup_cheat_codes.ts +115 -6
- package/src/test/start_anvil.ts +212 -32
- package/src/test/upgrade_utils.ts +2 -2
- package/src/utils.ts +56 -29
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -67
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -207
- package/dest/contracts/tally_slashing_proposer.d.ts +0 -140
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/tally_slashing_proposer.js +0 -320
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
- package/dest/test/delayed_tx_utils.d.ts +0 -13
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -28
- package/dest/test/tx_delayer.d.ts +0 -36
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/src/contracts/empire_slashing_proposer.ts +0 -259
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
|
@@ -3,13 +3,13 @@ import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
|
3
3
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
4
4
|
import { getContract } from 'viem';
|
|
5
5
|
import { extractProposalIdFromLogs } from '../contracts/governance.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createL1TxUtils } from '../l1_tx_utils/index.js';
|
|
7
7
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
8
8
|
export async function executeGovernanceProposal(proposalId, governance, voteAmount, privateKey, l1Client, rpcUrls, logger) {
|
|
9
9
|
const proposal = await governance.read.getProposal([
|
|
10
10
|
proposalId
|
|
11
11
|
]);
|
|
12
|
-
const l1TxUtils =
|
|
12
|
+
const l1TxUtils = createL1TxUtils(l1Client);
|
|
13
13
|
const waitL1Block = async ()=>{
|
|
14
14
|
await l1TxUtils.sendAndMonitorTransaction({
|
|
15
15
|
to: l1Client.account.address,
|
package/dest/utils.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface L2Claim {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class FormattedViemError extends Error {
|
|
11
11
|
metaMessages?: any[];
|
|
12
|
-
constructor(message: string, metaMessages?: any[]);
|
|
12
|
+
constructor(message: string, metaMessages?: any[], options?: ErrorOptions);
|
|
13
13
|
}
|
|
14
14
|
export declare function extractEvent<const TAbi extends Abi | readonly unknown[], TEventName extends ContractEventName<TAbi>, TEventType = DecodeEventLogReturnType<TAbi, TEventName, Hex[], undefined, true>>(logs: Log[], address: Hex, abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, logger?: Logger): TEventType;
|
|
15
15
|
export declare function tryExtractEvent<const TAbi extends Abi | readonly unknown[], TEventName extends ContractEventName<TAbi>, TEventType = DecodeEventLogReturnType<TAbi, TEventName, Hex[], undefined, true>>(logs: Log[], address: Hex, abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, logger?: Logger): TEventType | undefined;
|
|
@@ -22,6 +22,13 @@ export declare function mergeAbis(abis: Abi[]): Abi;
|
|
|
22
22
|
* @returns A FormattedViemError instance.
|
|
23
23
|
*/
|
|
24
24
|
export declare function formatViemError(error: any, abi?: Abi): FormattedViemError;
|
|
25
|
+
/**
|
|
26
|
+
* Best-effort decode of a raw revert payload (`0x...`) against an ABI.
|
|
27
|
+
* Returns a human-readable `ErrorName(arg1, arg2, ...)` string, or `undefined` if the selector
|
|
28
|
+
* is unknown or the payload is empty. Use to surface decoded error names alongside the raw
|
|
29
|
+
* payload in log lines for operators.
|
|
30
|
+
*/
|
|
31
|
+
export declare function tryDecodeRevertReason(data: Hex | undefined, abi: Abi): string | undefined;
|
|
25
32
|
export declare function tryGetCustomErrorName(err: any): string | undefined;
|
|
26
33
|
/**
|
|
27
34
|
* Type guard to check if a transaction is a blob transaction (EIP-4844).
|
|
@@ -35,4 +42,4 @@ export declare function isBlobTransaction(tx: FormattedTransaction): tx is Forma
|
|
|
35
42
|
* Calculates a percentile from an array of bigints
|
|
36
43
|
*/
|
|
37
44
|
export declare function calculatePercentile(values: bigint[], percentile: number): bigint;
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUdwRCxPQUFPLEVBQ0wsS0FBSyxHQUFHLEVBR1IsS0FBSyxpQkFBaUIsRUFFdEIsS0FBSyx3QkFBd0IsRUFDN0IsS0FBSyxvQkFBb0IsRUFDekIsS0FBSyxHQUFHLEVBQ1IsS0FBSyxHQUFHLEVBR1QsTUFBTSxNQUFNLENBQUM7QUFHZCxNQUFNLFdBQVcsT0FBTztJQUN0QixXQUFXLEVBQUUsRUFBRSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLENBQUM7SUFDaEIsV0FBVyxFQUFFLEdBQUcsQ0FBQztJQUNqQixnQkFBZ0IsRUFBRSxNQUFNLENBQUM7Q0FDMUI7QUFFRCxxQkFBYSxrQkFBbUIsU0FBUSxLQUFLO0lBQzNDLFlBQVksQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFDO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,EAAE,GAAG,sBAa7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,oBAAoB,GAAG,EAAE,IAAI,oBAAoB,GAAG;IACxF,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,SAAS,GAAG,EAAE,CAAC;CACrC,CAOA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAOhF"}
|
package/dest/utils.js
CHANGED
|
@@ -3,8 +3,8 @@ import { BaseError, ContractFunctionRevertedError, decodeErrorResult, decodeEven
|
|
|
3
3
|
import { formatAbiItem, formatAbiParams } from 'viem/utils';
|
|
4
4
|
export class FormattedViemError extends Error {
|
|
5
5
|
metaMessages;
|
|
6
|
-
constructor(message, metaMessages){
|
|
7
|
-
super(message);
|
|
6
|
+
constructor(message, metaMessages, options){
|
|
7
|
+
super(message, options);
|
|
8
8
|
this.name = 'FormattedViemError';
|
|
9
9
|
this.metaMessages = metaMessages;
|
|
10
10
|
}
|
|
@@ -112,6 +112,19 @@ function getNestedErrorData(error) {
|
|
|
112
112
|
// Not found
|
|
113
113
|
return undefined;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Truncates an error message to a safe length for log renderers.
|
|
117
|
+
* LogExplorer can only render up to 2500 characters in its summary view.
|
|
118
|
+
* We cap at 2000 to leave room for decorating context added by callers.
|
|
119
|
+
*/ function truncateErrorMessage(message) {
|
|
120
|
+
const MAX = 2000;
|
|
121
|
+
const CHUNK = 950;
|
|
122
|
+
if (message.length <= MAX) {
|
|
123
|
+
return message;
|
|
124
|
+
}
|
|
125
|
+
const truncated = message.length - 2 * CHUNK;
|
|
126
|
+
return message.slice(0, CHUNK) + `...${truncated} characters truncated...` + message.slice(-CHUNK);
|
|
127
|
+
}
|
|
115
128
|
/**
|
|
116
129
|
* Formats a Viem error into a FormattedViemError instance.
|
|
117
130
|
* @param error - The error to format.
|
|
@@ -122,6 +135,7 @@ function getNestedErrorData(error) {
|
|
|
122
135
|
if (error instanceof FormattedViemError) {
|
|
123
136
|
return error;
|
|
124
137
|
}
|
|
138
|
+
const originalError = error;
|
|
125
139
|
// First try to decode as a custom error using the ABI
|
|
126
140
|
try {
|
|
127
141
|
const data = getNestedErrorData(error);
|
|
@@ -132,7 +146,9 @@ function getNestedErrorData(error) {
|
|
|
132
146
|
data: data
|
|
133
147
|
});
|
|
134
148
|
if (decoded) {
|
|
135
|
-
return new FormattedViemError(`${decoded.errorName}(${decoded.args?.join(', ') ?? ''})`, error?.metaMessages
|
|
149
|
+
return new FormattedViemError(`${decoded.errorName}(${decoded.args?.join(', ') ?? ''})`, error?.metaMessages, {
|
|
150
|
+
cause: originalError
|
|
151
|
+
});
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
154
|
// If it's a BaseError, try to get the custom error through ContractFunctionRevertedError
|
|
@@ -144,36 +160,36 @@ function getNestedErrorData(error) {
|
|
|
144
160
|
errorName = revertError.signature ?? '';
|
|
145
161
|
}
|
|
146
162
|
const args = revertError.metaMessages && revertError.metaMessages?.length > 1 ? revertError.metaMessages[1].trimStart() : '';
|
|
147
|
-
return new FormattedViemError(`${errorName}${args}`, error?.metaMessages
|
|
163
|
+
return new FormattedViemError(`${errorName}${args}`, error?.metaMessages, {
|
|
164
|
+
cause: originalError
|
|
165
|
+
});
|
|
148
166
|
}
|
|
149
167
|
}
|
|
150
168
|
} catch {
|
|
151
169
|
// If decoding fails, we fall back to the original formatting
|
|
152
170
|
}
|
|
153
|
-
// Strip ABI from the error object before formatting
|
|
171
|
+
// Strip ABI from the error object before formatting. We clone first to avoid mutating the
|
|
172
|
+
// caller's error, but structuredClone throws DataCloneError on values it cannot clone (e.g.
|
|
173
|
+
// viem RPC errors carrying function-valued request context). If cloning fails, fall back to
|
|
174
|
+
// formatting the original error untouched rather than letting the clone failure mask it.
|
|
154
175
|
if (error && typeof error === 'object') {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
//
|
|
161
|
-
|
|
176
|
+
try {
|
|
177
|
+
const errorClone = structuredClone(error);
|
|
178
|
+
stripAbis(errorClone);
|
|
179
|
+
error = errorClone;
|
|
180
|
+
} catch {
|
|
181
|
+
// Leave `error` as the original; we skip stripAbis to avoid mutating the caller's object.
|
|
182
|
+
}
|
|
162
183
|
}
|
|
163
184
|
// If it's a regular Error instance, return it with its message
|
|
164
185
|
if (error instanceof Error) {
|
|
165
|
-
return new FormattedViemError(error.message, error?.metaMessages
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const chunk = 950;
|
|
173
|
-
const truncated = length - 2 * chunk;
|
|
174
|
-
return new FormattedViemError(body.slice(0, chunk) + `...${truncated} characters truncated...` + body.slice(-1 * chunk));
|
|
175
|
-
}
|
|
176
|
-
return new FormattedViemError(body);
|
|
186
|
+
return new FormattedViemError(truncateErrorMessage(error.message), error?.metaMessages, {
|
|
187
|
+
cause: originalError
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return new FormattedViemError(truncateErrorMessage(String(error)), undefined, {
|
|
191
|
+
cause: originalError
|
|
192
|
+
});
|
|
177
193
|
}
|
|
178
194
|
function stripAbis(obj) {
|
|
179
195
|
if (!obj || typeof obj !== 'object') {
|
|
@@ -194,6 +210,25 @@ function stripAbis(obj) {
|
|
|
194
210
|
}
|
|
195
211
|
});
|
|
196
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Best-effort decode of a raw revert payload (`0x...`) against an ABI.
|
|
215
|
+
* Returns a human-readable `ErrorName(arg1, arg2, ...)` string, or `undefined` if the selector
|
|
216
|
+
* is unknown or the payload is empty. Use to surface decoded error names alongside the raw
|
|
217
|
+
* payload in log lines for operators.
|
|
218
|
+
*/ export function tryDecodeRevertReason(data, abi) {
|
|
219
|
+
if (!data || data === '0x') {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
const decoded = decodeErrorResult({
|
|
224
|
+
abi,
|
|
225
|
+
data
|
|
226
|
+
});
|
|
227
|
+
return `${decoded.errorName}(${decoded.args?.join(', ') ?? ''})`;
|
|
228
|
+
} catch {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
197
232
|
export function tryGetCustomErrorName(err) {
|
|
198
233
|
try {
|
|
199
234
|
// See https://viem.sh/docs/contract/simulateContract#handling-custom-errors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f5a9928",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./account": "./dest/account.js",
|
|
@@ -50,17 +50,16 @@
|
|
|
50
50
|
"../package.common.json"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
54
|
-
"@aztec/constants": "0.0.1-commit.
|
|
55
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
56
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
57
|
-
"@viem/anvil": "^0.0.10",
|
|
53
|
+
"@aztec/blob-lib": "0.0.1-commit.f5a9928",
|
|
54
|
+
"@aztec/constants": "0.0.1-commit.f5a9928",
|
|
55
|
+
"@aztec/foundation": "0.0.1-commit.f5a9928",
|
|
56
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f5a9928",
|
|
58
57
|
"dotenv": "^16.0.3",
|
|
59
58
|
"lodash.chunk": "^4.2.0",
|
|
60
59
|
"lodash.pickby": "^4.5.0",
|
|
61
60
|
"tslib": "^2.4.0",
|
|
62
61
|
"viem": "npm:@aztec/viem@2.38.2",
|
|
63
|
-
"zod": "^
|
|
62
|
+
"zod": "^4"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@jest/globals": "^30.0.0",
|
|
@@ -69,7 +68,6 @@
|
|
|
69
68
|
"@types/lodash.pickby": "^4",
|
|
70
69
|
"@types/node": "^22.15.17",
|
|
71
70
|
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
72
|
-
"@viem/anvil": "^0.0.10",
|
|
73
71
|
"get-port": "^7.1.0",
|
|
74
72
|
"jest": "^30.0.0",
|
|
75
73
|
"jest-mock-extended": "^4.0.0",
|
package/src/client.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
|
+
import { getErrorCause } from '@aztec/foundation/types';
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
type Chain,
|
|
7
|
+
type FallbackTransport,
|
|
6
8
|
type HDAccount,
|
|
9
|
+
HttpRequestError,
|
|
10
|
+
type HttpTransport,
|
|
7
11
|
type LocalAccount,
|
|
8
12
|
type PrivateKeyAccount,
|
|
13
|
+
RpcRequestError,
|
|
9
14
|
createPublicClient,
|
|
10
15
|
createWalletClient,
|
|
11
16
|
fallback,
|
|
@@ -25,10 +30,74 @@ type Config = {
|
|
|
25
30
|
l1ChainId: number;
|
|
26
31
|
/** The polling interval viem uses in ms */
|
|
27
32
|
viemPollingIntervalMS?: number;
|
|
33
|
+
/** Timeout for HTTP requests to the L1 RPC node in ms. */
|
|
34
|
+
l1HttpTimeoutMS?: number;
|
|
28
35
|
};
|
|
29
36
|
|
|
30
37
|
export type { Config as EthereumClientConfig };
|
|
31
38
|
|
|
39
|
+
/** Error exposed by L1 RPC transports without including provider URLs in its message. */
|
|
40
|
+
export class L1RpcError extends Error {
|
|
41
|
+
constructor(message: string, options?: ErrorOptions) {
|
|
42
|
+
super(message, options);
|
|
43
|
+
this.name = 'L1RpcError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Creates a viem fallback HTTP transport for the given L1 RPC URLs. */
|
|
48
|
+
export function makeL1HttpTransport(rpcUrls: string[], opts?: { timeout?: number }) {
|
|
49
|
+
return wrapL1RpcTransport(fallback(rpcUrls.map(url => http(url, { batch: false, timeout: opts?.timeout }))));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Returns the HTTP status from an L1 RPC error's cause chain, if one is available. */
|
|
53
|
+
export function getL1RpcHttpStatus(err: unknown): number | undefined {
|
|
54
|
+
return getErrorCause(err, HttpRequestError)?.status;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Returns true when an L1 RPC error's cause chain contains the given HTTP status. */
|
|
58
|
+
export function isL1RpcHttpStatus(err: unknown, status: number): boolean {
|
|
59
|
+
return getL1RpcHttpStatus(err) === status;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Returns the JSON-RPC error code reported by the L1 node, if the error's cause chain carries one. */
|
|
63
|
+
export function getL1RpcErrorCode(err: unknown): number | undefined {
|
|
64
|
+
return getErrorCause(err, RpcRequestError)?.code;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function wrapL1RpcTransport(transport: FallbackTransport<HttpTransport[]>): FallbackTransport<HttpTransport[]> {
|
|
68
|
+
const wrappedTransport: FallbackTransport<HttpTransport[]> = parameters => {
|
|
69
|
+
const fallbackTransport = transport(parameters);
|
|
70
|
+
const request: typeof fallbackTransport.request = async args => {
|
|
71
|
+
try {
|
|
72
|
+
return await fallbackTransport.request(args);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
throw err instanceof L1RpcError ? err : new L1RpcError('L1 RPC request failed', { cause: err });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return { ...fallbackTransport, request };
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return wrappedTransport;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns the individual RPC URLs underlying a viem public client that was constructed with a
|
|
85
|
+
* fallback HTTP transport (see {@link makeL1HttpTransport}). Returns an empty array if the
|
|
86
|
+
* transport shape is not recognized (e.g. mock clients in tests, or non-fallback transports).
|
|
87
|
+
*/
|
|
88
|
+
export function getRpcUrlsFromClient(client: ViemPublicClient): string[] {
|
|
89
|
+
const transport = client.transport as unknown as {
|
|
90
|
+
transports?: { value?: { url?: string } }[];
|
|
91
|
+
value?: { url?: string };
|
|
92
|
+
url?: string;
|
|
93
|
+
};
|
|
94
|
+
if (Array.isArray(transport?.transports)) {
|
|
95
|
+
return transport.transports.map(t => t?.value?.url).filter((url): url is string => typeof url === 'string');
|
|
96
|
+
}
|
|
97
|
+
const singleUrl = transport?.value?.url ?? transport?.url;
|
|
98
|
+
return typeof singleUrl === 'string' ? [singleUrl] : [];
|
|
99
|
+
}
|
|
100
|
+
|
|
32
101
|
// TODO: Use these methods to abstract the creation of viem clients.
|
|
33
102
|
|
|
34
103
|
/** Returns a viem public client given the L1 config. */
|
|
@@ -36,7 +105,7 @@ export function getPublicClient(config: Config): ViemPublicClient {
|
|
|
36
105
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
37
106
|
return createPublicClient({
|
|
38
107
|
chain: chain.chainInfo,
|
|
39
|
-
transport:
|
|
108
|
+
transport: makeL1HttpTransport(config.l1RpcUrls, { timeout: config.l1HttpTimeoutMS }),
|
|
40
109
|
pollingInterval: config.viemPollingIntervalMS,
|
|
41
110
|
});
|
|
42
111
|
}
|
|
@@ -77,6 +146,7 @@ export function createExtendedL1Client(
|
|
|
77
146
|
chain: Chain = foundry,
|
|
78
147
|
pollingIntervalMS?: number,
|
|
79
148
|
addressIndex?: number,
|
|
149
|
+
opts?: { httpTimeoutMS?: number },
|
|
80
150
|
): ExtendedViemWalletClient {
|
|
81
151
|
const hdAccount =
|
|
82
152
|
typeof mnemonicOrPrivateKeyOrHdAccount === 'string'
|
|
@@ -88,7 +158,7 @@ export function createExtendedL1Client(
|
|
|
88
158
|
const extendedClient = createWalletClient({
|
|
89
159
|
account: hdAccount,
|
|
90
160
|
chain,
|
|
91
|
-
transport:
|
|
161
|
+
transport: makeL1HttpTransport(rpcUrls, { timeout: opts?.httpTimeoutMS }),
|
|
92
162
|
pollingInterval: pollingIntervalMS,
|
|
93
163
|
}).extend(publicActions);
|
|
94
164
|
|
package/src/config.ts
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
type ConfigMappingsType,
|
|
3
3
|
bigintConfigHelper,
|
|
4
4
|
booleanConfigHelper,
|
|
5
|
-
enumConfigHelper,
|
|
6
5
|
getConfigFromMappings,
|
|
7
6
|
getDefaultConfig,
|
|
8
7
|
numberConfigHelper,
|
|
8
|
+
omitConfigMappings,
|
|
9
9
|
optionalNumberConfigHelper,
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -18,6 +18,8 @@ export type GenesisStateConfig = {
|
|
|
18
18
|
testAccounts: boolean;
|
|
19
19
|
/** Whether to populate the genesis state with initial fee juice for the sponsored FPC */
|
|
20
20
|
sponsoredFPC: boolean;
|
|
21
|
+
/** Additional addresses to prefund with fee juice at genesis */
|
|
22
|
+
prefundAddresses: string[];
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export type L1ContractsConfig = {
|
|
@@ -57,13 +59,13 @@ export type L1ContractsConfig = {
|
|
|
57
59
|
slashingOffsetInRounds: number;
|
|
58
60
|
/** How long slashing can be disabled for in seconds when vetoer disables it */
|
|
59
61
|
slashingDisableDuration: number;
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/** Minimum amount that can be slashed
|
|
62
|
+
/** Whether to deploy a slasher proposer */
|
|
63
|
+
slasherEnabled: boolean;
|
|
64
|
+
/** Minimum amount that can be slashed */
|
|
63
65
|
slashAmountSmall: bigint;
|
|
64
|
-
/** Medium amount to slash
|
|
66
|
+
/** Medium amount to slash */
|
|
65
67
|
slashAmountMedium: bigint;
|
|
66
|
-
/** Largest amount that can be slashed per round
|
|
68
|
+
/** Largest amount that can be slashed per round */
|
|
67
69
|
slashAmountLarge: bigint;
|
|
68
70
|
/** Governance proposing quorum (defaults to roundSize/2 + 1) */
|
|
69
71
|
governanceProposerQuorum?: number;
|
|
@@ -149,13 +151,10 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
149
151
|
'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
|
|
150
152
|
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS),
|
|
151
153
|
},
|
|
152
|
-
|
|
153
|
-
env: '
|
|
154
|
-
description: '
|
|
155
|
-
...
|
|
156
|
-
['empire', 'tally', 'none'] as const,
|
|
157
|
-
l1ContractsDefaultEnv.AZTEC_SLASHER_FLAVOR as 'empire' | 'tally' | 'none',
|
|
158
|
-
),
|
|
154
|
+
slasherEnabled: {
|
|
155
|
+
env: 'AZTEC_SLASHER_ENABLED',
|
|
156
|
+
description: 'Whether to deploy a slasher proposer',
|
|
157
|
+
...booleanConfigHelper(true),
|
|
159
158
|
},
|
|
160
159
|
slashAmountSmall: {
|
|
161
160
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
@@ -238,7 +237,7 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
238
237
|
description: 'The delay before a validator can exit the set',
|
|
239
238
|
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS),
|
|
240
239
|
},
|
|
241
|
-
...l1TxUtilsConfigMappings,
|
|
240
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, ['ethereumSlotDuration']),
|
|
242
241
|
};
|
|
243
242
|
|
|
244
243
|
/**
|
|
@@ -247,6 +246,41 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
247
246
|
*/
|
|
248
247
|
export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
|
|
249
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Validates that `ethereumSlotDuration` and `aztecSlotDuration` are positive and that the L2 slot is an exact
|
|
251
|
+
* multiple of the L1 slot. Every L2 slot boundary must land on an L1 slot boundary; a non-multiple pairing
|
|
252
|
+
* desyncs the epoch/checkpoint timing math throughout the sequencer, validator client, and timetables. Returns
|
|
253
|
+
* a list of error messages (empty when valid).
|
|
254
|
+
*/
|
|
255
|
+
export function validateSlotDurations(
|
|
256
|
+
config: Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'>,
|
|
257
|
+
): string[] {
|
|
258
|
+
const errors: string[] = [];
|
|
259
|
+
if (config.ethereumSlotDuration <= 0) {
|
|
260
|
+
errors.push(`ethereumSlotDuration must be positive (got ${config.ethereumSlotDuration})`);
|
|
261
|
+
}
|
|
262
|
+
if (config.aztecSlotDuration <= 0) {
|
|
263
|
+
errors.push(`aztecSlotDuration must be positive (got ${config.aztecSlotDuration})`);
|
|
264
|
+
}
|
|
265
|
+
if (config.ethereumSlotDuration > 0 && config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
266
|
+
errors.push(
|
|
267
|
+
`aztecSlotDuration (${config.aztecSlotDuration}s) must be a multiple of ethereumSlotDuration ` +
|
|
268
|
+
`(${config.ethereumSlotDuration}s)`,
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
return errors;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Throws if {@link validateSlotDurations} reports any errors. */
|
|
275
|
+
export function assertValidSlotDurations(
|
|
276
|
+
config: Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'>,
|
|
277
|
+
): void {
|
|
278
|
+
const errors = validateSlotDurations(config);
|
|
279
|
+
if (errors.length > 0) {
|
|
280
|
+
throw new Error(`Invalid slot duration configuration:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
250
284
|
export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig> = {
|
|
251
285
|
testAccounts: {
|
|
252
286
|
env: 'TEST_ACCOUNTS',
|
|
@@ -258,6 +292,16 @@ export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig>
|
|
|
258
292
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
259
293
|
...booleanConfigHelper(false),
|
|
260
294
|
},
|
|
295
|
+
prefundAddresses: {
|
|
296
|
+
env: 'PREFUND_ADDRESSES',
|
|
297
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
298
|
+
parseEnv: (val: string) =>
|
|
299
|
+
val
|
|
300
|
+
.split(',')
|
|
301
|
+
.map(a => a.trim())
|
|
302
|
+
.filter(a => a.length > 0),
|
|
303
|
+
defaultValue: [],
|
|
304
|
+
},
|
|
261
305
|
};
|
|
262
306
|
|
|
263
307
|
export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|