@aztec/ethereum 3.0.0-devnet.2 → 3.0.0-devnet.20251212
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/account.d.ts +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +1 -1
- package/dest/config.d.ts +7 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +55 -17
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +6 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +5 -4
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +8 -2
- package/dest/contracts/errors.d.ts +1 -1
- package/dest/contracts/errors.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +1 -1
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +16 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.d.ts +5 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +8 -2
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +1 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/index.d.ts +1 -1
- package/dest/contracts/multicall.d.ts +2 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +55 -64
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +76 -67
- package/dest/contracts/slasher_contract.d.ts +1 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts +9 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +4 -4
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_l1_contracts.d.ts +456 -9
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +68 -37
- package/dest/eth-signer/eth-signer.d.ts +1 -1
- package/dest/eth-signer/index.d.ts +1 -1
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/l1_artifacts.d.ts +6400 -872
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +3 -3
- package/dest/l1_reader.d.ts +3 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +6 -0
- package/dest/l1_tx_utils/config.d.ts +5 -5
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +32 -9
- package/dest/l1_tx_utils/constants.d.ts +1 -1
- package/dest/l1_tx_utils/factory.d.ts +1 -1
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +1 -1
- package/dest/l1_tx_utils/interfaces.d.ts +2 -2
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +1 -2
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +17 -4
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +1 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +29 -16
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +171 -34
- package/dest/l1_tx_utils/signer.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/utils.d.ts +1 -1
- package/dest/l1_types.d.ts +1 -1
- package/dest/publisher_manager.d.ts +1 -1
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +5 -3
- package/dest/test/chain_monitor.d.ts +27 -24
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +32 -34
- package/dest/test/delayed_tx_utils.d.ts +1 -1
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.d.ts +8 -12
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +9 -3
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -1
- package/dest/test/rollup_cheat_codes.d.ts +14 -13
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +43 -38
- package/dest/test/start_anvil.d.ts +2 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +2 -1
- package/dest/test/tx_delayer.d.ts +1 -1
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +3 -2
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +2 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/package.json +27 -13
- package/src/config.ts +62 -18
- package/src/contracts/empire_base.ts +6 -5
- package/src/contracts/empire_slashing_proposer.ts +11 -5
- package/src/contracts/governance_proposer.ts +11 -5
- package/src/contracts/rollup.ts +81 -80
- package/src/contracts/tally_slashing_proposer.ts +11 -8
- package/src/deploy_l1_contracts.ts +63 -32
- package/src/forwarder_proxy.ts +108 -0
- package/src/l1_reader.ts +8 -0
- package/src/l1_tx_utils/config.ts +34 -13
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_tx_utils.ts +24 -4
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +223 -38
- package/src/queries.ts +6 -3
- package/src/test/chain_monitor.ts +50 -48
- package/src/test/eth_cheat_codes.ts +8 -2
- package/src/test/rollup_cheat_codes.ts +44 -42
- package/src/test/start_anvil.ts +2 -0
- package/src/test/tx_delayer.ts +4 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +1 -1
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/src/index.ts +0 -17
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { RollupContract
|
|
1
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
4
|
+
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
7
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
@@ -14,7 +16,6 @@ import {
|
|
|
14
16
|
hexToBigInt,
|
|
15
17
|
http,
|
|
16
18
|
} from 'viem';
|
|
17
|
-
import { foundry } from 'viem/chains';
|
|
18
19
|
|
|
19
20
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
20
21
|
|
|
@@ -30,7 +31,7 @@ export class RollupCheatCodes {
|
|
|
30
31
|
addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
|
|
31
32
|
) {
|
|
32
33
|
this.client = createPublicClient({
|
|
33
|
-
chain:
|
|
34
|
+
chain: ethCheatCodes.chain,
|
|
34
35
|
transport: fallback(ethCheatCodes.rpcUrls.map(url => http(url))),
|
|
35
36
|
});
|
|
36
37
|
this.rollup = getContract({
|
|
@@ -50,15 +51,15 @@ export class RollupCheatCodes {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/** Returns the current slot */
|
|
53
|
-
public async getSlot() {
|
|
54
|
+
public async getSlot(): Promise<SlotNumber> {
|
|
54
55
|
const ts = BigInt((await this.client.getBlock()).timestamp);
|
|
55
|
-
return await this.rollup.read.getSlotAt([ts]);
|
|
56
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
/** Returns the current epoch */
|
|
59
|
-
public async getEpoch() {
|
|
60
|
+
public async getEpoch(): Promise<EpochNumber> {
|
|
60
61
|
const slotNumber = await this.getSlot();
|
|
61
|
-
return await this.rollup.read.getEpochAtSlot([slotNumber]);
|
|
62
|
+
return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -66,13 +67,13 @@ export class RollupCheatCodes {
|
|
|
66
67
|
* @returns The pending and proven chain tips
|
|
67
68
|
*/
|
|
68
69
|
public async getTips(): Promise<{
|
|
69
|
-
/** The pending chain tip */ pending:
|
|
70
|
-
/** The proven chain tip */ proven:
|
|
70
|
+
/** The pending chain tip */ pending: CheckpointNumber;
|
|
71
|
+
/** The proven chain tip */ proven: CheckpointNumber;
|
|
71
72
|
}> {
|
|
72
|
-
const
|
|
73
|
+
const { pending, proven } = await this.rollup.read.getTips();
|
|
73
74
|
return {
|
|
74
|
-
pending:
|
|
75
|
-
proven:
|
|
75
|
+
pending: CheckpointNumber.fromBigInt(pending),
|
|
76
|
+
proven: CheckpointNumber.fromBigInt(proven),
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -81,16 +82,16 @@ export class RollupCheatCodes {
|
|
|
81
82
|
*/
|
|
82
83
|
public async debugRollup() {
|
|
83
84
|
const rollup = new RollupContract(this.client, this.rollup.address);
|
|
84
|
-
const pendingNum = await rollup.
|
|
85
|
-
const provenNum = await rollup.
|
|
85
|
+
const pendingNum = await rollup.getCheckpointNumber();
|
|
86
|
+
const provenNum = await rollup.getProvenCheckpointNumber();
|
|
86
87
|
const validators = await rollup.getAttesters();
|
|
87
88
|
const committee = await rollup.getCurrentEpochCommittee();
|
|
88
89
|
const archive = await rollup.archive();
|
|
89
90
|
const slot = await this.getSlot();
|
|
90
91
|
const epochNum = await rollup.getEpochNumberForSlotNumber(slot);
|
|
91
92
|
|
|
92
|
-
this.logger.info(`Pending
|
|
93
|
-
this.logger.info(`Proven
|
|
93
|
+
this.logger.info(`Pending checkpoint num: ${pendingNum}`);
|
|
94
|
+
this.logger.info(`Proven checkpoint num: ${provenNum}`);
|
|
94
95
|
this.logger.info(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
|
|
95
96
|
this.logger.info(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
|
|
96
97
|
this.logger.info(`Archive: ${archive}`);
|
|
@@ -101,13 +102,13 @@ export class RollupCheatCodes {
|
|
|
101
102
|
/** Fetches the epoch and slot duration config from the rollup contract */
|
|
102
103
|
public async getConfig(): Promise<{
|
|
103
104
|
/** Epoch duration */ epochDuration: bigint;
|
|
104
|
-
/** Slot duration */ slotDuration:
|
|
105
|
+
/** Slot duration */ slotDuration: number;
|
|
105
106
|
}> {
|
|
106
107
|
const [epochDuration, slotDuration] = await Promise.all([
|
|
107
108
|
this.rollup.read.getEpochDuration(),
|
|
108
109
|
this.rollup.read.getSlotDuration(),
|
|
109
110
|
]);
|
|
110
|
-
return { epochDuration, slotDuration };
|
|
111
|
+
return { epochDuration, slotDuration: Number(slotDuration) };
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/**
|
|
@@ -116,18 +117,18 @@ export class RollupCheatCodes {
|
|
|
116
117
|
* @param opts - Options
|
|
117
118
|
*/
|
|
118
119
|
public async advanceToEpoch(
|
|
119
|
-
epoch:
|
|
120
|
+
epoch: EpochNumber,
|
|
120
121
|
opts: {
|
|
121
122
|
/** Offset in seconds */
|
|
122
123
|
offset?: number;
|
|
123
124
|
} = {},
|
|
124
125
|
) {
|
|
125
126
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
126
|
-
const
|
|
127
|
-
|
|
127
|
+
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
128
|
+
const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
|
|
128
129
|
try {
|
|
129
130
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
130
|
-
this.logger.warn(`Warped to epoch ${epoch}
|
|
131
|
+
this.logger.warn(`Warped to epoch ${epoch}`, { offset: opts.offset, timestamp });
|
|
131
132
|
} catch (err) {
|
|
132
133
|
this.logger.warn(`Warp to epoch ${epoch} failed: ${err}`);
|
|
133
134
|
}
|
|
@@ -138,8 +139,8 @@ export class RollupCheatCodes {
|
|
|
138
139
|
public async advanceToNextEpoch() {
|
|
139
140
|
const slot = await this.getSlot();
|
|
140
141
|
const { epochDuration, slotDuration } = await this.getConfig();
|
|
141
|
-
const slotsUntilNextEpoch = epochDuration - (slot % epochDuration) + 1n;
|
|
142
|
-
const timeToNextEpoch = slotsUntilNextEpoch * slotDuration;
|
|
142
|
+
const slotsUntilNextEpoch = epochDuration - (BigInt(slot) % epochDuration) + 1n;
|
|
143
|
+
const timeToNextEpoch = slotsUntilNextEpoch * BigInt(slotDuration);
|
|
143
144
|
const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
|
|
144
145
|
await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
|
|
145
146
|
silent: true,
|
|
@@ -151,10 +152,11 @@ export class RollupCheatCodes {
|
|
|
151
152
|
/** Warps time in L1 until the beginning of the next slot. */
|
|
152
153
|
public async advanceToNextSlot() {
|
|
153
154
|
const currentSlot = await this.getSlot();
|
|
154
|
-
const
|
|
155
|
+
const nextSlot = SlotNumber(currentSlot + 1);
|
|
156
|
+
const timestamp = await this.rollup.read.getTimestampForSlot([BigInt(nextSlot)]);
|
|
155
157
|
await this.ethCheatCodes.warp(Number(timestamp), { silent: true, resetBlockInterval: true });
|
|
156
|
-
this.logger.warn(`Advanced to slot ${
|
|
157
|
-
return [timestamp,
|
|
158
|
+
this.logger.warn(`Advanced to slot ${nextSlot}`);
|
|
159
|
+
return [timestamp, nextSlot];
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
/**
|
|
@@ -163,42 +165,42 @@ export class RollupCheatCodes {
|
|
|
163
165
|
*/
|
|
164
166
|
public async advanceSlots(howMany: number) {
|
|
165
167
|
const l1Timestamp = (await this.client.getBlock()).timestamp;
|
|
166
|
-
const slotDuration = await this.rollup.read.getSlotDuration();
|
|
167
|
-
const timeToWarp = BigInt(howMany) * slotDuration;
|
|
168
|
+
const slotDuration = Number(await this.rollup.read.getSlotDuration());
|
|
169
|
+
const timeToWarp = BigInt(howMany) * BigInt(slotDuration);
|
|
168
170
|
await this.ethCheatCodes.warp(l1Timestamp + timeToWarp, { silent: true, resetBlockInterval: true });
|
|
169
171
|
const [slot, epoch] = await Promise.all([this.getSlot(), this.getEpoch()]);
|
|
170
172
|
this.logger.warn(`Advanced ${howMany} slots up to slot ${slot} in epoch ${epoch}`);
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
|
-
* Marks the specified
|
|
175
|
-
* @param
|
|
176
|
+
* Marks the specified checkpoint (or latest if none) as proven
|
|
177
|
+
* @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
|
|
176
178
|
*/
|
|
177
|
-
public markAsProven(
|
|
179
|
+
public markAsProven(maybeCheckpointNumber?: number | bigint) {
|
|
178
180
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
179
181
|
const tipsBefore = await this.getTips();
|
|
180
182
|
const { pending, proven } = tipsBefore;
|
|
181
183
|
|
|
182
|
-
let
|
|
183
|
-
if (
|
|
184
|
-
|
|
184
|
+
let checkpointNumber = maybeCheckpointNumber;
|
|
185
|
+
if (checkpointNumber === undefined || checkpointNumber > pending) {
|
|
186
|
+
checkpointNumber = pending;
|
|
185
187
|
}
|
|
186
|
-
if (
|
|
187
|
-
this.logger.debug(`
|
|
188
|
+
if (checkpointNumber <= proven) {
|
|
189
|
+
this.logger.debug(`Checkpoint ${checkpointNumber} is already proven`);
|
|
188
190
|
return;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
// @note @LHerskind this is heavily dependent on the storage layout and size of values
|
|
192
194
|
// The rollupStore is a struct and if the size of elements or the struct changes, this can break
|
|
193
|
-
const
|
|
195
|
+
const provenCheckpointNumberSlot = hexToBigInt(RollupContract.stfStorageSlot);
|
|
194
196
|
|
|
195
197
|
// Need to pack it as a single 32 byte word
|
|
196
|
-
const newValue = (BigInt(tipsBefore.pending) << 128n) | BigInt(
|
|
197
|
-
await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address),
|
|
198
|
+
const newValue = (BigInt(tipsBefore.pending) << 128n) | BigInt(checkpointNumber);
|
|
199
|
+
await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address), provenCheckpointNumberSlot, newValue);
|
|
198
200
|
|
|
199
201
|
const tipsAfter = await this.getTips();
|
|
200
202
|
if (tipsAfter.pending < tipsAfter.proven) {
|
|
201
|
-
throw new Error('Overwrote pending tip to a
|
|
203
|
+
throw new Error('Overwrote pending tip to a checkpoint in the past');
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
this.logger.info(
|
|
@@ -209,7 +211,7 @@ export class RollupCheatCodes {
|
|
|
209
211
|
|
|
210
212
|
/**
|
|
211
213
|
* Overrides the inProgress field of the Inbox contract state
|
|
212
|
-
* @param howMuch - How many
|
|
214
|
+
* @param howMuch - How many checkpoints to move it forward
|
|
213
215
|
*/
|
|
214
216
|
public advanceInboxInProgress(howMuch: number | bigint): Promise<bigint> {
|
|
215
217
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
package/src/test/start_anvil.ts
CHANGED
|
@@ -15,6 +15,7 @@ export async function startAnvil(
|
|
|
15
15
|
log?: boolean;
|
|
16
16
|
captureMethodCalls?: boolean;
|
|
17
17
|
accounts?: number;
|
|
18
|
+
chainId?: number;
|
|
18
19
|
} = {},
|
|
19
20
|
): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
|
|
20
21
|
const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
|
|
@@ -35,6 +36,7 @@ export async function startAnvil(
|
|
|
35
36
|
stopTimeout: 1000,
|
|
36
37
|
accounts: opts.accounts ?? 20,
|
|
37
38
|
gasLimit: 45_000_000n,
|
|
39
|
+
chainId: opts.chainId ?? 31337,
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
// Listen to the anvil output to get the port.
|
package/src/test/tx_delayer.ts
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
|
|
19
19
|
import { type ViemClient, isExtendedClient } from '../types.js';
|
|
20
20
|
|
|
21
|
+
const MAX_WAIT_TIME_SECONDS = 180;
|
|
22
|
+
|
|
21
23
|
export function waitUntilBlock<T extends Client>(
|
|
22
24
|
client: T,
|
|
23
25
|
blockNumber: number | bigint,
|
|
@@ -36,7 +38,7 @@ export function waitUntilBlock<T extends Client>(
|
|
|
36
38
|
return currentBlockNumber >= BigInt(blockNumber);
|
|
37
39
|
},
|
|
38
40
|
`Wait until L1 block ${blockNumber}`,
|
|
39
|
-
timeout ??
|
|
41
|
+
timeout ?? MAX_WAIT_TIME_SECONDS,
|
|
40
42
|
0.1,
|
|
41
43
|
);
|
|
42
44
|
}
|
|
@@ -66,7 +68,7 @@ export function waitUntilL1Timestamp<T extends Client>(
|
|
|
66
68
|
return currentTs >= BigInt(timestamp);
|
|
67
69
|
},
|
|
68
70
|
`Wait until L1 timestamp ${timestamp}`,
|
|
69
|
-
timeout ??
|
|
71
|
+
timeout ?? MAX_WAIT_TIME_SECONDS,
|
|
70
72
|
0.1,
|
|
71
73
|
);
|
|
72
74
|
}
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
Client,
|
|
6
6
|
FallbackTransport,
|
|
7
7
|
GetContractReturnType,
|
|
8
|
+
Hex,
|
|
8
9
|
HttpTransport,
|
|
9
10
|
PublicActions,
|
|
10
11
|
PublicClient,
|
|
@@ -16,6 +17,67 @@ import type {
|
|
|
16
17
|
/** Type for a viem public client */
|
|
17
18
|
export type ViemPublicClient = PublicClient<FallbackTransport<HttpTransport[]>, Chain>;
|
|
18
19
|
|
|
20
|
+
export type PublicRpcDebugSchema = [
|
|
21
|
+
{
|
|
22
|
+
Method: 'debug_traceTransaction';
|
|
23
|
+
Parameters: [txHash: `0x${string}`, options: { tracer: 'callTracer' }];
|
|
24
|
+
ReturnType: DebugCallTrace;
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
Method: 'trace_transaction';
|
|
28
|
+
Parameters: [txHash: `0x${string}`];
|
|
29
|
+
ReturnType: TraceTransactionResponse[];
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
/** Return type for a debug_traceTransaction call */
|
|
34
|
+
export type DebugCallTrace = {
|
|
35
|
+
from: Hex;
|
|
36
|
+
to?: Hex;
|
|
37
|
+
type: string;
|
|
38
|
+
input?: Hex;
|
|
39
|
+
output?: Hex;
|
|
40
|
+
gas?: Hex;
|
|
41
|
+
gasUsed?: Hex;
|
|
42
|
+
value?: Hex;
|
|
43
|
+
error?: string;
|
|
44
|
+
calls?: DebugCallTrace[];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Action object for a trace_transaction call */
|
|
48
|
+
export type TraceAction = {
|
|
49
|
+
from: Hex;
|
|
50
|
+
to?: Hex;
|
|
51
|
+
callType: string;
|
|
52
|
+
gas?: Hex;
|
|
53
|
+
input?: Hex;
|
|
54
|
+
value?: Hex;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Result object for a trace_transaction call */
|
|
58
|
+
export type TraceResult = {
|
|
59
|
+
gasUsed?: Hex;
|
|
60
|
+
output?: Hex;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** Return type for a single trace in trace_transaction response */
|
|
64
|
+
export type TraceTransactionResponse = {
|
|
65
|
+
action: TraceAction;
|
|
66
|
+
result?: TraceResult;
|
|
67
|
+
error?: string;
|
|
68
|
+
subtraces: number;
|
|
69
|
+
traceAddress: number[];
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** Type for a viem public client with support for debug methods */
|
|
74
|
+
export type ViemPublicDebugClient = PublicClient<
|
|
75
|
+
FallbackTransport<HttpTransport[]>,
|
|
76
|
+
Chain,
|
|
77
|
+
undefined,
|
|
78
|
+
[...PublicRpcSchema, ...PublicRpcDebugSchema]
|
|
79
|
+
>;
|
|
80
|
+
|
|
19
81
|
export type ExtendedViemWalletClient = Client<
|
|
20
82
|
FallbackTransport<readonly HttpTransport[]>,
|
|
21
83
|
Chain,
|
package/src/utils.ts
CHANGED
package/dest/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
|
2
|
-
export * from './deploy_l1_contracts.js';
|
|
3
|
-
export * from './chain.js';
|
|
4
|
-
export * from './l1_tx_utils/index.js';
|
|
5
|
-
export * from './l1_contract_addresses.js';
|
|
6
|
-
export * from './l1_reader.js';
|
|
7
|
-
export * from './utils.js';
|
|
8
|
-
export * from './config.js';
|
|
9
|
-
export * from './types.js';
|
|
10
|
-
export * from './contracts/index.js';
|
|
11
|
-
export * from './queries.js';
|
|
12
|
-
export * from './client.js';
|
|
13
|
-
export * from './account.js';
|
|
14
|
-
export * from './l1_types.js';
|
|
15
|
-
export * from './l1_artifacts.js';
|
|
16
|
-
export * from './publisher_manager.js';
|
|
17
|
-
export * from './eth-signer/index.js';
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dest/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
package/dest/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
|
2
|
-
export * from './deploy_l1_contracts.js';
|
|
3
|
-
export * from './chain.js';
|
|
4
|
-
export * from './l1_tx_utils/index.js';
|
|
5
|
-
export * from './l1_contract_addresses.js';
|
|
6
|
-
export * from './l1_reader.js';
|
|
7
|
-
export * from './utils.js';
|
|
8
|
-
export * from './config.js';
|
|
9
|
-
export * from './types.js';
|
|
10
|
-
export * from './contracts/index.js';
|
|
11
|
-
export * from './queries.js';
|
|
12
|
-
export * from './client.js';
|
|
13
|
-
export * from './account.js';
|
|
14
|
-
export * from './l1_types.js';
|
|
15
|
-
export * from './l1_artifacts.js';
|
|
16
|
-
export * from './publisher_manager.js';
|
|
17
|
-
export * from './eth-signer/index.js';
|
package/src/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
|
2
|
-
export * from './deploy_l1_contracts.js';
|
|
3
|
-
export * from './chain.js';
|
|
4
|
-
export * from './l1_tx_utils/index.js';
|
|
5
|
-
export * from './l1_contract_addresses.js';
|
|
6
|
-
export * from './l1_reader.js';
|
|
7
|
-
export * from './utils.js';
|
|
8
|
-
export * from './config.js';
|
|
9
|
-
export * from './types.js';
|
|
10
|
-
export * from './contracts/index.js';
|
|
11
|
-
export * from './queries.js';
|
|
12
|
-
export * from './client.js';
|
|
13
|
-
export * from './account.js';
|
|
14
|
-
export * from './l1_types.js';
|
|
15
|
-
export * from './l1_artifacts.js';
|
|
16
|
-
export * from './publisher_manager.js';
|
|
17
|
-
export * from './eth-signer/index.js';
|