@aztec/ethereum 2.1.0-rc.1 → 2.1.0-rc.10
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.js +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/chain.d.ts.map +1 -1
- package/dest/chain.js +1 -1
- package/dest/client.d.ts +1 -1
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +3 -3
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +1 -1
- package/dest/constants.d.ts +1 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/contracts/empire_base.d.ts +2 -2
- 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 -5
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +6 -6
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +1 -1
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/fee_juice.js +1 -1
- package/dest/contracts/governance.d.ts +1 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +8 -4
- package/dest/contracts/governance_proposer.d.ts +2 -3
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +2 -3
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/gse.js +1 -1
- package/dest/contracts/inbox.d.ts +1 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +1 -1
- package/dest/contracts/multicall.d.ts +6 -8
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +3 -5
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +1 -1
- package/dest/contracts/rollup.d.ts +9 -9
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +6 -7
- package/dest/contracts/slasher_contract.js +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +1 -1
- package/dest/deploy_l1_contracts.d.ts +3 -3
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +21 -6
- package/dest/eth-signer/eth-signer.d.ts +1 -1
- package/dest/eth-signer/eth-signer.d.ts.map +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/l1_artifacts.d.ts +1 -1
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.d.ts +59 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +73 -0
- package/dest/l1_tx_utils/constants.d.ts +6 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +14 -0
- package/dest/l1_tx_utils/factory.d.ts +24 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +12 -0
- package/dest/l1_tx_utils/index.d.ts +10 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +10 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +95 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +81 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +294 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/publisher_manager.d.ts +3 -1
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +28 -8
- package/dest/test/chain_monitor.js +2 -2
- package/dest/test/delayed_tx_utils.d.ts +2 -2
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +2 -2
- package/dest/test/eth_cheat_codes.d.ts +18 -1
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +101 -22
- package/dest/test/rollup_cheat_codes.d.ts +1 -1
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +2 -2
- 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 +1 -1
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/types.d.ts +1 -1
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +1 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +1 -1
- package/package.json +7 -7
- package/src/account.ts +1 -1
- package/src/chain.ts +2 -2
- package/src/client.ts +3 -3
- package/src/config.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/contracts/empire_base.ts +2 -2
- package/src/contracts/empire_slashing_proposer.ts +3 -3
- package/src/contracts/fee_asset_handler.ts +2 -2
- package/src/contracts/fee_juice.ts +1 -1
- package/src/contracts/governance.ts +4 -4
- package/src/contracts/governance_proposer.ts +4 -5
- package/src/contracts/gse.ts +1 -1
- package/src/contracts/inbox.ts +1 -1
- package/src/contracts/multicall.ts +8 -11
- package/src/contracts/registry.ts +1 -1
- package/src/contracts/rollup.ts +11 -11
- package/src/contracts/slasher_contract.ts +1 -1
- package/src/contracts/tally_slashing_proposer.ts +1 -1
- package/src/deploy_l1_contracts.ts +20 -14
- package/src/eth-signer/eth-signer.ts +1 -1
- package/src/index.ts +1 -1
- package/src/l1_artifacts.ts +1 -1
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +140 -0
- package/src/l1_tx_utils/constants.ts +18 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/index.ts +12 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +372 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/publisher_manager.ts +39 -7
- package/src/test/chain_monitor.ts +2 -2
- package/src/test/delayed_tx_utils.ts +2 -2
- package/src/test/eth_cheat_codes.ts +120 -20
- package/src/test/rollup_cheat_codes.ts +2 -2
- package/src/test/tx_delayer.ts +2 -2
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +1 -1
- package/src/utils.ts +1 -1
- package/dest/l1_tx_utils.d.ts +0 -252
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -835
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -20
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -87
- package/src/l1_tx_utils.ts +0 -1125
- package/src/l1_tx_utils_with_blobs.ts +0 -150
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
|
-
import { createViemSigner } from '../l1_tx_utils.js';
|
|
5
|
-
import { L1TxUtilsWithBlobs } from '../l1_tx_utils_with_blobs.js';
|
|
4
|
+
import { createViemSigner } from '../l1_tx_utils/index.js';
|
|
5
|
+
import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
|
|
6
6
|
import { withDelayer } from './tx_delayer.js';
|
|
7
7
|
export class DelayedTxUtils extends L1TxUtilsWithBlobs {
|
|
8
8
|
delayer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import { type Hex } from 'viem';
|
|
3
|
+
import { type Hex, type Transaction } from '@spalladino/viem';
|
|
4
4
|
import type { ViemPublicClient } from '../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* A class that provides utility functions for interacting with ethereum (L1).
|
|
@@ -25,6 +25,7 @@ export declare class EthCheatCodes {
|
|
|
25
25
|
*/
|
|
26
26
|
logger?: import("@aztec/foundation/log").Logger);
|
|
27
27
|
rpcCall(method: string, params: any[]): Promise<any>;
|
|
28
|
+
private doRpcCall;
|
|
28
29
|
/**
|
|
29
30
|
* Get the auto mine status of the underlying chain
|
|
30
31
|
* @returns True if automine is on, false otherwise
|
|
@@ -190,6 +191,22 @@ export declare class EthCheatCodes {
|
|
|
190
191
|
value?: number | bigint;
|
|
191
192
|
})[][]): Promise<void>;
|
|
192
193
|
traceTransaction(txHash: Hex): Promise<any>;
|
|
194
|
+
getTxPoolStatus(): Promise<{
|
|
195
|
+
pending: number;
|
|
196
|
+
queued: number;
|
|
197
|
+
}>;
|
|
198
|
+
getTxPoolContents(): Promise<TxPoolTransaction[]>;
|
|
199
|
+
/**
|
|
200
|
+
* Mines an empty block by temporarily removing all pending transactions from the mempool,
|
|
201
|
+
* mining a block, and then re-adding the transactions back to the pool.
|
|
202
|
+
*/
|
|
203
|
+
mineEmptyBlock(blockCount?: number): Promise<void>;
|
|
193
204
|
execWithPausedAnvil(fn: () => Promise<void>): Promise<void>;
|
|
205
|
+
syncDateProvider(dateProvider: TestDateProvider): Promise<void>;
|
|
194
206
|
}
|
|
207
|
+
type TxPoolState = 'pending' | 'queued';
|
|
208
|
+
export type TxPoolTransaction = Transaction & {
|
|
209
|
+
poolState: TxPoolState;
|
|
210
|
+
};
|
|
211
|
+
export {};
|
|
195
212
|
//# sourceMappingURL=eth_cheat_codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eth_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/test/eth_cheat_codes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"eth_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/test/eth_cheat_codes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAmD,MAAM,kBAAkB,CAAC;AAE/G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,qBAAa,aAAa;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AAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,SAAS,EAAE,WAAW,CAAC;CACxB,CAAC"}
|
|
@@ -2,7 +2,8 @@ import { toBigIntBE, toHex } from '@aztec/foundation/bigint-buffer';
|
|
|
2
2
|
import { keccak256 } from '@aztec/foundation/crypto';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import {
|
|
5
|
+
import { pluralize } from '@aztec/foundation/string';
|
|
6
|
+
import { createPublicClient, fallback, hexToNumber, http } from '@spalladino/viem';
|
|
6
7
|
/**
|
|
7
8
|
* A class that provides utility functions for interacting with ethereum (L1).
|
|
8
9
|
*/ export class EthCheatCodes {
|
|
@@ -20,9 +21,11 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
20
21
|
transport: fallback(this.rpcUrls.map((url)=>http(url)))
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
24
|
+
rpcCall(method, params) {
|
|
25
|
+
this.logger.debug(`Calling ${method} with params: ${jsonStringify(params)} on ${this.rpcUrls.join(', ')}`);
|
|
26
|
+
return this.doRpcCall(method, params);
|
|
27
|
+
}
|
|
28
|
+
async doRpcCall(method, params) {
|
|
26
29
|
return await this.publicClient.transport.request({
|
|
27
30
|
method,
|
|
28
31
|
params
|
|
@@ -33,7 +36,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
33
36
|
* @returns True if automine is on, false otherwise
|
|
34
37
|
*/ async isAutoMining() {
|
|
35
38
|
try {
|
|
36
|
-
const res = await this.
|
|
39
|
+
const res = await this.doRpcCall('anvil_getAutomine', []);
|
|
37
40
|
return res;
|
|
38
41
|
} catch (err) {
|
|
39
42
|
this.logger.error(`Calling "anvil_getAutomine" failed with:`, err);
|
|
@@ -44,21 +47,21 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
44
47
|
* Get the current blocknumber
|
|
45
48
|
* @returns The current block number
|
|
46
49
|
*/ async blockNumber() {
|
|
47
|
-
const res = await this.
|
|
50
|
+
const res = await this.doRpcCall('eth_blockNumber', []);
|
|
48
51
|
return parseInt(res, 16);
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Get the current chainId
|
|
52
55
|
* @returns The current chainId
|
|
53
56
|
*/ async chainId() {
|
|
54
|
-
const res = await this.
|
|
57
|
+
const res = await this.doRpcCall('eth_chainId', []);
|
|
55
58
|
return parseInt(res, 16);
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Get the current timestamp
|
|
59
62
|
* @returns The current timestamp
|
|
60
63
|
*/ async timestamp() {
|
|
61
|
-
const res = await this.
|
|
64
|
+
const res = await this.doRpcCall('eth_getBlockByNumber', [
|
|
62
65
|
'latest',
|
|
63
66
|
true
|
|
64
67
|
]);
|
|
@@ -73,7 +76,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
73
76
|
}
|
|
74
77
|
async doMine(numberOfBlocks = 1) {
|
|
75
78
|
try {
|
|
76
|
-
await this.
|
|
79
|
+
await this.doRpcCall('hardhat_mine', [
|
|
77
80
|
numberOfBlocks
|
|
78
81
|
]);
|
|
79
82
|
} catch (err) {
|
|
@@ -84,7 +87,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
84
87
|
* Mines a single block with evm_mine
|
|
85
88
|
*/ async evmMine() {
|
|
86
89
|
try {
|
|
87
|
-
await this.
|
|
90
|
+
await this.doRpcCall('evm_mine', []);
|
|
91
|
+
this.logger.warn(`Mined 1 L1 block with evm_mine`);
|
|
88
92
|
} catch (err) {
|
|
89
93
|
throw new Error(`Error mining: ${err}`);
|
|
90
94
|
}
|
|
@@ -105,7 +109,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
105
109
|
this.logger.warn(`Set balance for ${account} to ${balance}`);
|
|
106
110
|
}
|
|
107
111
|
async getBalance(account) {
|
|
108
|
-
const res = await this.
|
|
112
|
+
const res = await this.doRpcCall('eth_getBalance', [
|
|
109
113
|
account.toString(),
|
|
110
114
|
'latest'
|
|
111
115
|
]);
|
|
@@ -142,7 +146,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
142
146
|
* @param seconds - The interval to use between blocks
|
|
143
147
|
*/ getIntervalMining() {
|
|
144
148
|
try {
|
|
145
|
-
return this.
|
|
149
|
+
return this.doRpcCall('anvil_getIntervalMining', []);
|
|
146
150
|
} catch (err) {
|
|
147
151
|
throw new Error(`Error getting interval mining: ${err}`);
|
|
148
152
|
}
|
|
@@ -333,31 +337,28 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
333
337
|
* @param contract - The contract address
|
|
334
338
|
* @returns The bytecode for the contract
|
|
335
339
|
*/ async getBytecode(contract) {
|
|
336
|
-
|
|
340
|
+
return await this.doRpcCall('eth_getCode', [
|
|
337
341
|
contract.toString(),
|
|
338
342
|
'latest'
|
|
339
343
|
]);
|
|
340
|
-
return res;
|
|
341
344
|
}
|
|
342
345
|
/**
|
|
343
346
|
* Get the raw transaction object for a given transaction hash
|
|
344
347
|
* @param txHash - The transaction hash
|
|
345
348
|
* @returns The raw transaction
|
|
346
349
|
*/ async getRawTransaction(txHash) {
|
|
347
|
-
|
|
350
|
+
return await this.doRpcCall('debug_getRawTransaction', [
|
|
348
351
|
txHash
|
|
349
352
|
]);
|
|
350
|
-
return res;
|
|
351
353
|
}
|
|
352
354
|
/**
|
|
353
355
|
* Get the trace for a given transaction hash
|
|
354
356
|
* @param txHash - The transaction hash
|
|
355
357
|
* @returns The trace
|
|
356
358
|
*/ async debugTraceTransaction(txHash) {
|
|
357
|
-
|
|
359
|
+
return await this.doRpcCall('debug_traceTransaction', [
|
|
358
360
|
txHash
|
|
359
361
|
]);
|
|
360
|
-
return res;
|
|
361
362
|
}
|
|
362
363
|
/**
|
|
363
364
|
* Triggers a reorg of the given depth, removing those blocks from the chain.
|
|
@@ -373,9 +374,6 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
373
374
|
* Causes Anvil to reorg until the given block number is the new tip
|
|
374
375
|
* @param blockNumber - The block number that's going to be the new tip
|
|
375
376
|
*/ reorgTo(blockNumber) {
|
|
376
|
-
this.logger.info('reorgTo', {
|
|
377
|
-
blockNumber
|
|
378
|
-
});
|
|
379
377
|
if (blockNumber <= 0) {
|
|
380
378
|
throw new Error(`Can't reorg to block before genesis: ${blockNumber}`);
|
|
381
379
|
}
|
|
@@ -389,6 +387,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
389
387
|
await this.rpcCall('anvil_rollback', [
|
|
390
388
|
depth
|
|
391
389
|
]);
|
|
390
|
+
this.logger.warn(`Reorged L1 chain to block number ${blockNumber} (depth ${depth})`);
|
|
392
391
|
});
|
|
393
392
|
}
|
|
394
393
|
/**
|
|
@@ -418,10 +417,68 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
418
417
|
});
|
|
419
418
|
}
|
|
420
419
|
traceTransaction(txHash) {
|
|
421
|
-
return this.
|
|
420
|
+
return this.doRpcCall('trace_transaction', [
|
|
422
421
|
txHash
|
|
423
422
|
]);
|
|
424
423
|
}
|
|
424
|
+
async getTxPoolStatus() {
|
|
425
|
+
const { pending, queued } = await this.doRpcCall('txpool_status', []);
|
|
426
|
+
return {
|
|
427
|
+
pending: hexToNumber(pending),
|
|
428
|
+
queued: hexToNumber(queued)
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
async getTxPoolContents() {
|
|
432
|
+
const txpoolContent = await this.doRpcCall('txpool_content', []);
|
|
433
|
+
return mapTxPoolContent(txpoolContent);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Mines an empty block by temporarily removing all pending transactions from the mempool,
|
|
437
|
+
* mining a block, and then re-adding the transactions back to the pool.
|
|
438
|
+
*/ async mineEmptyBlock(blockCount = 1) {
|
|
439
|
+
await this.execWithPausedAnvil(async ()=>{
|
|
440
|
+
// Get all pending and queued transactions from the pool
|
|
441
|
+
const txs = await this.getTxPoolContents();
|
|
442
|
+
this.logger.debug(`Found ${txs.length} transactions in pool`);
|
|
443
|
+
// Get raw transactions before dropping them
|
|
444
|
+
const rawTxs = [];
|
|
445
|
+
for (const tx of txs){
|
|
446
|
+
try {
|
|
447
|
+
const rawTx = await this.doRpcCall('debug_getRawTransaction', [
|
|
448
|
+
tx.hash
|
|
449
|
+
]);
|
|
450
|
+
if (rawTx) {
|
|
451
|
+
rawTxs.push(rawTx);
|
|
452
|
+
this.logger.debug(`Got raw tx for ${tx.hash}`);
|
|
453
|
+
} else {
|
|
454
|
+
this.logger.warn(`No raw tx found for ${tx.hash}`);
|
|
455
|
+
}
|
|
456
|
+
} catch {
|
|
457
|
+
this.logger.warn(`Failed to get raw transaction for ${tx.hash}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
this.logger.debug(`Retrieved ${rawTxs.length} raw transactions`);
|
|
461
|
+
// Drop all transactions from the mempool
|
|
462
|
+
await this.doRpcCall('anvil_dropAllTransactions', []);
|
|
463
|
+
// Mine an empty block
|
|
464
|
+
await this.doMine(blockCount);
|
|
465
|
+
// Re-add the transactions to the pool
|
|
466
|
+
for (const rawTx of rawTxs){
|
|
467
|
+
try {
|
|
468
|
+
const txHash = await this.doRpcCall('eth_sendRawTransaction', [
|
|
469
|
+
rawTx
|
|
470
|
+
]);
|
|
471
|
+
this.logger.debug(`Re-added transaction ${txHash}`);
|
|
472
|
+
} catch (err) {
|
|
473
|
+
this.logger.warn(`Failed to re-add transaction: ${err}`);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (rawTxs.length !== txs.length) {
|
|
477
|
+
this.logger.warn(`Failed to add all txs back: had ${txs.length} but re-added ${rawTxs.length}`);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
this.logger.warn(`Mined ${blockCount} empty L1 ${pluralize('block', blockCount)}`);
|
|
481
|
+
}
|
|
425
482
|
async execWithPausedAnvil(fn) {
|
|
426
483
|
const [blockInterval, wasAutoMining] = await Promise.all([
|
|
427
484
|
this.getIntervalMining(),
|
|
@@ -462,4 +519,26 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
462
519
|
}
|
|
463
520
|
}
|
|
464
521
|
}
|
|
522
|
+
async syncDateProvider(dateProvider) {
|
|
523
|
+
const timestamp = await this.timestamp();
|
|
524
|
+
if ('setTime' in dateProvider) {
|
|
525
|
+
dateProvider.setTime(timestamp * 1000);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function mapTxPoolContent(content) {
|
|
530
|
+
const result = [];
|
|
531
|
+
const processPool = (pool, poolState)=>{
|
|
532
|
+
for (const txsByNonce of Object.values(pool)){
|
|
533
|
+
for (const tx of Object.values(txsByNonce)){
|
|
534
|
+
result.push({
|
|
535
|
+
...tx,
|
|
536
|
+
poolState
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
processPool(content.pending, 'pending');
|
|
542
|
+
processPool(content.queued, 'queued');
|
|
543
|
+
return result;
|
|
465
544
|
}
|
|
@@ -2,7 +2,7 @@ import { type ViemPublicClient } from '@aztec/ethereum';
|
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
4
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
|
-
import { type GetContractReturnType, type Hex } from 'viem';
|
|
5
|
+
import { type GetContractReturnType, type Hex } from '@spalladino/viem';
|
|
6
6
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
7
7
|
/** Cheat codes for the L1 rollup contract. */
|
|
8
8
|
export declare class RollupCheatCodes {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/test/rollup_cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,iBAAi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C,MAAM,EAAE,MAAM,CAAC;KAC5C,CAAC;IAQF;;OAEG;IACU,WAAW;IAmBxB,0EAA0E;IAC7D,SAAS,IAAI,OAAO,CAAC;QAChC,qBAAqB,CAAC,aAAa,EAAE,MAAM,CAAC;QAC5C,oBAAoB,CAAC,YAAY,EAAE,MAAM,CAAC;KAC3C,CAAC;IAQF;;;;OAIG;IACU,cAAc,CACzB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,IAAI,GAAE;QACJ,qEAAqE;QACrE,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;QACtC,wBAAwB;QACxB,MAAM,CAAC,EAAE,MAAM,CAAC;KACZ;IAcR,4CAA4C;IAC/B,kBAAkB,CAC7B,IAAI,GAAE;QACJ,qEAAqE;QACrE,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;KAClC;IAeR,6DAA6D;IAChD,iBAAiB;IAQ9B;;;OAGG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM;IASzC;;;OAGG;IACI,YAAY,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAiCtD;;;OAGG;IACU,OAAO,CAClB,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,qBAAqB,CAAC,OAAO,SAAS,EAAE,gBAAgB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;IAQ1G;;OAEG;IACU,UAAU;IASvB,4CAA4C;IAC/B,oBAAoB;IAQjC;;;OAGG;IACU,sBAAsB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM;IAMtE;;;OAGG;IACU,qBAAqB,CAAC,QAAQ,EAAE,MAAM;CAWpD"}
|
|
@@ -2,8 +2,8 @@ import { RollupContract } from '@aztec/ethereum';
|
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
|
-
import { createPublicClient, fallback, getContract, hexToBigInt, http } from 'viem';
|
|
6
|
-
import { foundry } from 'viem/chains';
|
|
5
|
+
import { createPublicClient, fallback, getContract, hexToBigInt, http } from '@spalladino/viem';
|
|
6
|
+
import { foundry } from '@spalladino/viem/chains';
|
|
7
7
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
8
8
|
/** Cheat codes for the L1 rollup contract. */ export class RollupCheatCodes {
|
|
9
9
|
ethCheatCodes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Logger } from '@aztec/foundation/log';
|
|
2
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import { type Client, type Hex } from 'viem';
|
|
3
|
+
import { type Client, type Hex } from '@spalladino/viem';
|
|
4
4
|
import { type ViemClient } from '../types.js';
|
|
5
5
|
export declare function waitUntilBlock<T extends Client>(client: T, blockNumber: number | bigint, logger?: Logger, timeout?: number): Promise<boolean>;
|
|
6
6
|
export declare function waitUntilL1Timestamp<T extends Client>(client: T, timestamp: number | bigint, logger?: Logger, timeout?: number): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_delayer.d.ts","sourceRoot":"","sources":["../../src/test/tx_delayer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_delayer.d.ts","sourceRoot":"","sources":["../../src/test/tx_delayer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,KAAK,MAAM,EACX,KAAK,GAAG,EAQT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,aAAa,CAAC;AAEhE,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,oBAiBjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EACnD,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,oBAwBjB;AAED,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,eAAe,IAAI,GAAG,EAAE,CAAC;IACzB,iDAAiD;IACjD,eAAe,IAAI,GAAG,EAAE,CAAC;IACzB,8EAA8E;IAC9E,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxE,wEAAwE;IACxE,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1E,kDAAkD;IAClD,YAAY,IAAI,IAAI,CAAC;IACrB;;;;OAIG;IACH,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACzE;AA0CD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAC9C,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE;IAAE,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAC9C;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA0GjC"}
|
package/dest/test/tx_delayer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { omit } from '@aztec/foundation/collection';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
|
+
import { keccak256, parseTransaction, publicActions, serializeTransaction, walletActions } from '@spalladino/viem';
|
|
4
5
|
import { inspect } from 'util';
|
|
5
|
-
import { keccak256, parseTransaction, publicActions, serializeTransaction, walletActions } from 'viem';
|
|
6
6
|
import { isExtendedClient } from '../types.js';
|
|
7
7
|
export function waitUntilBlock(client, blockNumber, logger, timeout) {
|
|
8
8
|
const publicClient = 'getBlockNumber' in client && typeof client.getBlockNumber === 'function' ? client : client.extend(publicActions);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
3
|
-
import { type GetContractReturnType, type PrivateKeyAccount } from 'viem';
|
|
3
|
+
import { type GetContractReturnType, type PrivateKeyAccount } from '@spalladino/viem';
|
|
4
4
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
5
5
|
import type { ExtendedViemWalletClient, ViemPublicClient } from '../types.js';
|
|
6
6
|
export declare function executeGovernanceProposal(proposalId: bigint, governance: GetContractReturnType<typeof GovernanceAbi, ViemPublicClient>, voteAmount: bigint, privateKey: PrivateKeyAccount, l1Client: ExtendedViemWalletClient, rpcUrls: string[], logger: Logger): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade_utils.d.ts","sourceRoot":"","sources":["../../src/test/upgrade_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"upgrade_utils.d.ts","sourceRoot":"","sources":["../../src/test/upgrade_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAe,MAAM,kBAAkB,CAAC;AAGnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG9E,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,qBAAqB,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC,EACzE,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,wBAAwB,EAClC,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,iBAmCf;AAED,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,KAAK,MAAM,EAAE,EAC7B,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,iBAAiB,EAC7B,YAAY,EAAE,gBAAgB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IACT,UAAU,EAAE,qBAAqB,CAAC,OAAO,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAyCD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
2
2
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
3
|
-
import { getContract } from 'viem';
|
|
3
|
+
import { getContract } from '@spalladino/viem';
|
|
4
4
|
import { extractProposalIdFromLogs } from '../contracts/governance.js';
|
|
5
|
-
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils.js';
|
|
5
|
+
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils/index.js';
|
|
6
6
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
7
7
|
export async function executeGovernanceProposal(proposalId, governance, voteAmount, privateKey, l1Client, rpcUrls, logger) {
|
|
8
8
|
const proposal = await governance.read.getProposal([
|
package/dest/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Abi, Account, Chain, Client, FallbackTransport, GetContractReturnType, HttpTransport, PublicActions, PublicClient, PublicRpcSchema, WalletActions, WalletRpcSchema } from 'viem';
|
|
1
|
+
import type { Abi, Account, Chain, Client, FallbackTransport, GetContractReturnType, HttpTransport, PublicActions, PublicClient, PublicRpcSchema, WalletActions, WalletRpcSchema } from '@spalladino/viem';
|
|
2
2
|
/** Type for a viem public client */
|
|
3
3
|
export type ViemPublicClient = PublicClient<FallbackTransport<HttpTransport[]>, Chain>;
|
|
4
4
|
export type ExtendedViemWalletClient = Client<FallbackTransport<readonly HttpTransport[]>, Chain, Account, [
|
package/dest/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EACH,OAAO,EACP,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EACH,OAAO,EACP,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAEvF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAC3C,iBAAiB,CAAC,SAAS,aAAa,EAAE,CAAC,EAC3C,KAAK,EACL,OAAO,EACP;IAAC,GAAG,eAAe;IAAE,GAAG,eAAe;CAAC,EACxC,aAAa,CAAC,iBAAiB,CAAC,SAAS,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAClG,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,wBAAwB,CAAC;AAErE,6EAA6E;AAC7E,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,GAAG,IAAI,qBAAqB,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;AAEnG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,wBAAwB,CAEvF"}
|
package/dest/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import { type Abi, type ContractEventName, type DecodeEventLogReturnType, type Hex, type Log } from 'viem';
|
|
3
|
+
import { type Abi, type ContractEventName, type DecodeEventLogReturnType, type Hex, type Log } from '@spalladino/viem';
|
|
4
4
|
export interface L2Claim {
|
|
5
5
|
claimSecret: Fr;
|
|
6
6
|
claimAmount: Fr;
|
package/dest/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EACL,KAAK,GAAG,EAER,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAC7B,KAAK,GAAG,EACR,K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B,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,EAE/E,IAAI,EAAE,GAAG,EAAE,EACX,OAAO,EAAE,GAAG,EACZ,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,UAAU,GAAG,SAAS,CAgBxB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,OAW7C;AA0BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,GAAE,GAAe,GAAG,kBAAkB,CAwEpF;AAyBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,sBAa7C"}
|
package/dest/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorsAbi } from '@aztec/l1-artifacts/ErrorsAbi';
|
|
2
|
-
import { BaseError, ContractFunctionRevertedError, decodeErrorResult, decodeEventLog } from 'viem';
|
|
2
|
+
import { BaseError, ContractFunctionRevertedError, decodeErrorResult, decodeEventLog } from '@spalladino/viem';
|
|
3
3
|
export class FormattedViemError extends Error {
|
|
4
4
|
metaMessages;
|
|
5
5
|
constructor(message, metaMessages){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"./contracts": "./dest/contracts/index.js",
|
|
9
9
|
"./deploy-l1-contracts": "./dest/deploy_l1_contracts.js",
|
|
10
10
|
"./l1-contract-addresses": "./dest/l1_contract_addresses.js",
|
|
11
|
-
"./l1-tx-utils-with-blobs": "./dest/l1_tx_utils_with_blobs.js",
|
|
11
|
+
"./l1-tx-utils-with-blobs": "./dest/l1_tx_utils/l1_tx_utils_with_blobs.js",
|
|
12
12
|
"./utils": "./dest/utils.js"
|
|
13
13
|
},
|
|
14
14
|
"typedocOptions": {
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"../package.common.json"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aztec/blob-lib": "2.1.0-rc.
|
|
35
|
-
"@aztec/constants": "2.1.0-rc.
|
|
36
|
-
"@aztec/foundation": "2.1.0-rc.
|
|
37
|
-
"@aztec/l1-artifacts": "2.1.0-rc.
|
|
34
|
+
"@aztec/blob-lib": "2.1.0-rc.10",
|
|
35
|
+
"@aztec/constants": "2.1.0-rc.10",
|
|
36
|
+
"@aztec/foundation": "2.1.0-rc.10",
|
|
37
|
+
"@aztec/l1-artifacts": "2.1.0-rc.10",
|
|
38
|
+
"@spalladino/viem": "2.38.2-eip7594.0",
|
|
38
39
|
"@viem/anvil": "^0.0.10",
|
|
39
40
|
"dotenv": "^16.0.3",
|
|
40
41
|
"lodash.chunk": "^4.2.0",
|
|
41
42
|
"lodash.pickby": "^4.5.0",
|
|
42
43
|
"tslib": "^2.4.0",
|
|
43
|
-
"viem": "2.23.7",
|
|
44
44
|
"zod": "^3.23.8"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
package/src/account.ts
CHANGED
package/src/chain.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
fallback,
|
|
12
12
|
http,
|
|
13
13
|
publicActions,
|
|
14
|
-
} from 'viem';
|
|
15
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
16
|
-
import { foundry } from 'viem/chains';
|
|
14
|
+
} from '@spalladino/viem';
|
|
15
|
+
import { mnemonicToAccount, privateKeyToAccount } from '@spalladino/viem/accounts';
|
|
16
|
+
import { foundry } from '@spalladino/viem/chains';
|
|
17
17
|
|
|
18
18
|
import { createEthereumChain } from './chain.js';
|
|
19
19
|
import type { ExtendedViemWalletClient, ViemPublicClient } from './types.js';
|
package/src/config.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
12
|
|
|
13
|
-
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils.js';
|
|
13
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/index.js';
|
|
14
14
|
|
|
15
15
|
export type GenesisStateConfig = {
|
|
16
16
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
package/src/constants.ts
CHANGED
|
@@ -2,9 +2,9 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
2
2
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
3
3
|
import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
|
|
4
4
|
|
|
5
|
-
import { type Hex, type TypedDataDefinition, encodeFunctionData } from 'viem';
|
|
5
|
+
import { type Hex, type TypedDataDefinition, encodeFunctionData } from '@spalladino/viem';
|
|
6
6
|
|
|
7
|
-
import type { L1TxRequest } from '../l1_tx_utils.js';
|
|
7
|
+
import type { L1TxRequest } from '../l1_tx_utils/index.js';
|
|
8
8
|
|
|
9
9
|
export interface IEmpireBase {
|
|
10
10
|
get address(): EthAddress;
|
|
@@ -3,7 +3,6 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
3
3
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
4
|
import { EmpireSlashingProposerAbi } from '@aztec/l1-artifacts/EmpireSlashingProposerAbi';
|
|
5
5
|
|
|
6
|
-
import EventEmitter from 'events';
|
|
7
6
|
import {
|
|
8
7
|
type EncodeFunctionDataParameters,
|
|
9
8
|
type GetContractReturnType,
|
|
@@ -12,9 +11,10 @@ import {
|
|
|
12
11
|
type TypedDataDefinition,
|
|
13
12
|
encodeFunctionData,
|
|
14
13
|
getContract,
|
|
15
|
-
} from 'viem';
|
|
14
|
+
} from '@spalladino/viem';
|
|
15
|
+
import EventEmitter from 'events';
|
|
16
16
|
|
|
17
|
-
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
17
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
18
18
|
import type { ViemClient } from '../types.js';
|
|
19
19
|
import { FormattedViemError, tryExtractEvent } from '../utils.js';
|
|
20
20
|
import { type IEmpireBase, encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
3
3
|
|
|
4
|
-
import { type Hex, encodeFunctionData, getContract } from 'viem';
|
|
4
|
+
import { type Hex, encodeFunctionData, getContract } from '@spalladino/viem';
|
|
5
5
|
|
|
6
|
-
import type { L1TxUtils } from '../l1_tx_utils.js';
|
|
6
|
+
import type { L1TxUtils } from '../l1_tx_utils/index.js';
|
|
7
7
|
|
|
8
8
|
export class FeeAssetHandlerContract {
|
|
9
9
|
public address: EthAddress;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { TestERC20Abi as FeeJuiceAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
3
3
|
|
|
4
|
-
import { type GetContractReturnType, type Hex, getContract } from 'viem';
|
|
4
|
+
import { type GetContractReturnType, type Hex, getContract } from '@spalladino/viem';
|
|
5
5
|
|
|
6
6
|
import { type ExtendedViemWalletClient, type ViemClient, isExtendedClient } from '../types.js';
|
|
7
7
|
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
encodeFunctionData,
|
|
12
12
|
getContract,
|
|
13
13
|
parseEventLogs,
|
|
14
|
-
} from 'viem';
|
|
14
|
+
} from '@spalladino/viem';
|
|
15
15
|
|
|
16
16
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
17
|
-
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils.js';
|
|
17
|
+
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils/index.js';
|
|
18
18
|
import { type ExtendedViemWalletClient, type ViemClient, isExtendedClient } from '../types.js';
|
|
19
19
|
|
|
20
20
|
export type L1GovernanceContractAddresses = Pick<
|
|
@@ -187,7 +187,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
187
187
|
retries: number;
|
|
188
188
|
logger: Logger;
|
|
189
189
|
}) {
|
|
190
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
190
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
191
191
|
const retryDelaySeconds = 12;
|
|
192
192
|
|
|
193
193
|
voteAmount = voteAmount ?? (await this.getPower());
|
|
@@ -244,7 +244,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
244
244
|
retries: number;
|
|
245
245
|
logger: Logger;
|
|
246
246
|
}) {
|
|
247
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
247
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
248
248
|
const retryDelaySeconds = 12;
|
|
249
249
|
let success = false;
|
|
250
250
|
for (let i = 0; i < retries; i++) {
|