@aztec/aztec 0.0.1-commit.96dac018d → 0.0.1-commit.9badcec54
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/bin/index.js +2 -2
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +27 -9
- package/dest/cli/aztec_start_options.d.ts +2 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +15 -3
- package/dest/cli/cli.js +3 -3
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +10 -15
- package/dest/cli/cmds/profile_flamegraph.d.ts +1 -1
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -1
- package/dest/cli/cmds/profile_flamegraph.js +2 -1
- package/dest/cli/cmds/profile_gates.d.ts +1 -1
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +2 -1
- package/dest/cli/cmds/standby.d.ts +32 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_archiver.d.ts +2 -2
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +4 -2
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +26 -36
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +3 -15
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +12 -6
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
- package/dest/cli/cmds/utils/needs_recompile.js +90 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +62 -0
- package/dest/cli/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +40 -81
- package/dest/examples/token.js +4 -4
- package/dest/local-network/banana_fpc.js +1 -1
- package/dest/local-network/local-network.d.ts +3 -4
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +21 -8
- package/dest/testing/anvil_test_watcher.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +36 -10
- package/dest/testing/cheat_codes.d.ts +11 -15
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +34 -32
- package/dest/testing/epoch_test_settler.d.ts +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +3 -4
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +34 -34
- package/scripts/add_crate.sh +102 -0
- package/scripts/aztec.sh +9 -2
- package/scripts/init.sh +15 -21
- package/scripts/new.sh +45 -22
- package/scripts/setup_workspace.sh +10 -66
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +16 -9
- package/src/cli/aztec_start_options.ts +21 -5
- package/src/cli/cli.ts +3 -3
- package/src/cli/cmds/compile.ts +12 -18
- package/src/cli/cmds/profile_flamegraph.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +2 -1
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_archiver.ts +8 -2
- package/src/cli/cmds/start_node.ts +40 -34
- package/src/cli/cmds/start_prover_agent.ts +3 -6
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +98 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +77 -0
- package/src/cli/util.ts +43 -76
- package/src/examples/token.ts +6 -4
- package/src/local-network/banana_fpc.ts +1 -1
- package/src/local-network/local-network.ts +18 -8
- package/src/testing/anvil_test_watcher.ts +33 -10
- package/src/testing/cheat_codes.ts +42 -36
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/src/cli/release_version.ts +0 -21
package/dest/cli/util.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { getNetworkConfig } from '@aztec/cli/config';
|
|
2
|
+
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
1
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
5
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
4
6
|
import chalk from 'chalk';
|
|
5
7
|
import { aztecStartOptions } from './aztec_start_options.js';
|
|
6
8
|
export var ExitCode = /*#__PURE__*/ function(ExitCode) {
|
|
@@ -220,7 +222,7 @@ export const printAztecStartHelpText = ()=>{
|
|
|
220
222
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
221
223
|
await Promise.all([
|
|
222
224
|
Crs.new(2 ** 1, undefined, log),
|
|
223
|
-
GrumpkinCrs.new(2 ** 16
|
|
225
|
+
GrumpkinCrs.new(2 ** 16, undefined, log)
|
|
224
226
|
]);
|
|
225
227
|
}
|
|
226
228
|
}
|
|
@@ -232,97 +234,54 @@ export const printAztecStartHelpText = ()=>{
|
|
|
232
234
|
if (realProofs) {
|
|
233
235
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
234
236
|
await Promise.all([
|
|
235
|
-
Crs.new(2 ** 25
|
|
236
|
-
GrumpkinCrs.new(2 ** 18
|
|
237
|
+
Crs.new(2 ** 25, undefined, log),
|
|
238
|
+
GrumpkinCrs.new(2 ** 18, undefined, log)
|
|
237
239
|
]);
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
|
-
export async function
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
258
|
-
logger.info(`New rollup version detected. Please restart the node`, {
|
|
259
|
-
latestVersion,
|
|
260
|
-
currentVersion
|
|
261
|
-
});
|
|
262
|
-
await shutdown(logger.info, 78, signalHandlers);
|
|
263
|
-
} else if (autoUpdateMode === 'notify') {
|
|
264
|
-
logger.warn(`New rollup detected. Please restart the node`, {
|
|
265
|
-
latestVersion,
|
|
266
|
-
currentVersion
|
|
267
|
-
});
|
|
242
|
+
export async function setupVersionChecker(network, followsCanonicalRollup, publicClient, signalHandlers, cacheDir) {
|
|
243
|
+
const networkConfig = await getNetworkConfig(network, cacheDir);
|
|
244
|
+
if (!networkConfig) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const { VersionChecker } = await import('@aztec/stdlib/update-checker');
|
|
248
|
+
const logger = createLogger('version_check');
|
|
249
|
+
const registry = new RegistryContract(publicClient, networkConfig.registryAddress);
|
|
250
|
+
const checks = [];
|
|
251
|
+
checks.push({
|
|
252
|
+
name: 'node',
|
|
253
|
+
currentVersion: getPackageVersion() ?? 'unknown',
|
|
254
|
+
getLatestVersion: async ()=>{
|
|
255
|
+
const cfg = await getNetworkConfig(network, cacheDir);
|
|
256
|
+
return cfg?.nodeVersion;
|
|
268
257
|
}
|
|
269
258
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
} else if (autoUpdateMode === 'notify') {
|
|
282
|
-
logger.info(`New node version detected. Please update and restart the node`, {
|
|
283
|
-
latestVersion,
|
|
284
|
-
currentVersion
|
|
259
|
+
if (followsCanonicalRollup) {
|
|
260
|
+
const getLatestVersion = async ()=>{
|
|
261
|
+
const version = (await registry.getRollupVersions()).at(-1);
|
|
262
|
+
return version !== undefined ? String(version) : undefined;
|
|
263
|
+
};
|
|
264
|
+
const currentVersion = await getLatestVersion();
|
|
265
|
+
if (currentVersion !== undefined) {
|
|
266
|
+
checks.push({
|
|
267
|
+
name: 'rollup',
|
|
268
|
+
currentVersion,
|
|
269
|
+
getLatestVersion
|
|
285
270
|
});
|
|
286
271
|
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
checker.on('
|
|
272
|
+
}
|
|
273
|
+
const checker = new VersionChecker(checks, 600_000, logger);
|
|
274
|
+
checker.on('newVersion', ({ name, latestVersion, currentVersion })=>{
|
|
290
275
|
if (isShuttingDown()) {
|
|
291
276
|
return;
|
|
292
277
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
} catch (err) {
|
|
298
|
-
logger.warn('Failed to update config', {
|
|
299
|
-
err
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
// don't notify on these config changes
|
|
304
|
-
});
|
|
305
|
-
checker.on('updatePublicTelemetryConfig', (config)=>{
|
|
306
|
-
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
307
|
-
logger.warn(`Public telemetry config change detected. Updating telemetry client`, config);
|
|
308
|
-
try {
|
|
309
|
-
const publicIncludeMetrics = config.publicIncludeMetrics;
|
|
310
|
-
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every((m)=>typeof m === 'string')) {
|
|
311
|
-
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
312
|
-
}
|
|
313
|
-
const publicMetricsCollectFrom = config.publicMetricsCollectFrom;
|
|
314
|
-
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every((m)=>typeof m === 'string')) {
|
|
315
|
-
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
316
|
-
}
|
|
317
|
-
} catch (err) {
|
|
318
|
-
logger.warn('Failed to update config', {
|
|
319
|
-
err
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
// don't notify on these config changes
|
|
278
|
+
logger.warn(`New ${name} version available`, {
|
|
279
|
+
latestVersion,
|
|
280
|
+
currentVersion
|
|
281
|
+
});
|
|
324
282
|
});
|
|
325
283
|
checker.start();
|
|
284
|
+
signalHandlers.push(()=>checker.stop());
|
|
326
285
|
}
|
|
327
286
|
export function stringifyConfig(config) {
|
|
328
287
|
return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
|
package/dest/examples/token.js
CHANGED
|
@@ -21,7 +21,7 @@ const TRANSFER_AMOUNT = 33n;
|
|
|
21
21
|
const bob = bobInitialAccountData.address;
|
|
22
22
|
logger.info(`Fetched Alice and Bob accounts: ${alice.toString()}, ${bob.toString()}`);
|
|
23
23
|
logger.info('Deploying Token...');
|
|
24
|
-
const token = await TokenContract.deploy(wallet, alice, 'TokenName', 'TokenSymbol', 18).send({
|
|
24
|
+
const { contract: token } = await TokenContract.deploy(wallet, alice, 'TokenName', 'TokenSymbol', 18).send({
|
|
25
25
|
from: alice
|
|
26
26
|
});
|
|
27
27
|
logger.info('Token deployed');
|
|
@@ -31,7 +31,7 @@ const TRANSFER_AMOUNT = 33n;
|
|
|
31
31
|
from: alice
|
|
32
32
|
});
|
|
33
33
|
logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
|
|
34
|
-
const balanceAfterMint = await token.methods.balance_of_private(alice).simulate({
|
|
34
|
+
const { result: balanceAfterMint } = await token.methods.balance_of_private(alice).simulate({
|
|
35
35
|
from: alice
|
|
36
36
|
});
|
|
37
37
|
logger.info(`Tokens successfully minted. New Alice's balance: ${balanceAfterMint}`);
|
|
@@ -41,11 +41,11 @@ const TRANSFER_AMOUNT = 33n;
|
|
|
41
41
|
from: alice
|
|
42
42
|
});
|
|
43
43
|
// Check the new balances
|
|
44
|
-
const aliceBalance = await token.methods.balance_of_private(alice).simulate({
|
|
44
|
+
const { result: aliceBalance } = await token.methods.balance_of_private(alice).simulate({
|
|
45
45
|
from: alice
|
|
46
46
|
});
|
|
47
47
|
logger.info(`Alice's balance ${aliceBalance}`);
|
|
48
|
-
const bobBalance = await token.methods.balance_of_private(bob).simulate({
|
|
48
|
+
const { result: bobBalance } = await token.methods.balance_of_private(bob).simulate({
|
|
49
49
|
from: bob
|
|
50
50
|
});
|
|
51
51
|
logger.info(`Bob's balance ${bobBalance}`);
|
|
@@ -46,7 +46,7 @@ export async function getBananaFPCAddress(initialAccounts) {
|
|
|
46
46
|
export async function setupBananaFPC(initialAccounts, wallet, log) {
|
|
47
47
|
const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
|
|
48
48
|
const admin = getBananaAdmin(initialAccounts);
|
|
49
|
-
const [bananaCoin, fpc] = await Promise.all([
|
|
49
|
+
const [{ contract: bananaCoin }, { contract: fpc }] = await Promise.all([
|
|
50
50
|
TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal).send({
|
|
51
51
|
from: admin,
|
|
52
52
|
contractAddressSalt: BANANA_COIN_SALT,
|
|
@@ -7,7 +7,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import type {
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
11
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
12
12
|
import { type Hex } from 'viem';
|
|
13
13
|
/**
|
|
@@ -31,7 +31,6 @@ export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, pr
|
|
|
31
31
|
rollupAddress: EthAddress;
|
|
32
32
|
stakingAssetAddress: EthAddress;
|
|
33
33
|
} & {
|
|
34
|
-
slashFactoryAddress?: EthAddress | undefined;
|
|
35
34
|
feeAssetHandlerAddress?: EthAddress | undefined;
|
|
36
35
|
stakingAssetHandlerAddress?: EthAddress | undefined;
|
|
37
36
|
zkPassportVerifierAddress?: EthAddress | undefined;
|
|
@@ -68,6 +67,6 @@ export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?
|
|
|
68
67
|
dateProvider?: DateProvider;
|
|
69
68
|
proverBroker?: ProvingJobBroker;
|
|
70
69
|
}, options?: {
|
|
71
|
-
|
|
70
|
+
genesis?: GenesisData;
|
|
72
71
|
}): Promise<AztecNodeService>;
|
|
73
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2x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e,CAAM,EACrC,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC5B,EACN,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAO,6BAexC"}
|
|
@@ -18,6 +18,7 @@ import { TestDateProvider } from '@aztec/foundation/timer';
|
|
|
18
18
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
19
19
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
20
20
|
import { SequencerState } from '@aztec/sequencer-client';
|
|
21
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
22
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
22
23
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
23
24
|
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
@@ -29,6 +30,7 @@ import { createAccountLogs } from '../cli/util.js';
|
|
|
29
30
|
import { DefaultMnemonic } from '../mnemonic.js';
|
|
30
31
|
import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
|
|
31
32
|
import { EpochTestSettler } from '../testing/epoch_test_settler.js';
|
|
33
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
32
34
|
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
33
35
|
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
34
36
|
const logger = createLogger('local-network');
|
|
@@ -47,7 +49,7 @@ const localAnvil = foundry;
|
|
|
47
49
|
genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
48
50
|
feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
|
|
49
51
|
aztecTargetCommitteeSize: 0,
|
|
50
|
-
|
|
52
|
+
slasherEnabled: false,
|
|
51
53
|
realVerifier: false
|
|
52
54
|
});
|
|
53
55
|
aztecNodeConfig.l1Contracts = l1Contracts.l1ContractAddresses;
|
|
@@ -67,9 +69,16 @@ const localAnvil = foundry;
|
|
|
67
69
|
if ((config.l1RpcUrls?.length || 0) > 1) {
|
|
68
70
|
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
69
71
|
}
|
|
72
|
+
// The local network deploys a banana FPC with Token contracts, so include Token entries
|
|
73
|
+
// in the setup allowlist so FPC-based fee payments work out of the box.
|
|
74
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
70
75
|
const aztecNodeConfig = {
|
|
71
76
|
...getConfigEnvVars(),
|
|
72
|
-
...config
|
|
77
|
+
...config,
|
|
78
|
+
txPublicSetupAllowListExtend: [
|
|
79
|
+
...tokenAllowList,
|
|
80
|
+
...config.txPublicSetupAllowListExtend ?? []
|
|
81
|
+
]
|
|
73
82
|
};
|
|
74
83
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
75
84
|
if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
|
|
@@ -98,12 +107,16 @@ const localAnvil = foundry;
|
|
|
98
107
|
})();
|
|
99
108
|
const bananaFPC = await getBananaFPCAddress(initialAccounts);
|
|
100
109
|
const sponsoredFPC = await getSponsoredFPCAddress();
|
|
101
|
-
const
|
|
110
|
+
const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromString(a));
|
|
111
|
+
const fundedAddresses = [
|
|
102
112
|
...initialAccounts.map((a)=>a.address),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
...initialAccounts.length ? [
|
|
114
|
+
bananaFPC,
|
|
115
|
+
sponsoredFPC
|
|
116
|
+
] : [],
|
|
117
|
+
...prefundAddresses
|
|
118
|
+
];
|
|
119
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
|
|
107
120
|
const dateProvider = new TestDateProvider();
|
|
108
121
|
let cheatcodes;
|
|
109
122
|
let rollupAddress;
|
|
@@ -140,7 +153,7 @@ const localAnvil = foundry;
|
|
|
140
153
|
blobClient,
|
|
141
154
|
dateProvider
|
|
142
155
|
}, {
|
|
143
|
-
|
|
156
|
+
genesis
|
|
144
157
|
});
|
|
145
158
|
// Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
|
|
146
159
|
// transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
|
|
@@ -39,4 +39,4 @@ export declare class AnvilTestWatcher {
|
|
|
39
39
|
warpTimeIfNeeded(): Promise<void>;
|
|
40
40
|
private warpToTimestamp;
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUFnQj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AAiB,CAAC,cAAc,EAAE,OAAO,QAExC;IAED,yGAAyG;IACzG,oBAAoB,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,QAE7C;IAED,uGAAuG;IACvG,sBAAsB,CAAC,EAAE,EAAE,MAAM,OAAO,QAEvC;IAEK,KAAK,kBAyBV;IAEK,IAAI,kBAIT;IAEK,OAAO,kBAIZ;IAEK,YAAY,kBAKjB;IAEK,4BAA4B,kBAsBjC;IAEK,gBAAgB,kBA4DrB;YAMa,eAAe;CAgB9B"}
|
|
@@ -101,14 +101,25 @@ import { getAddress, getContract } from 'viem';
|
|
|
101
101
|
if (!this.dateProvider) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const l1Time = await this.cheatcodes.
|
|
104
|
+
const l1Time = await this.cheatcodes.lastBlockTimestamp() * 1000;
|
|
105
105
|
const wallTime = this.dateProvider.now();
|
|
106
106
|
if (l1Time > wallTime) {
|
|
107
107
|
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
108
108
|
this.dateProvider.setTime(l1Time);
|
|
109
109
|
} else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
// Warp L1 to the slot boundary at-or-before wall time. Rounding to a slot boundary (rather than
|
|
111
|
+
// `ceil(wallTime / 1000)`) keeps this loop's target aligned with `warpTimeIfNeeded`'s
|
|
112
|
+
// `nextSlotTimestamp` target, avoiding a race where the two loops pick timestamps a fraction of
|
|
113
|
+
// a second apart and one of them is then rejected by anvil as non-monotonic.
|
|
114
|
+
const wallSec = Math.floor(wallTime / 1000);
|
|
115
|
+
const targetSlot = await this.rollup.read.getSlotAt([
|
|
116
|
+
BigInt(wallSec)
|
|
117
|
+
]);
|
|
118
|
+
const targetTimestamp = Number(await this.rollup.read.getTimestampForSlot([
|
|
119
|
+
targetSlot
|
|
120
|
+
]));
|
|
121
|
+
this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to slot ${targetSlot} boundary`);
|
|
122
|
+
await this.warpToTimestamp(targetTimestamp);
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
async warpTimeIfNeeded() {
|
|
@@ -124,8 +135,9 @@ import { getAddress, getContract } from 'viem';
|
|
|
124
135
|
]));
|
|
125
136
|
if (BigInt(currentSlot) === checkpointLog.slotNumber) {
|
|
126
137
|
// The current slot has been filled, we should jump to the next slot.
|
|
127
|
-
await this.warpToTimestamp(nextSlotTimestamp)
|
|
128
|
-
|
|
138
|
+
if (await this.warpToTimestamp(nextSlotTimestamp)) {
|
|
139
|
+
this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
|
|
140
|
+
}
|
|
129
141
|
return;
|
|
130
142
|
}
|
|
131
143
|
// If we are not in local network, we don't need to warp time
|
|
@@ -152,9 +164,10 @@ import { getAddress, getContract } from 'viem';
|
|
|
152
164
|
return;
|
|
153
165
|
}
|
|
154
166
|
if (realNow - this.unfilledSlotFirstSeen.realTime > 2000) {
|
|
155
|
-
await this.warpToTimestamp(nextSlotTimestamp)
|
|
167
|
+
if (await this.warpToTimestamp(nextSlotTimestamp)) {
|
|
168
|
+
this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
|
|
169
|
+
}
|
|
156
170
|
this.unfilledSlotFirstSeen = undefined;
|
|
157
|
-
this.logger.info(`Slot ${currentSlot} was missed with pending txs, jumped to next slot`);
|
|
158
171
|
}
|
|
159
172
|
return;
|
|
160
173
|
}
|
|
@@ -162,20 +175,33 @@ import { getAddress, getContract } from 'viem';
|
|
|
162
175
|
// Fallback: warp when the dateProvider time has passed the next slot timestamp.
|
|
163
176
|
const currentTimestamp = this.dateProvider?.now() ?? Date.now();
|
|
164
177
|
if (currentTimestamp > nextSlotTimestamp * 1000) {
|
|
165
|
-
await this.warpToTimestamp(nextSlotTimestamp)
|
|
166
|
-
|
|
178
|
+
if (await this.warpToTimestamp(nextSlotTimestamp)) {
|
|
179
|
+
this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
|
|
180
|
+
}
|
|
167
181
|
}
|
|
168
182
|
} catch {
|
|
169
183
|
this.logger.error('mineIfSlotFilled failed');
|
|
170
184
|
}
|
|
171
185
|
}
|
|
172
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Warps L1 to `timestamp`, unless L1 is already at or past it. Returns true when a warp actually
|
|
188
|
+
* happened, false when skipped or on error. Callers use the return value to gate success logs.
|
|
189
|
+
*/ async warpToTimestamp(timestamp) {
|
|
173
190
|
try {
|
|
191
|
+
// Anvil rejects evm_setNextBlockTimestamp values <= the current block's timestamp. The two
|
|
192
|
+
// watcher loops can race and pick targets a fraction of a second apart; skip here rather than
|
|
193
|
+
// letting the second one error out noisily.
|
|
194
|
+
const lastTimestamp = await this.cheatcodes.lastBlockTimestamp();
|
|
195
|
+
if (timestamp <= lastTimestamp) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
174
198
|
await this.cheatcodes.warp(timestamp, {
|
|
175
199
|
resetBlockInterval: true
|
|
176
200
|
});
|
|
201
|
+
return true;
|
|
177
202
|
} catch (e) {
|
|
178
203
|
this.logger.error(`Failed to warp to timestamp ${timestamp}: ${e}`);
|
|
204
|
+
return false;
|
|
179
205
|
}
|
|
180
206
|
}
|
|
181
207
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import type {
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
5
4
|
/**
|
|
6
5
|
* A class that provides utility functions for interacting with the chain.
|
|
7
6
|
* @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
|
|
@@ -13,6 +12,7 @@ export declare class CheatCodes {
|
|
|
13
12
|
eth: EthCheatCodes;
|
|
14
13
|
/** Cheat codes for the Aztec Rollup contract on L1. */
|
|
15
14
|
rollup: RollupCheatCodes;
|
|
15
|
+
private logger;
|
|
16
16
|
constructor(
|
|
17
17
|
/** Cheat codes for L1.*/
|
|
18
18
|
eth: EthCheatCodes,
|
|
@@ -21,23 +21,19 @@ export declare class CheatCodes {
|
|
|
21
21
|
static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
|
|
22
22
|
/**
|
|
23
23
|
* Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
|
|
24
|
-
* the target timestamp.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
28
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
24
|
+
* the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
|
|
25
|
+
* the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
|
|
26
|
+
* @param node - The Aztec node used to force an empty block to be mined.
|
|
29
27
|
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
30
28
|
*/
|
|
31
|
-
warpL2TimeAtLeastTo(
|
|
29
|
+
warpL2TimeAtLeastTo(node: AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
|
|
32
30
|
/**
|
|
33
31
|
* Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
|
|
34
|
-
* least by the duration.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
38
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
32
|
+
* least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
|
|
33
|
+
* extended to the start of the next slot so that `mineBlock()` succeeds.
|
|
34
|
+
* @param node - The Aztec node used to force an empty block to be mined.
|
|
39
35
|
* @param duration - The duration to advance time by (in seconds)
|
|
40
36
|
*/
|
|
41
|
-
warpL2TimeAtLeastBy(
|
|
37
|
+
warpL2TimeAtLeastBy(node: AztecNodeDebug, duration: bigint | number): Promise<void>;
|
|
42
38
|
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsY0FBYyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakY7Ozs7O0dBS0c7QUFDSCxxQkFBYSxVQUFVO0lBSW5CLHlCQUF5QjtJQUNsQixHQUFHLEVBQUUsYUFBYTtJQUN6Qix1REFBdUQ7SUFDaEQsTUFBTSxFQUFFLGdCQUFnQjtJQU5qQyxPQUFPLENBQUMsTUFBTSxDQUF1QztJQUVyRDtJQUNFLHlCQUF5QjtJQUNsQixHQUFHLEVBQUUsYUFBYTtJQUN6Qix1REFBdUQ7SUFDaEQsTUFBTSxFQUFFLGdCQUFnQixFQUM3QjtJQUVKLE9BQWEsTUFBTSxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQU92RztJQUVEOzs7Ozs7T0FNRztJQUNHLG1CQUFtQixDQUFDLElBQUksRUFBRSxjQUFjLEVBQUUsZUFBZSxFQUFFLE1BQU0sR0FBRyxNQUFNLGlCQTRCL0U7SUFFRDs7Ozs7O09BTUc7SUFDRyxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxNQUFNLEdBQUcsTUFBTSxpQkFReEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;;;GAKG;AACH,qBAAa,UAAU;IAInB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IANjC,OAAO,CAAC,MAAM,CAAuC;IAErD;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,iBA4B/E;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAQxE;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import {
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
/**
|
|
4
5
|
* A class that provides utility functions for interacting with the chain.
|
|
5
6
|
* @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
|
|
@@ -8,9 +9,11 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
8
9
|
*/ export class CheatCodes {
|
|
9
10
|
eth;
|
|
10
11
|
rollup;
|
|
12
|
+
logger;
|
|
11
13
|
constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup){
|
|
12
14
|
this.eth = eth;
|
|
13
15
|
this.rollup = rollup;
|
|
16
|
+
this.logger = createLogger('aztecjs:cheat_codes');
|
|
14
17
|
}
|
|
15
18
|
static async create(rpcUrls, node, dateProvider) {
|
|
16
19
|
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
@@ -19,44 +22,43 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
|
|
22
|
-
* the target timestamp.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
26
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
25
|
+
* the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
|
|
26
|
+
* the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
|
|
27
|
+
* @param node - The Aztec node used to force an empty block to be mined.
|
|
27
28
|
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
28
|
-
*/ async warpL2TimeAtLeastTo(
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
*/ async warpL2TimeAtLeastTo(node, targetTimestamp) {
|
|
30
|
+
const targetBigInt = BigInt(targetTimestamp);
|
|
31
|
+
const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
|
|
32
|
+
if (targetBigInt <= currentTimestamp) {
|
|
33
|
+
throw new Error(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} is not in the future (current L1 timestamp is ${currentTimestamp}).`);
|
|
34
|
+
}
|
|
35
|
+
const currentSlot = await this.rollup.getSlot();
|
|
36
|
+
const targetSlot = await this.rollup.getSlotAt(targetBigInt);
|
|
37
|
+
let effectiveTimestamp = targetBigInt;
|
|
38
|
+
if (targetSlot <= currentSlot) {
|
|
39
|
+
// Target lands in the same (or earlier) slot — auto-adjust to the next slot's start.
|
|
40
|
+
const nextSlot = SlotNumber(currentSlot + 1);
|
|
41
|
+
const nextSlotTimestamp = await this.rollup.getTimestampForSlot(nextSlot);
|
|
42
|
+
this.logger.warn(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} falls in current slot ${currentSlot}. ` + `Auto-adjusting to start of slot ${nextSlot} at timestamp ${nextSlotTimestamp}.`);
|
|
43
|
+
effectiveTimestamp = nextSlotTimestamp;
|
|
44
|
+
}
|
|
45
|
+
await this.eth.warp(effectiveTimestamp, {
|
|
32
46
|
resetBlockInterval: true
|
|
33
47
|
});
|
|
34
|
-
|
|
35
|
-
const sequencer = sequencerClient.getSequencer();
|
|
36
|
-
const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
|
|
37
|
-
sequencer.updateConfig({
|
|
38
|
-
minTxsPerBlock: 0
|
|
39
|
-
});
|
|
40
|
-
await retryUntil(async ()=>{
|
|
41
|
-
const newL2BlockNumber = await node.getBlockNumber();
|
|
42
|
-
return newL2BlockNumber > currentL2BlockNumber;
|
|
43
|
-
}, 'new block after warping L2 time', 36, 1);
|
|
44
|
-
// Restore original minTxsPerBlock
|
|
45
|
-
sequencer.updateConfig({
|
|
46
|
-
minTxsPerBlock
|
|
47
|
-
});
|
|
48
|
+
await node.mineBlock();
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
|
|
51
|
-
* least by the duration.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param sequencerClient - The sequencer client to use to force an empty block to be mined.
|
|
55
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
52
|
+
* least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
|
|
53
|
+
* extended to the start of the next slot so that `mineBlock()` succeeds.
|
|
54
|
+
* @param node - The Aztec node used to force an empty block to be mined.
|
|
56
55
|
* @param duration - The duration to advance time by (in seconds)
|
|
57
|
-
*/ async warpL2TimeAtLeastBy(
|
|
58
|
-
|
|
56
|
+
*/ async warpL2TimeAtLeastBy(node, duration) {
|
|
57
|
+
if (BigInt(duration) <= 0n) {
|
|
58
|
+
throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
|
|
59
|
+
}
|
|
60
|
+
const currentTimestamp = await this.eth.lastBlockTimestamp();
|
|
59
61
|
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
60
|
-
await this.warpL2TimeAtLeastTo(
|
|
62
|
+
await this.warpL2TimeAtLeastTo(node, targetTimestamp);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
@@ -16,4 +16,4 @@ export declare class EpochTestSettler {
|
|
|
16
16
|
stop(): Promise<void>;
|
|
17
17
|
handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLm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IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAoClE;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
2
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
4
|
-
import {
|
|
4
|
+
import { computeEpochOutHash } from '@aztec/stdlib/messaging';
|
|
5
5
|
export class EpochTestSettler {
|
|
6
6
|
l2BlockSource;
|
|
7
7
|
log;
|
|
@@ -44,9 +44,8 @@ export class EpochTestSettler {
|
|
|
44
44
|
}
|
|
45
45
|
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
|
|
47
|
+
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
48
|
+
if (!outHash.isZero()) {
|
|
50
49
|
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
51
50
|
} else {
|
|
52
51
|
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|