@aztec/ethereum 3.0.0-nightly.20250922 → 3.0.0-nightly.20250924
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/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +4 -0
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +3 -2
- package/dest/publisher_manager.d.ts +4 -1
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +10 -2
- package/dest/test/eth_cheat_codes.d.ts +10 -3
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +9 -3
- package/dest/test/rollup_cheat_codes.d.ts +5 -8
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +4 -5
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +2 -1
- package/package.json +5 -5
- package/src/contracts/multicall.ts +5 -0
- package/src/l1_tx_utils.ts +3 -2
- package/src/publisher_manager.ts +14 -4
- package/src/test/eth_cheat_codes.ts +11 -5
- package/src/test/rollup_cheat_codes.ts +12 -13
- package/src/test/upgrade_utils.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAqC,KAAK,GAAG,EAAqC,MAAM,MAAM,CAAC;AAEtG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,oBAAoB,EAAG,4CAAqD,CAAC;AAE1F,qBAAa,UAAU;WACR,OAAO,CAClB,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,UAAU,EAAE,YAAY,GAAG,SAAS,EACpC,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAO;;;;;;;;;;;CAuG3C;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBA+BxF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
2
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
2
3
|
import { encodeFunctionData, multicall3Abi } from 'viem';
|
|
3
4
|
import { FormattedViemError, formatViemError } from '../utils.js';
|
|
4
5
|
import { RollupContract } from './rollup.js';
|
|
@@ -73,6 +74,9 @@ export class Multicall3 {
|
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
76
|
} catch (err) {
|
|
77
|
+
if (err instanceof TimeoutError) {
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
76
80
|
for (const request of requests){
|
|
77
81
|
logger.debug('Simulating request', {
|
|
78
82
|
request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../src/l1_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"l1_tx_utils.d.ts","sourceRoot":"","sources":["../src/l1_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,0BAA0B,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AAM,EACpD,cAAc,GAAE,aAAkB,EAClC,GAAG,GAAE,GAAe,EACpB,UAAU,CAAC,EAAE,eAAe,GAAG;QAAE,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7F,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE,CAAC;IAsBtD;;;;;;;OAOG;cACa,qBAAqB,CACnC,aAAa,EAAE,GAAG,EAClB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,EACrB,QAAQ,UAAQ,EAChB,gBAAgB,CAAC,EAAE,QAAQ,EAC3B,QAAQ,SAAI;CAsDf;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,mBAoBpD;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,aAWlC;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,aAMlC;AAED,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,8BAA8B,UAExF;AAOD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,UAEnD"}
|
package/dest/l1_tx_utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { compactArray, times } from '@aztec/foundation/collection';
|
|
2
2
|
import { bigintConfigHelper, booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper } from '@aztec/foundation/config';
|
|
3
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
6
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
@@ -698,7 +699,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
698
699
|
});
|
|
699
700
|
});
|
|
700
701
|
}
|
|
701
|
-
this.logger?.error(`L1 transaction ${currentTxHash} timed out`, {
|
|
702
|
+
this.logger?.error(`L1 transaction ${currentTxHash} timed out`, undefined, {
|
|
702
703
|
txHash: currentTxHash,
|
|
703
704
|
txTimeoutAt: gasConfig.txTimeoutAt,
|
|
704
705
|
txTimeoutMs: gasConfig.txTimeoutMs,
|
|
@@ -708,7 +709,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
708
709
|
isInterrupted: this.interrupted,
|
|
709
710
|
...tx
|
|
710
711
|
});
|
|
711
|
-
throw new
|
|
712
|
+
throw new TimeoutError(`L1 transaction ${currentTxHash} timed out`);
|
|
712
713
|
}
|
|
713
714
|
/**
|
|
714
715
|
* Sends a transaction and monitors it until completion
|
|
@@ -3,7 +3,10 @@ export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) =>
|
|
|
3
3
|
export declare class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
4
4
|
private publishers;
|
|
5
5
|
private log;
|
|
6
|
-
|
|
6
|
+
private config;
|
|
7
|
+
constructor(publishers: UtilsType[], config: {
|
|
8
|
+
publisherAllowInvalidStates?: boolean;
|
|
9
|
+
});
|
|
7
10
|
getAvailablePublisher(filter?: PublisherFilter<UtilsType>): Promise<UtilsType>;
|
|
8
11
|
interrupt(): void;
|
|
9
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgB,MAAM,kBAAkB,CAAC;AAK3D,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;AAEzF,qBAAa,gBAAgB,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS;IAKjE,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,GAAG,CAAoC;IAC/C,OAAO,CAAC,MAAM,CAA4C;gBAGhD,UAAU,EAAE,SAAS,EAAE,EAC/B,MAAM,EAAE;QAAE,2BAA2B,CAAC,EAAE,OAAO,CAAA;KAAE;IAatC,qBAAqB,CAAC,MAAM,GAAE,eAAe,CAAC,SAAS,CAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAyChG,SAAS;CAGjB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pick } from '@aztec/foundation/collection';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import { TxUtilsState } from './l1_tx_utils.js';
|
|
3
4
|
const sortOrder = [
|
|
@@ -13,11 +14,13 @@ const invalidStates = [
|
|
|
13
14
|
export class PublisherManager {
|
|
14
15
|
publishers;
|
|
15
16
|
log;
|
|
16
|
-
|
|
17
|
+
config;
|
|
18
|
+
constructor(publishers, config){
|
|
17
19
|
this.publishers = publishers;
|
|
18
20
|
this.log = createLogger('PublisherManager');
|
|
19
21
|
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
20
22
|
this.publishers = publishers;
|
|
23
|
+
this.config = pick(config, 'publisherAllowInvalidStates');
|
|
21
24
|
}
|
|
22
25
|
// Finds and prioritises available publishers based on
|
|
23
26
|
// 1. Validity as per the provided filter function
|
|
@@ -27,7 +30,12 @@ export class PublisherManager {
|
|
|
27
30
|
// 5. Then priority based on least recently used
|
|
28
31
|
async getAvailablePublisher(filter = ()=>true) {
|
|
29
32
|
// Extract the valid publishers
|
|
30
|
-
|
|
33
|
+
let validPublishers = this.publishers.filter((pub)=>!invalidStates.includes(pub.state) && filter(pub));
|
|
34
|
+
// If none found but we allow invalid states, try again including them
|
|
35
|
+
if (validPublishers.length === 0 && this.config.publisherAllowInvalidStates) {
|
|
36
|
+
this.log.warn(`No valid publishers found. Trying again including invalid states.`);
|
|
37
|
+
validPublishers = this.publishers.filter((pub)=>filter(pub));
|
|
38
|
+
}
|
|
31
39
|
// Error if none found
|
|
32
40
|
if (validPublishers.length === 0) {
|
|
33
41
|
throw new Error(`Failed to find an available publisher.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
2
|
+
import type { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
3
3
|
import { type Hex } from 'viem';
|
|
4
4
|
import type { ViemPublicClient } from '../types.js';
|
|
5
5
|
/**
|
|
@@ -10,6 +10,10 @@ export declare class EthCheatCodes {
|
|
|
10
10
|
* The RPC URL to use for interacting with the chain
|
|
11
11
|
*/
|
|
12
12
|
rpcUrls: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The date provider to use for time operations
|
|
15
|
+
*/
|
|
16
|
+
dateProvider: DateProvider | TestDateProvider;
|
|
13
17
|
/**
|
|
14
18
|
* The logger to use for the eth cheatcodes
|
|
15
19
|
*/
|
|
@@ -20,6 +24,10 @@ export declare class EthCheatCodes {
|
|
|
20
24
|
* The RPC URL to use for interacting with the chain
|
|
21
25
|
*/
|
|
22
26
|
rpcUrls: string[],
|
|
27
|
+
/**
|
|
28
|
+
* The date provider to use for time operations
|
|
29
|
+
*/
|
|
30
|
+
dateProvider: DateProvider | TestDateProvider,
|
|
23
31
|
/**
|
|
24
32
|
* The logger to use for the eth cheatcodes
|
|
25
33
|
*/
|
|
@@ -104,13 +112,12 @@ export declare class EthCheatCodes {
|
|
|
104
112
|
/**
|
|
105
113
|
* Set the next block timestamp and mines the block.
|
|
106
114
|
* Optionally resets interval mining so the next block is mined in `blockInterval` seconds from now.
|
|
107
|
-
*
|
|
115
|
+
* Always updates the injected date provider to follow L1 time.
|
|
108
116
|
* @param timestamp - The timestamp to set the next block to
|
|
109
117
|
*/
|
|
110
118
|
warp(timestamp: number | bigint, opts?: {
|
|
111
119
|
silent?: boolean;
|
|
112
120
|
resetBlockInterval?: boolean;
|
|
113
|
-
updateDateProvider?: TestDateProvider;
|
|
114
121
|
}): Promise<void>;
|
|
115
122
|
/**
|
|
116
123
|
* Load the value at a storage slot of a contract address on eth
|
|
@@ -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;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,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;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,KAAK,GAAG,EAAsC,MAAM,MAAM,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,qBAAa,aAAa;IAGtB;;OAEG;IACI,OAAO,EAAE,MAAM,EAAE;IACxB;;OAEG;IACI,YAAY,EAAE,YAAY,GAAG,gBAAgB;IACpD;;OAEG;IACI,MAAM;IAbf,SAAgB,YAAY,EAAE,gBAAgB,CAAC;;IAE7C;;OAEG;IACI,OAAO,EAAE,MAAM,EAAE;IACxB;;OAEG;IACI,YAAY,EAAE,YAAY,GAAG,gBAAg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,MAAM,EAAE,CAAC;IAKnE;;;;OAIG;IACU,qBAAqB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAK7D;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C;;;OAGG;IACI,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBlD;;;;;OAKG;IACU,oBAAoB,CAC/B,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,CAAC,GAAG,GAAG;QAAE,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,UAAU,GAAG,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,EAAE,EAAO,GAClH,OAAO,CAAC,IAAI,CAAC;IAaT,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrC,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAgCtE"}
|
|
@@ -7,14 +7,18 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
7
7
|
* A class that provides utility functions for interacting with ethereum (L1).
|
|
8
8
|
*/ export class EthCheatCodes {
|
|
9
9
|
rpcUrls;
|
|
10
|
+
dateProvider;
|
|
10
11
|
logger;
|
|
11
12
|
publicClient;
|
|
12
13
|
constructor(/**
|
|
13
14
|
* The RPC URL to use for interacting with the chain
|
|
14
15
|
*/ rpcUrls, /**
|
|
16
|
+
* The date provider to use for time operations
|
|
17
|
+
*/ dateProvider, /**
|
|
15
18
|
* The logger to use for the eth cheatcodes
|
|
16
19
|
*/ logger = createLogger('ethereum:cheat_codes')){
|
|
17
20
|
this.rpcUrls = rpcUrls;
|
|
21
|
+
this.dateProvider = dateProvider;
|
|
18
22
|
this.logger = logger;
|
|
19
23
|
this.publicClient = createPublicClient({
|
|
20
24
|
transport: fallback(this.rpcUrls.map((url)=>http(url)))
|
|
@@ -206,7 +210,7 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
206
210
|
/**
|
|
207
211
|
* Set the next block timestamp and mines the block.
|
|
208
212
|
* Optionally resets interval mining so the next block is mined in `blockInterval` seconds from now.
|
|
209
|
-
*
|
|
213
|
+
* Always updates the injected date provider to follow L1 time.
|
|
210
214
|
* @param timestamp - The timestamp to set the next block to
|
|
211
215
|
*/ async warp(timestamp, opts = {}) {
|
|
212
216
|
let blockInterval = null;
|
|
@@ -226,8 +230,10 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
226
230
|
]);
|
|
227
231
|
// And mine a block so the timestamp goes into effect now
|
|
228
232
|
await this.doMine();
|
|
229
|
-
// Update the date provider
|
|
230
|
-
|
|
233
|
+
// Update the injected date provider so it follows L1 time
|
|
234
|
+
if ('setTime' in this.dateProvider) {
|
|
235
|
+
this.dateProvider.setTime(Number(timestamp) * 1000);
|
|
236
|
+
}
|
|
231
237
|
} catch (err) {
|
|
232
238
|
throw new Error(`Error warping: ${err}`);
|
|
233
239
|
} finally{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ViemPublicClient } from '@aztec/ethereum';
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
4
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
5
|
import { type GetContractReturnType, type Hex } from 'viem';
|
|
6
6
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
@@ -11,7 +11,7 @@ export declare class RollupCheatCodes {
|
|
|
11
11
|
private rollup;
|
|
12
12
|
private logger;
|
|
13
13
|
constructor(ethCheatCodes: EthCheatCodes, addresses: Pick<L1ContractAddresses, 'rollupAddress'>);
|
|
14
|
-
static create(rpcUrls: string[], addresses: Pick<L1ContractAddresses, 'rollupAddress'
|
|
14
|
+
static create(rpcUrls: string[], addresses: Pick<L1ContractAddresses, 'rollupAddress'>, dateProvider: DateProvider): RollupCheatCodes;
|
|
15
15
|
/** Returns the current slot */
|
|
16
16
|
getSlot(): Promise<bigint>;
|
|
17
17
|
/** Returns the current epoch */
|
|
@@ -39,14 +39,11 @@ export declare class RollupCheatCodes {
|
|
|
39
39
|
* @param opts - Options
|
|
40
40
|
*/
|
|
41
41
|
advanceToEpoch(epoch: bigint | number, opts?: {
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/** Offset in seconds */
|
|
43
|
+
offset?: number;
|
|
44
44
|
}): Promise<bigint>;
|
|
45
45
|
/** Warps time in L1 until the next epoch */
|
|
46
|
-
advanceToNextEpoch(
|
|
47
|
-
/** Optional test date provider to update with the epoch timestamp */
|
|
48
|
-
updateDateProvider?: TestDateProvider;
|
|
49
|
-
}): Promise<void>;
|
|
46
|
+
advanceToNextEpoch(): Promise<void>;
|
|
50
47
|
/** Warps time in L1 until the beginning of the next slot. */
|
|
51
48
|
advanceToNextSlot(): Promise<bigint[]>;
|
|
52
49
|
/**
|
|
@@ -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,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,KAAK,EAAE,
|
|
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,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC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YAAY,CAAC,OAAO,EAAE,MAAM;IASzC;;;OAGG;IACI,YAAY,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAiCtD;;;OAGG;IACI,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCxE;;;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"}
|
|
@@ -23,8 +23,8 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
|
23
23
|
client: this.client
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
static create(rpcUrls, addresses) {
|
|
27
|
-
const ethCheatCodes = new EthCheatCodes(rpcUrls);
|
|
26
|
+
static create(rpcUrls, addresses, dateProvider) {
|
|
27
|
+
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
28
28
|
return new RollupCheatCodes(ethCheatCodes, addresses);
|
|
29
29
|
}
|
|
30
30
|
/** Returns the current slot */ async getSlot() {
|
|
@@ -86,7 +86,7 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
|
86
86
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
87
87
|
const timestamp = await this.rollup.read.getTimestampForSlot([
|
|
88
88
|
BigInt(epoch) * slotsInEpoch
|
|
89
|
-
]);
|
|
89
|
+
]) + BigInt(opts.offset ?? 0);
|
|
90
90
|
try {
|
|
91
91
|
await this.ethCheatCodes.warp(Number(timestamp), {
|
|
92
92
|
...opts,
|
|
@@ -99,14 +99,13 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
|
99
99
|
}
|
|
100
100
|
return timestamp;
|
|
101
101
|
}
|
|
102
|
-
/** Warps time in L1 until the next epoch */ async advanceToNextEpoch(
|
|
102
|
+
/** Warps time in L1 until the next epoch */ async advanceToNextEpoch() {
|
|
103
103
|
const slot = await this.getSlot();
|
|
104
104
|
const { epochDuration, slotDuration } = await this.getConfig();
|
|
105
105
|
const slotsUntilNextEpoch = epochDuration - slot % epochDuration + 1n;
|
|
106
106
|
const timeToNextEpoch = slotsUntilNextEpoch * slotDuration;
|
|
107
107
|
const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
|
|
108
108
|
await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
|
|
109
|
-
...opts,
|
|
110
109
|
silent: true,
|
|
111
110
|
resetBlockInterval: true
|
|
112
111
|
});
|
|
@@ -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;
|
|
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;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAe,MAAM,MAAM,CAAC;AAGvF,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,3 +1,4 @@
|
|
|
1
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
1
2
|
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
2
3
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
3
4
|
import { getContract } from 'viem';
|
|
@@ -15,7 +16,7 @@ export async function executeGovernanceProposal(proposalId, governance, voteAmou
|
|
|
15
16
|
value: 1n
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, logger);
|
|
19
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), logger);
|
|
19
20
|
const timeToActive = proposal.creation + proposal.config.votingDelay;
|
|
20
21
|
logger.info(`Warping to ${timeToActive + 1n}`);
|
|
21
22
|
await cheatCodes.warp(Number(timeToActive + 1n));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250924",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"../package.common.json"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250924",
|
|
35
|
+
"@aztec/constants": "3.0.0-nightly.20250924",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20250924",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250924",
|
|
38
38
|
"@viem/anvil": "^0.0.10",
|
|
39
39
|
"dotenv": "^16.0.3",
|
|
40
40
|
"lodash.chunk": "^4.2.0",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
2
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
2
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
4
|
|
|
4
5
|
import { type EncodeFunctionDataParameters, type Hex, encodeFunctionData, multicall3Abi } from 'viem';
|
|
@@ -92,6 +93,10 @@ export class Multicall3 {
|
|
|
92
93
|
return { receipt, gasPrice, errorMsg };
|
|
93
94
|
}
|
|
94
95
|
} catch (err) {
|
|
96
|
+
if (err instanceof TimeoutError) {
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
for (const request of requests) {
|
|
96
101
|
logger.debug('Simulating request', { request });
|
|
97
102
|
const result = await l1TxUtils
|
package/src/l1_tx_utils.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getDefaultConfig,
|
|
8
8
|
numberConfigHelper,
|
|
9
9
|
} from '@aztec/foundation/config';
|
|
10
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
10
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
12
|
import type { ViemTransactionSignature } from '@aztec/foundation/eth-signature';
|
|
12
13
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -928,7 +929,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
928
929
|
});
|
|
929
930
|
}
|
|
930
931
|
|
|
931
|
-
this.logger?.error(`L1 transaction ${currentTxHash} timed out`, {
|
|
932
|
+
this.logger?.error(`L1 transaction ${currentTxHash} timed out`, undefined, {
|
|
932
933
|
txHash: currentTxHash,
|
|
933
934
|
txTimeoutAt: gasConfig.txTimeoutAt,
|
|
934
935
|
txTimeoutMs: gasConfig.txTimeoutMs,
|
|
@@ -939,7 +940,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
939
940
|
...tx,
|
|
940
941
|
});
|
|
941
942
|
|
|
942
|
-
throw new
|
|
943
|
+
throw new TimeoutError(`L1 transaction ${currentTxHash} timed out`);
|
|
943
944
|
}
|
|
944
945
|
|
|
945
946
|
/**
|
package/src/publisher_manager.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pick } from '@aztec/foundation/collection';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
|
|
3
4
|
import { L1TxUtils, TxUtilsState } from './l1_tx_utils.js';
|
|
@@ -9,10 +10,15 @@ export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) =>
|
|
|
9
10
|
|
|
10
11
|
export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
11
12
|
private log = createLogger('PublisherManager');
|
|
13
|
+
private config: { publisherAllowInvalidStates?: boolean };
|
|
12
14
|
|
|
13
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
private publishers: UtilsType[],
|
|
17
|
+
config: { publisherAllowInvalidStates?: boolean },
|
|
18
|
+
) {
|
|
14
19
|
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
15
20
|
this.publishers = publishers;
|
|
21
|
+
this.config = pick(config, 'publisherAllowInvalidStates');
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
// Finds and prioritises available publishers based on
|
|
@@ -23,9 +29,13 @@ export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
|
23
29
|
// 5. Then priority based on least recently used
|
|
24
30
|
public async getAvailablePublisher(filter: PublisherFilter<UtilsType> = () => true): Promise<UtilsType> {
|
|
25
31
|
// Extract the valid publishers
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
let validPublishers = this.publishers.filter((pub: UtilsType) => !invalidStates.includes(pub.state) && filter(pub));
|
|
33
|
+
|
|
34
|
+
// If none found but we allow invalid states, try again including them
|
|
35
|
+
if (validPublishers.length === 0 && this.config.publisherAllowInvalidStates) {
|
|
36
|
+
this.log.warn(`No valid publishers found. Trying again including invalid states.`);
|
|
37
|
+
validPublishers = this.publishers.filter(pub => filter(pub));
|
|
38
|
+
}
|
|
29
39
|
|
|
30
40
|
// Error if none found
|
|
31
41
|
if (validPublishers.length === 0) {
|
|
@@ -3,7 +3,7 @@ import { keccak256 } from '@aztec/foundation/crypto';
|
|
|
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';
|
|
6
|
-
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
6
|
+
import type { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
7
7
|
|
|
8
8
|
import { type Hex, createPublicClient, fallback, http } from 'viem';
|
|
9
9
|
|
|
@@ -19,6 +19,10 @@ export class EthCheatCodes {
|
|
|
19
19
|
* The RPC URL to use for interacting with the chain
|
|
20
20
|
*/
|
|
21
21
|
public rpcUrls: string[],
|
|
22
|
+
/**
|
|
23
|
+
* The date provider to use for time operations
|
|
24
|
+
*/
|
|
25
|
+
public dateProvider: DateProvider | TestDateProvider,
|
|
22
26
|
/**
|
|
23
27
|
* The logger to use for the eth cheatcodes
|
|
24
28
|
*/
|
|
@@ -225,12 +229,12 @@ export class EthCheatCodes {
|
|
|
225
229
|
/**
|
|
226
230
|
* Set the next block timestamp and mines the block.
|
|
227
231
|
* Optionally resets interval mining so the next block is mined in `blockInterval` seconds from now.
|
|
228
|
-
*
|
|
232
|
+
* Always updates the injected date provider to follow L1 time.
|
|
229
233
|
* @param timestamp - The timestamp to set the next block to
|
|
230
234
|
*/
|
|
231
235
|
public async warp(
|
|
232
236
|
timestamp: number | bigint,
|
|
233
|
-
opts: { silent?: boolean; resetBlockInterval?: boolean
|
|
237
|
+
opts: { silent?: boolean; resetBlockInterval?: boolean } = {},
|
|
234
238
|
): Promise<void> {
|
|
235
239
|
let blockInterval: number | null = null;
|
|
236
240
|
try {
|
|
@@ -245,8 +249,10 @@ export class EthCheatCodes {
|
|
|
245
249
|
await this.rpcCall('evm_setNextBlockTimestamp', [Number(timestamp)]);
|
|
246
250
|
// And mine a block so the timestamp goes into effect now
|
|
247
251
|
await this.doMine();
|
|
248
|
-
// Update the date provider
|
|
249
|
-
|
|
252
|
+
// Update the injected date provider so it follows L1 time
|
|
253
|
+
if ('setTime' in this.dateProvider) {
|
|
254
|
+
this.dateProvider.setTime(Number(timestamp) * 1000);
|
|
255
|
+
}
|
|
250
256
|
} catch (err) {
|
|
251
257
|
throw new Error(`Error warping: ${err}`);
|
|
252
258
|
} finally {
|
|
@@ -2,7 +2,7 @@ import { RollupContract, type ViemPublicClient } from '@aztec/ethereum';
|
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import type {
|
|
5
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
6
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -40,8 +40,12 @@ export class RollupCheatCodes {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
static create(
|
|
44
|
-
|
|
43
|
+
static create(
|
|
44
|
+
rpcUrls: string[],
|
|
45
|
+
addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
|
|
46
|
+
dateProvider: DateProvider,
|
|
47
|
+
): RollupCheatCodes {
|
|
48
|
+
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
45
49
|
return new RollupCheatCodes(ethCheatCodes, addresses);
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -114,12 +118,13 @@ export class RollupCheatCodes {
|
|
|
114
118
|
public async advanceToEpoch(
|
|
115
119
|
epoch: bigint | number,
|
|
116
120
|
opts: {
|
|
117
|
-
/**
|
|
118
|
-
|
|
121
|
+
/** Offset in seconds */
|
|
122
|
+
offset?: number;
|
|
119
123
|
} = {},
|
|
120
124
|
) {
|
|
121
125
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
122
|
-
const timestamp =
|
|
126
|
+
const timestamp =
|
|
127
|
+
(await this.rollup.read.getTimestampForSlot([BigInt(epoch) * slotsInEpoch])) + BigInt(opts.offset ?? 0);
|
|
123
128
|
try {
|
|
124
129
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
125
130
|
this.logger.warn(`Warped to epoch ${epoch}`);
|
|
@@ -130,19 +135,13 @@ export class RollupCheatCodes {
|
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
/** Warps time in L1 until the next epoch */
|
|
133
|
-
public async advanceToNextEpoch(
|
|
134
|
-
opts: {
|
|
135
|
-
/** Optional test date provider to update with the epoch timestamp */
|
|
136
|
-
updateDateProvider?: TestDateProvider;
|
|
137
|
-
} = {},
|
|
138
|
-
) {
|
|
138
|
+
public async advanceToNextEpoch() {
|
|
139
139
|
const slot = await this.getSlot();
|
|
140
140
|
const { epochDuration, slotDuration } = await this.getConfig();
|
|
141
141
|
const slotsUntilNextEpoch = epochDuration - (slot % epochDuration) + 1n;
|
|
142
142
|
const timeToNextEpoch = slotsUntilNextEpoch * slotDuration;
|
|
143
143
|
const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
|
|
144
144
|
await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
|
|
145
|
-
...opts,
|
|
146
145
|
silent: true,
|
|
147
146
|
resetBlockInterval: true,
|
|
148
147
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
2
3
|
import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
3
4
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
4
5
|
|
|
@@ -30,7 +31,7 @@ export async function executeGovernanceProposal(
|
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, logger);
|
|
34
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), logger);
|
|
34
35
|
|
|
35
36
|
const timeToActive = proposal.creation + proposal.config.votingDelay;
|
|
36
37
|
logger.info(`Warping to ${timeToActive + 1n}`);
|