@aztec/ethereum 0.0.1-commit.5daedc8 → 0.0.1-commit.6201a7b05
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 +16 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +27 -3
- package/dest/config.d.ts +26 -73
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +64 -387
- package/dest/contracts/chain_state_override.d.ts +38 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +100 -0
- package/dest/contracts/empire_base.d.ts +4 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +11 -9
- package/dest/contracts/fee_asset_price_oracle.d.ts +101 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +651 -0
- package/dest/contracts/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +14 -4
- package/dest/contracts/governance_proposer.d.ts +4 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +404 -9
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +41 -1
- package/dest/contracts/index.d.ts +6 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +5 -2
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +51 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +87 -1
- package/dest/contracts/outbox.d.ts +41 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +86 -0
- 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 +5178 -108
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1004 -188
- package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +5 -5
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +18 -13
- package/dest/deploy_aztec_l1_contracts.d.ts +256 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +411 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- 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/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +14161 -17158
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +1 -5
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -9
- package/dest/l1_reader.d.ts +5 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +13 -2
- package/dest/l1_tx_utils/config.d.ts +9 -3
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +31 -4
- package/dest/l1_tx_utils/constants.d.ts +8 -2
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +27 -2
- 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/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- 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 +42 -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 +4 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +3 -0
- 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_fee_analyzer.d.ts +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +20 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +98 -61
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -15
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +61 -164
- package/dest/l1_tx_utils/tx_delayer.d.ts +56 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +65 -36
- package/dest/publisher_manager.d.ts +21 -6
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +81 -7
- package/dest/queries.d.ts +14 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +74 -7
- package/dest/test/chain_monitor.d.ts +36 -14
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +45 -11
- package/dest/test/eth_cheat_codes.d.ts +18 -4
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +10 -6
- package/dest/test/index.d.ts +1 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -2
- package/dest/test/rollup_cheat_codes.d.ts +13 -6
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +41 -7
- package/dest/test/start_anvil.d.ts +24 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +143 -29
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +16 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +80 -12
- package/package.json +33 -16
- package/src/client.ts +28 -2
- package/src/config.ts +82 -468
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +147 -0
- package/src/contracts/empire_base.ts +3 -1
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +280 -0
- package/src/contracts/governance.ts +13 -4
- package/src/contracts/governance_proposer.ts +16 -2
- package/src/contracts/inbox.ts +63 -3
- package/src/contracts/index.ts +5 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +70 -3
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +701 -149
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +18 -14
- package/src/deploy_aztec_l1_contracts.ts +646 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +21 -26
- package/src/l1_reader.ts +22 -2
- package/src/l1_tx_utils/config.ts +44 -6
- package/src/l1_tx_utils/constants.ts +13 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +3 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +98 -40
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +75 -210
- package/src/{test → l1_tx_utils}/tx_delayer.ts +82 -52
- package/src/publisher_manager.ts +107 -10
- package/src/queries.ts +81 -7
- package/src/test/chain_monitor.ts +82 -18
- package/src/test/eth_cheat_codes.ts +8 -6
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +43 -10
- package/src/test/start_anvil.ts +178 -28
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +100 -15
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -66
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -200
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.d.ts +0 -673
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1491
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- 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 -265
- package/src/deploy_l1_contracts.ts +0 -1869
- package/src/index.ts +0 -17
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ManaMinFeeComponents, RollupContract } from '@aztec/ethereum/contracts';
|
|
2
|
+
import { InboxContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
6
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
@@ -9,13 +10,30 @@ import { EventEmitter } from 'events';
|
|
|
9
10
|
|
|
10
11
|
import type { ViemClient } from '../types.js';
|
|
11
12
|
|
|
13
|
+
/** L2 fee data reported by the chain monitor. */
|
|
14
|
+
export type L2FeeData = ManaMinFeeComponents & {
|
|
15
|
+
/** Total minimum fee per mana in Fee Juice (sum of sequencerCost + proverCost + congestionCost). */
|
|
16
|
+
minFeePerMana: bigint;
|
|
17
|
+
/** L1 base fee observed by the oracle. */
|
|
18
|
+
l1BaseFee: bigint;
|
|
19
|
+
/** L1 blob fee observed by the oracle. */
|
|
20
|
+
l1BlobFee: bigint;
|
|
21
|
+
/** ETH per fee asset exchange rate (1e12 precision). */
|
|
22
|
+
ethPerFeeAsset: bigint;
|
|
23
|
+
/** Mana target per checkpoint. */
|
|
24
|
+
manaTarget: bigint;
|
|
25
|
+
};
|
|
26
|
+
|
|
12
27
|
export type ChainMonitorEventMap = {
|
|
13
28
|
'l1-block': [{ l1BlockNumber: number; timestamp: bigint }];
|
|
14
|
-
checkpoint: [
|
|
15
|
-
|
|
29
|
+
checkpoint: [
|
|
30
|
+
{ checkpointNumber: CheckpointNumber; l1BlockNumber: number; l2SlotNumber: SlotNumber; timestamp: bigint },
|
|
31
|
+
];
|
|
32
|
+
'checkpoint-proven': [{ provenCheckpointNumber: CheckpointNumber; l1BlockNumber: number; timestamp: bigint }];
|
|
16
33
|
'l2-messages': [{ totalL2Messages: number; l1BlockNumber: number }];
|
|
17
34
|
'l2-epoch': [{ l2EpochNumber: EpochNumber; timestamp: bigint; committee: EthAddress[] | undefined }];
|
|
18
35
|
'l2-slot': [{ l2SlotNumber: SlotNumber; timestamp: bigint }];
|
|
36
|
+
'l2-fees': [L2FeeData];
|
|
19
37
|
};
|
|
20
38
|
|
|
21
39
|
/** Utility class that polls the chain on quick intervals and logs new L1 blocks, L2 blocks, and L2 proofs. */
|
|
@@ -29,9 +47,9 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
29
47
|
/** Current L1 block number */
|
|
30
48
|
public l1BlockNumber!: number;
|
|
31
49
|
/** Current checkpoint number */
|
|
32
|
-
public checkpointNumber!:
|
|
50
|
+
public checkpointNumber!: CheckpointNumber;
|
|
33
51
|
/** Current proven checkpoint number */
|
|
34
|
-
public provenCheckpointNumber!:
|
|
52
|
+
public provenCheckpointNumber!: CheckpointNumber;
|
|
35
53
|
/** L1 timestamp for the current checkpoint */
|
|
36
54
|
public checkpointTimestamp!: bigint;
|
|
37
55
|
/** L1 timestamp for the proven checkpoint */
|
|
@@ -42,6 +60,8 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
42
60
|
public l2EpochNumber!: EpochNumber;
|
|
43
61
|
/** Current L2 slot number */
|
|
44
62
|
public l2SlotNumber!: SlotNumber;
|
|
63
|
+
/** Current L2 fee data (components of the minimum fee per mana). */
|
|
64
|
+
public l2FeeData!: L2FeeData;
|
|
45
65
|
|
|
46
66
|
constructor(
|
|
47
67
|
private readonly rollup: RollupContract,
|
|
@@ -74,7 +94,7 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
74
94
|
}
|
|
75
95
|
}
|
|
76
96
|
|
|
77
|
-
|
|
97
|
+
protected async getInbox() {
|
|
78
98
|
if (!this.inbox) {
|
|
79
99
|
const { inboxAddress } = await this.rollup.getRollupAddresses();
|
|
80
100
|
this.inbox = new InboxContract(this.l1Client, inboxAddress);
|
|
@@ -115,9 +135,9 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
115
135
|
this.emit('l1-block', { l1BlockNumber: newL1BlockNumber, timestamp });
|
|
116
136
|
let msg = `L1 block ${newL1BlockNumber} mined at ${timestampString}`;
|
|
117
137
|
|
|
118
|
-
const newCheckpointNumber =
|
|
138
|
+
const newCheckpointNumber = await this.rollup.getCheckpointNumber();
|
|
119
139
|
if (this.checkpointNumber !== newCheckpointNumber) {
|
|
120
|
-
const epochNumber = await this.rollup.getEpochNumberForCheckpoint(
|
|
140
|
+
const epochNumber = await this.rollup.getEpochNumberForCheckpoint(newCheckpointNumber);
|
|
121
141
|
msg += ` with new checkpoint ${newCheckpointNumber} for epoch ${epochNumber}`;
|
|
122
142
|
this.checkpointNumber = newCheckpointNumber;
|
|
123
143
|
this.checkpointTimestamp = timestamp;
|
|
@@ -129,9 +149,9 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
129
149
|
});
|
|
130
150
|
}
|
|
131
151
|
|
|
132
|
-
const newProvenCheckpointNumber =
|
|
152
|
+
const newProvenCheckpointNumber = await this.rollup.getProvenCheckpointNumber();
|
|
133
153
|
if (this.provenCheckpointNumber !== newProvenCheckpointNumber) {
|
|
134
|
-
const epochNumber = await this.rollup.getEpochNumberForCheckpoint(
|
|
154
|
+
const epochNumber = await this.rollup.getEpochNumberForCheckpoint(newProvenCheckpointNumber);
|
|
135
155
|
msg += ` with proof up to checkpoint ${newProvenCheckpointNumber} for epoch ${epochNumber}`;
|
|
136
156
|
this.provenCheckpointNumber = newProvenCheckpointNumber;
|
|
137
157
|
this.provenCheckpointTimestamp = timestamp;
|
|
@@ -153,9 +173,9 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
153
173
|
let committee: EthAddress[] | undefined;
|
|
154
174
|
if (l2Epoch !== this.l2EpochNumber) {
|
|
155
175
|
this.l2EpochNumber = l2Epoch;
|
|
156
|
-
committee =
|
|
176
|
+
committee = await this.rollup.getCurrentEpochCommittee();
|
|
157
177
|
this.emit('l2-epoch', { l2EpochNumber: l2Epoch, timestamp, committee });
|
|
158
|
-
msg += ` starting new epoch ${this.l2EpochNumber}
|
|
178
|
+
msg += ` starting new epoch ${this.l2EpochNumber}`;
|
|
159
179
|
}
|
|
160
180
|
|
|
161
181
|
if (l2SlotNumber !== this.l2SlotNumber) {
|
|
@@ -163,6 +183,13 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
163
183
|
this.emit('l2-slot', { l2SlotNumber, timestamp });
|
|
164
184
|
}
|
|
165
185
|
|
|
186
|
+
const feeData = await this.fetchFeeData(timestamp);
|
|
187
|
+
if (this.hasFeeDataChanged(feeData)) {
|
|
188
|
+
msg += ` with L2 min fee ${feeData.minFeePerMana}`;
|
|
189
|
+
this.l2FeeData = feeData;
|
|
190
|
+
this.emit('l2-fees', feeData);
|
|
191
|
+
}
|
|
192
|
+
|
|
166
193
|
this.logger.info(msg, {
|
|
167
194
|
currentTimestamp: this.dateProvider.nowInSeconds(),
|
|
168
195
|
l1Timestamp: timestamp,
|
|
@@ -173,6 +200,7 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
173
200
|
provenCheckpointNumber: this.provenCheckpointNumber,
|
|
174
201
|
totalL2Messages: this.totalL2Messages,
|
|
175
202
|
committee,
|
|
203
|
+
...this.l2FeeData,
|
|
176
204
|
});
|
|
177
205
|
|
|
178
206
|
return this;
|
|
@@ -193,6 +221,11 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
193
221
|
});
|
|
194
222
|
}
|
|
195
223
|
|
|
224
|
+
public async waitUntilNextL2Slot(): Promise<void> {
|
|
225
|
+
const targetSlot = SlotNumber.add((await this.run()).l2SlotNumber, 1);
|
|
226
|
+
return this.waitUntilL2Slot(targetSlot);
|
|
227
|
+
}
|
|
228
|
+
|
|
196
229
|
public waitUntilL1Block(block: number | bigint): Promise<void> {
|
|
197
230
|
const targetBlock = typeof block === 'bigint' ? block.valueOf() : block;
|
|
198
231
|
if (this.l1BlockNumber >= targetBlock) {
|
|
@@ -225,14 +258,13 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
225
258
|
});
|
|
226
259
|
}
|
|
227
260
|
|
|
228
|
-
public waitUntilCheckpoint(checkpointNumber:
|
|
229
|
-
|
|
230
|
-
if (this.checkpointNumber >= targetBlock) {
|
|
261
|
+
public waitUntilCheckpoint(checkpointNumber: CheckpointNumber): Promise<void> {
|
|
262
|
+
if (this.checkpointNumber >= checkpointNumber) {
|
|
231
263
|
return Promise.resolve();
|
|
232
264
|
}
|
|
233
265
|
return new Promise(resolve => {
|
|
234
|
-
const listener = (data: { checkpointNumber:
|
|
235
|
-
if (data.checkpointNumber >=
|
|
266
|
+
const listener = (data: { checkpointNumber: CheckpointNumber; timestamp: bigint }) => {
|
|
267
|
+
if (data.checkpointNumber >= checkpointNumber) {
|
|
236
268
|
this.off('checkpoint', listener);
|
|
237
269
|
resolve();
|
|
238
270
|
}
|
|
@@ -240,4 +272,36 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
240
272
|
this.on('checkpoint', listener);
|
|
241
273
|
});
|
|
242
274
|
}
|
|
275
|
+
|
|
276
|
+
private async fetchFeeData(timestamp: bigint): Promise<L2FeeData> {
|
|
277
|
+
const [components, minFeePerMana, l1Fees, ethPerFeeAsset, manaTarget] = await Promise.all([
|
|
278
|
+
this.rollup.getManaMinFeeComponentsAt(timestamp, true),
|
|
279
|
+
this.rollup.getManaMinFeeAt(timestamp, true),
|
|
280
|
+
this.rollup.getL1FeesAt(timestamp),
|
|
281
|
+
this.rollup.getEthPerFeeAsset(),
|
|
282
|
+
this.rollup.getManaTarget(),
|
|
283
|
+
]);
|
|
284
|
+
return {
|
|
285
|
+
...components,
|
|
286
|
+
minFeePerMana,
|
|
287
|
+
l1BaseFee: l1Fees.baseFee,
|
|
288
|
+
l1BlobFee: l1Fees.blobFee,
|
|
289
|
+
ethPerFeeAsset,
|
|
290
|
+
manaTarget,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private hasFeeDataChanged(newData: L2FeeData): boolean {
|
|
295
|
+
if (!this.l2FeeData) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
return (
|
|
299
|
+
this.l2FeeData.sequencerCost !== newData.sequencerCost ||
|
|
300
|
+
this.l2FeeData.proverCost !== newData.proverCost ||
|
|
301
|
+
this.l2FeeData.congestionCost !== newData.congestionCost ||
|
|
302
|
+
this.l2FeeData.l1BaseFee !== newData.l1BaseFee ||
|
|
303
|
+
this.l2FeeData.l1BlobFee !== newData.l1BlobFee ||
|
|
304
|
+
this.l2FeeData.ethPerFeeAsset !== newData.ethPerFeeAsset
|
|
305
|
+
);
|
|
306
|
+
}
|
|
243
307
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toBigIntBE, toHex } from '@aztec/foundation/bigint-buffer';
|
|
2
|
-
import { keccak256 } from '@aztec/foundation/crypto';
|
|
2
|
+
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -35,7 +35,7 @@ export class EthCheatCodes {
|
|
|
35
35
|
public chain: Chain = foundry,
|
|
36
36
|
) {
|
|
37
37
|
this.publicClient = createPublicClient({
|
|
38
|
-
transport: fallback(this.rpcUrls.map(url => http(url))),
|
|
38
|
+
transport: fallback(this.rpcUrls.map(url => http(url, { batch: false }))),
|
|
39
39
|
chain: chain,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -85,10 +85,12 @@ export class EthCheatCodes {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Get the
|
|
89
|
-
*
|
|
88
|
+
* Get the timestamp of the latest mined L1 block.
|
|
89
|
+
* Note: this is NOT the current time — it's the discrete timestamp of the last block.
|
|
90
|
+
* Between blocks, the actual chain time advances but no new block reflects it.
|
|
91
|
+
* @returns The latest block timestamp in seconds
|
|
90
92
|
*/
|
|
91
|
-
public async
|
|
93
|
+
public async lastBlockTimestamp(): Promise<number> {
|
|
92
94
|
const res = await this.doRpcCall('eth_getBlockByNumber', ['latest', true]);
|
|
93
95
|
return parseInt(res.timestamp, 16);
|
|
94
96
|
}
|
|
@@ -552,7 +554,7 @@ export class EthCheatCodes {
|
|
|
552
554
|
}
|
|
553
555
|
|
|
554
556
|
public async syncDateProvider() {
|
|
555
|
-
const timestamp = await this.
|
|
557
|
+
const timestamp = await this.lastBlockTimestamp();
|
|
556
558
|
if ('setTime' in this.dateProvider) {
|
|
557
559
|
this.dateProvider.setTime(timestamp * 1000);
|
|
558
560
|
}
|
package/src/test/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export * from './delayed_tx_utils.js';
|
|
2
1
|
export * from './eth_cheat_codes.js';
|
|
3
2
|
export * from './eth_cheat_codes_with_state.js';
|
|
4
3
|
export * from './start_anvil.js';
|
|
5
|
-
export * from './tx_delayer.js';
|
|
6
4
|
export * from './upgrade_utils.js';
|
|
7
5
|
export * from './chain_monitor.js';
|
|
8
6
|
export * from './rollup_cheat_codes.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OutboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
|
-
import {
|
|
3
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
4
|
+
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
7
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
@@ -31,7 +32,7 @@ export class RollupCheatCodes {
|
|
|
31
32
|
) {
|
|
32
33
|
this.client = createPublicClient({
|
|
33
34
|
chain: ethCheatCodes.chain,
|
|
34
|
-
transport: fallback(ethCheatCodes.rpcUrls.map(url => http(url))),
|
|
35
|
+
transport: fallback(ethCheatCodes.rpcUrls.map(url => http(url, { batch: false }))),
|
|
35
36
|
});
|
|
36
37
|
this.rollup = getContract({
|
|
37
38
|
abi: RollupAbi,
|
|
@@ -52,7 +53,26 @@ export class RollupCheatCodes {
|
|
|
52
53
|
/** Returns the current slot */
|
|
53
54
|
public async getSlot(): Promise<SlotNumber> {
|
|
54
55
|
const ts = BigInt((await this.client.getBlock()).timestamp);
|
|
55
|
-
return
|
|
56
|
+
return this.getSlotAt(ts);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Returns the slot number at a given timestamp. */
|
|
60
|
+
public async getSlotAt(timestamp: bigint): Promise<SlotNumber> {
|
|
61
|
+
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([timestamp]));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Returns the timestamp for the start of a given slot. */
|
|
65
|
+
public async getTimestampForSlot(slot: SlotNumber): Promise<bigint> {
|
|
66
|
+
return await this.rollup.read.getTimestampForSlot([BigInt(slot)]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Returns the number of seconds until the start of the given slot based on L1 block timestamp. */
|
|
70
|
+
public async getSecondsUntilSlot(slot: SlotNumber): Promise<number> {
|
|
71
|
+
const [currentTimestamp, targetTimestamp] = await Promise.all([
|
|
72
|
+
this.client.getBlock().then(b => BigInt(b.timestamp)),
|
|
73
|
+
this.rollup.read.getTimestampForSlot([BigInt(slot)]),
|
|
74
|
+
]);
|
|
75
|
+
return Math.max(0, Number(targetTimestamp - currentTimestamp));
|
|
56
76
|
}
|
|
57
77
|
|
|
58
78
|
/** Returns the current epoch */
|
|
@@ -66,10 +86,14 @@ export class RollupCheatCodes {
|
|
|
66
86
|
* @returns The pending and proven chain tips
|
|
67
87
|
*/
|
|
68
88
|
public async getTips(): Promise<{
|
|
69
|
-
/** The pending chain tip */ pending:
|
|
70
|
-
/** The proven chain tip */ proven:
|
|
89
|
+
/** The pending chain tip */ pending: CheckpointNumber;
|
|
90
|
+
/** The proven chain tip */ proven: CheckpointNumber;
|
|
71
91
|
}> {
|
|
72
|
-
|
|
92
|
+
const { pending, proven } = await this.rollup.read.getTips();
|
|
93
|
+
return {
|
|
94
|
+
pending: CheckpointNumber.fromBigInt(pending),
|
|
95
|
+
proven: CheckpointNumber.fromBigInt(proven),
|
|
96
|
+
};
|
|
73
97
|
}
|
|
74
98
|
|
|
75
99
|
/**
|
|
@@ -119,11 +143,11 @@ export class RollupCheatCodes {
|
|
|
119
143
|
} = {},
|
|
120
144
|
) {
|
|
121
145
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
122
|
-
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
146
|
+
const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
|
|
123
147
|
const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
|
|
124
148
|
try {
|
|
125
149
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
126
|
-
this.logger.warn(`Warped to epoch ${epoch}
|
|
150
|
+
this.logger.warn(`Warped to epoch ${epoch}`, { offset: opts.offset, timestamp });
|
|
127
151
|
} catch (err) {
|
|
128
152
|
this.logger.warn(`Warp to epoch ${epoch} failed: ${err}`);
|
|
129
153
|
}
|
|
@@ -171,7 +195,7 @@ export class RollupCheatCodes {
|
|
|
171
195
|
* Marks the specified checkpoint (or latest if none) as proven
|
|
172
196
|
* @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
|
|
173
197
|
*/
|
|
174
|
-
public markAsProven(maybeCheckpointNumber?:
|
|
198
|
+
public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
|
|
175
199
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
176
200
|
const tipsBefore = await this.getTips();
|
|
177
201
|
const { pending, proven } = tipsBefore;
|
|
@@ -245,6 +269,15 @@ export class RollupCheatCodes {
|
|
|
245
269
|
});
|
|
246
270
|
}
|
|
247
271
|
|
|
272
|
+
public insertOutbox(epoch: EpochNumber, outHash: bigint) {
|
|
273
|
+
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
274
|
+
const outboxAddress = await this.rollup.read.getOutbox();
|
|
275
|
+
const epochRootSlot = OutboxContract.getEpochRootStorageSlot(epoch);
|
|
276
|
+
await this.ethCheatCodes.store(EthAddress.fromString(outboxAddress), epochRootSlot, outHash);
|
|
277
|
+
this.logger.warn(`Advanced outbox to epoch ${epoch} with out hash ${outHash}`);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
248
281
|
/**
|
|
249
282
|
* Executes an action impersonated as the owner of the Rollup contract.
|
|
250
283
|
* @param action - The action to execute
|
package/src/test/start_anvil.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
3
|
+
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
3
4
|
import { fileURLToPath } from '@aztec/foundation/url';
|
|
4
5
|
|
|
5
|
-
import { type
|
|
6
|
+
import { type ChildProcess, spawn } from 'child_process';
|
|
6
7
|
import { dirname, resolve } from 'path';
|
|
7
8
|
|
|
9
|
+
/** Minimal interface matching the @viem/anvil Anvil shape used by callers. */
|
|
10
|
+
export interface Anvil {
|
|
11
|
+
readonly port: number;
|
|
12
|
+
readonly host: string;
|
|
13
|
+
readonly status: 'listening' | 'idle';
|
|
14
|
+
stop(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* Ensures there's a running Anvil instance and returns the RPC URL.
|
|
10
19
|
*/
|
|
@@ -16,54 +25,195 @@ export async function startAnvil(
|
|
|
16
25
|
captureMethodCalls?: boolean;
|
|
17
26
|
accounts?: number;
|
|
18
27
|
chainId?: number;
|
|
28
|
+
/** The hardfork to use (e.g. 'cancun', 'latest'). */
|
|
29
|
+
hardfork?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Number of slots per epoch used by anvil to compute the 'finalized' and 'safe' block tags.
|
|
32
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
33
|
+
* Defaults to 1 so the finalized block advances immediately, making tests that check
|
|
34
|
+
* L1-finality-based logic work without needing hundreds of mined blocks.
|
|
35
|
+
*/
|
|
36
|
+
slotsInAnEpoch?: number;
|
|
37
|
+
/**
|
|
38
|
+
* If provided, the date provider will be synced to anvil's block time on every mined block.
|
|
39
|
+
* This keeps the dateProvider in lockstep with anvil's chain time, avoiding drift between
|
|
40
|
+
* the wall clock and the L1 chain when computing L1 slot timestamps.
|
|
41
|
+
*/
|
|
42
|
+
dateProvider?: TestDateProvider;
|
|
19
43
|
} = {},
|
|
20
44
|
): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
|
|
21
45
|
const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
|
|
22
46
|
const logger = opts.log ? createLogger('ethereum:anvil') : undefined;
|
|
23
47
|
const methodCalls = opts.captureMethodCalls ? ([] as string[]) : undefined;
|
|
24
48
|
|
|
25
|
-
let
|
|
49
|
+
let detectedPort: number | undefined;
|
|
26
50
|
|
|
27
|
-
// Start anvil.
|
|
28
|
-
// We go via a wrapper script to ensure if the parent dies, anvil dies.
|
|
29
51
|
const anvil = await retry(
|
|
30
52
|
async () => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
host
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
accounts
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
const port = opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545);
|
|
54
|
+
const args: string[] = [
|
|
55
|
+
'--host',
|
|
56
|
+
'127.0.0.1',
|
|
57
|
+
'--port',
|
|
58
|
+
String(port),
|
|
59
|
+
'--accounts',
|
|
60
|
+
String(opts.accounts ?? 20),
|
|
61
|
+
'--gas-limit',
|
|
62
|
+
String(45_000_000),
|
|
63
|
+
'--chain-id',
|
|
64
|
+
String(opts.chainId ?? 31337),
|
|
65
|
+
];
|
|
66
|
+
if (opts.l1BlockTime !== undefined) {
|
|
67
|
+
args.push('--block-time', String(opts.l1BlockTime));
|
|
68
|
+
}
|
|
69
|
+
if (opts.hardfork !== undefined) {
|
|
70
|
+
args.push('--hardfork', opts.hardfork);
|
|
71
|
+
}
|
|
72
|
+
args.push('--slots-in-an-epoch', String(opts.slotsInAnEpoch ?? 1));
|
|
73
|
+
|
|
74
|
+
const child = spawn(anvilBinary, args, {
|
|
75
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
76
|
+
env: { ...process.env, RAYON_NUM_THREADS: '1' },
|
|
40
77
|
});
|
|
41
78
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
79
|
+
// Wait for "Listening on" or an early exit.
|
|
80
|
+
await new Promise<void>((resolve, reject) => {
|
|
81
|
+
let stderr = '';
|
|
82
|
+
|
|
83
|
+
const onStdout = (data: Buffer) => {
|
|
84
|
+
const text = data.toString();
|
|
85
|
+
logger?.debug(text.trim());
|
|
86
|
+
methodCalls?.push(...(text.match(/eth_[^\s]+/g) || []));
|
|
87
|
+
|
|
88
|
+
if (detectedPort === undefined && text.includes('Listening on')) {
|
|
89
|
+
const match = text.match(/Listening on ([^:]+):(\d+)/);
|
|
90
|
+
if (match) {
|
|
91
|
+
detectedPort = parseInt(match[2]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (detectedPort !== undefined) {
|
|
95
|
+
child.stdout?.removeListener('data', onStdout);
|
|
96
|
+
child.stderr?.removeListener('data', onStderr);
|
|
97
|
+
child.removeListener('close', onClose);
|
|
98
|
+
resolve();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
45
101
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
102
|
+
const onStderr = (data: Buffer) => {
|
|
103
|
+
stderr += data.toString();
|
|
104
|
+
logger?.debug(data.toString().trim());
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const onClose = (code: number | null) => {
|
|
108
|
+
child.stdout?.removeListener('data', onStdout);
|
|
109
|
+
child.stderr?.removeListener('data', onStderr);
|
|
110
|
+
reject(new Error(`Anvil exited with code ${code} before listening. stderr: ${stderr}`));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
child.stdout?.on('data', onStdout);
|
|
114
|
+
child.stderr?.on('data', onStderr);
|
|
115
|
+
child.once('close', onClose);
|
|
50
116
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
117
|
+
|
|
118
|
+
// Continue piping for logging, method-call capture, and/or dateProvider sync after startup.
|
|
119
|
+
if (logger || opts.captureMethodCalls || opts.dateProvider) {
|
|
120
|
+
child.stdout?.on('data', (data: Buffer) => {
|
|
121
|
+
const text = data.toString();
|
|
122
|
+
logger?.debug(text.trim());
|
|
123
|
+
methodCalls?.push(...(text.match(/eth_[^\s]+/g) || []));
|
|
124
|
+
if (opts.dateProvider) {
|
|
125
|
+
syncDateProviderFromAnvilOutput(text, opts.dateProvider);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
child.stderr?.on('data', (data: Buffer) => {
|
|
129
|
+
logger?.debug(data.toString().trim());
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
// Consume streams so the child process doesn't block on full pipe buffers.
|
|
133
|
+
child.stdout?.resume();
|
|
134
|
+
child.stderr?.resume();
|
|
54
135
|
}
|
|
55
136
|
|
|
56
|
-
return
|
|
137
|
+
return child;
|
|
57
138
|
},
|
|
58
139
|
'Start anvil',
|
|
59
140
|
makeBackoff([5, 5, 5]),
|
|
60
141
|
);
|
|
61
142
|
|
|
62
|
-
if (!
|
|
143
|
+
if (!detectedPort) {
|
|
63
144
|
throw new Error('Failed to start anvil');
|
|
64
145
|
}
|
|
65
146
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
147
|
+
const port = detectedPort;
|
|
148
|
+
let status: 'listening' | 'idle' = 'listening';
|
|
149
|
+
|
|
150
|
+
anvil.once('close', () => {
|
|
151
|
+
status = 'idle';
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const stop = async () => {
|
|
155
|
+
if (status === 'idle') {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
await killChild(anvil);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const anvilObj: Anvil = {
|
|
162
|
+
port,
|
|
163
|
+
host: '127.0.0.1',
|
|
164
|
+
get status() {
|
|
165
|
+
return status;
|
|
166
|
+
},
|
|
167
|
+
stop,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return { anvil: anvilObj, methodCalls, stop, rpcUrl: `http://127.0.0.1:${port}` };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Extracts block time from anvil stdout and syncs the dateProvider. */
|
|
174
|
+
function syncDateProviderFromAnvilOutput(text: string, dateProvider: TestDateProvider): void {
|
|
175
|
+
// Anvil logs mined blocks as:
|
|
176
|
+
// Block Time: "Fri, 20 Mar 2026 02:10:46 +0000"
|
|
177
|
+
const match = text.match(/Block Time:\s*"([^"]+)"/);
|
|
178
|
+
if (match) {
|
|
179
|
+
const blockTimeMs = new Date(match[1]).getTime();
|
|
180
|
+
if (!isNaN(blockTimeMs)) {
|
|
181
|
+
dateProvider.setTime(blockTimeMs);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Send SIGTERM, wait up to 5 s, then SIGKILL. All timers are always cleared. */
|
|
187
|
+
function killChild(child: ChildProcess): Promise<void> {
|
|
188
|
+
return new Promise<void>(resolve => {
|
|
189
|
+
if (child.exitCode !== null || child.killed) {
|
|
190
|
+
child.stdout?.destroy();
|
|
191
|
+
child.stderr?.destroy();
|
|
192
|
+
resolve();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let killTimer: NodeJS.Timeout | undefined;
|
|
197
|
+
|
|
198
|
+
const onClose = () => {
|
|
199
|
+
if (killTimer !== undefined) {
|
|
200
|
+
clearTimeout(killTimer);
|
|
201
|
+
}
|
|
202
|
+
// Destroy stdio streams so their PipeWrap handles don't keep the event loop alive.
|
|
203
|
+
child.stdout?.destroy();
|
|
204
|
+
child.stderr?.destroy();
|
|
205
|
+
resolve();
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
child.once('close', onClose);
|
|
209
|
+
child.kill('SIGTERM');
|
|
210
|
+
|
|
211
|
+
killTimer = setTimeout(() => {
|
|
212
|
+
killTimer = undefined;
|
|
213
|
+
child.kill('SIGKILL');
|
|
214
|
+
}, 5000);
|
|
215
|
+
|
|
216
|
+
// Ensure the timer does not prevent Node from exiting.
|
|
217
|
+
killTimer.unref();
|
|
218
|
+
});
|
|
69
219
|
}
|
|
@@ -7,7 +7,7 @@ import { type GetContractReturnType, type PrivateKeyAccount, getContract } from
|
|
|
7
7
|
|
|
8
8
|
import { extractProposalIdFromLogs } from '../contracts/governance.js';
|
|
9
9
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
10
|
-
import {
|
|
10
|
+
import { createL1TxUtils } from '../l1_tx_utils/index.js';
|
|
11
11
|
import type { ExtendedViemWalletClient, ViemPublicClient } from '../types.js';
|
|
12
12
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ export async function executeGovernanceProposal(
|
|
|
22
22
|
) {
|
|
23
23
|
const proposal = await governance.read.getProposal([proposalId]);
|
|
24
24
|
|
|
25
|
-
const l1TxUtils =
|
|
25
|
+
const l1TxUtils = createL1TxUtils(l1Client);
|
|
26
26
|
|
|
27
27
|
const waitL1Block = async () => {
|
|
28
28
|
await l1TxUtils.sendAndMonitorTransaction({
|