@aztec/aztec 0.0.1-commit.f504929 → 0.0.1-commit.f5d02921e
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 +16 -7
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +2 -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 +9 -1
- 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 +1 -1
- 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 +19 -71
- 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 +41 -0
- package/dest/cli/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -78
- package/dest/local-network/local-network.d.ts +1 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +9 -1
- package/dest/testing/anvil_test_watcher.js +1 -1
- package/dest/testing/cheat_codes.js +1 -1
- 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/aztec.sh +4 -1
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +11 -7
- package/src/cli/aztec_start_options.ts +2 -3
- package/src/cli/cmds/compile.ts +11 -1
- 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 +1 -1
- package/src/cli/cmds/start_node.ts +24 -102
- 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 +54 -0
- package/src/cli/util.ts +41 -74
- package/src/local-network/local-network.ts +6 -0
- package/src/testing/anvil_test_watcher.ts +1 -1
- package/src/testing/cheat_codes.ts +1 -1
- 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
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { getL1Config } from '@aztec/cli/config';
|
|
2
|
-
import {
|
|
2
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
3
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
3
5
|
import { ProvingJobBrokerSchema, ProvingJobBrokerSchemaWithDebug, createAndStartProvingBroker, proverBrokerConfigMappings } from '@aztec/prover-client/broker';
|
|
4
6
|
import { getProverNodeBrokerConfigFromEnv } from '@aztec/prover-node';
|
|
5
7
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
6
|
-
import { extractRelevantOptions
|
|
8
|
+
import { extractRelevantOptions } from '../util.js';
|
|
9
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
7
10
|
export async function startProverBroker(options, signalHandlers, services, userLog) {
|
|
8
11
|
if (options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
9
12
|
userLog(`Starting a prover broker with --node, --sequencer, --pxe, --p2p-bootstrap, or --txe is not supported.`);
|
|
@@ -16,15 +19,18 @@ export async function startProverBroker(options, signalHandlers, services, userL
|
|
|
16
19
|
if (!config.l1Contracts.registryAddress || config.l1Contracts.registryAddress.isZero()) {
|
|
17
20
|
throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
|
|
18
21
|
}
|
|
19
|
-
const
|
|
22
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
23
|
+
const { genesisArchiveRoot } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
24
|
+
await waitForCompatibleRollup(config, {
|
|
25
|
+
genesisArchiveRoot,
|
|
26
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
27
|
+
protocolContractsHash
|
|
28
|
+
}, options.port, userLog);
|
|
20
29
|
const { addresses, config: rollupConfig } = await getL1Config(config.l1Contracts.registryAddress, config.l1RpcUrls, config.l1ChainId, config.rollupVersion);
|
|
21
30
|
config.l1Contracts = addresses;
|
|
22
31
|
config.rollupVersion = rollupConfig.rollupVersion;
|
|
23
32
|
const client = await initTelemetryClient(getTelemetryClientConfig());
|
|
24
33
|
const broker = await createAndStartProvingBroker(config, client);
|
|
25
|
-
if (options.autoUpdate !== 'disabled' && options.autoUpdateUrl) {
|
|
26
|
-
await setupUpdateMonitor(options.autoUpdate, new URL(options.autoUpdateUrl), followsCanonicalRollup, getPublicClient(config), config.l1Contracts.registryAddress, signalHandlers);
|
|
27
|
-
}
|
|
28
34
|
services.proverBroker = [
|
|
29
35
|
broker,
|
|
30
36
|
config.proverBrokerDebugReplayEnabled ? ProvingJobBrokerSchemaWithDebug : ProvingJobBrokerSchema
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
|
|
3
|
+
* files.
|
|
4
|
+
*
|
|
5
|
+
* When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
|
|
6
|
+
* (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
|
|
7
|
+
*
|
|
8
|
+
* When `skipGitDeps` is true, git-based deps are ignored entirely.
|
|
9
|
+
*/
|
|
10
|
+
export declare function collectCrateDirs(startCrateDir: string, opts?: {
|
|
11
|
+
skipGitDeps?: boolean;
|
|
12
|
+
}): Promise<string[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
|
|
15
|
+
* Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
|
|
16
|
+
* e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
|
|
17
|
+
*
|
|
18
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
19
|
+
*/
|
|
20
|
+
export declare function nargoGitDepPath(gitUrl: string, tag: string): string;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdF9jcmF0ZV9kaXJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvY29sbGVjdF9jcmF0ZV9kaXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFBOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUFDLGFBQWEsRUFBRSxNQUFNLEVBQUUsSUFBSSxDQUFDLEVBQUU7SUFBRSxXQUFXLENBQUMsRUFBRSxPQUFPLENBQUE7Q0FBRSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQWlFakg7QUFFRDs7Ozs7O0dBTUc7QUFDSCx3QkFBZ0IsZUFBZSxDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBS25FIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect_crate_dirs.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/collect_crate_dirs.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiEjH;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKnE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import TOML from '@iarna/toml';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { mkdir, readFile, stat } from 'fs/promises';
|
|
4
|
+
import { homedir } from 'os';
|
|
5
|
+
import { dirname, join, resolve } from 'path';
|
|
6
|
+
import { run } from './spawn.js';
|
|
7
|
+
/**
|
|
8
|
+
* Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
|
|
9
|
+
* files.
|
|
10
|
+
*
|
|
11
|
+
* When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
|
|
12
|
+
* (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
|
|
13
|
+
*
|
|
14
|
+
* When `skipGitDeps` is true, git-based deps are ignored entirely.
|
|
15
|
+
*/ export async function collectCrateDirs(startCrateDir, opts) {
|
|
16
|
+
const { skipGitDeps = false } = opts ?? {};
|
|
17
|
+
const visited = new Set();
|
|
18
|
+
async function visit(crateDir) {
|
|
19
|
+
const absDir = resolve(crateDir);
|
|
20
|
+
if (visited.has(absDir)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
visited.add(absDir);
|
|
24
|
+
const tomlPath = join(absDir, 'Nargo.toml');
|
|
25
|
+
const content = await readFile(tomlPath, 'utf-8').catch(()=>{
|
|
26
|
+
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
27
|
+
});
|
|
28
|
+
const parsed = TOML.parse(content);
|
|
29
|
+
const members = parsed.workspace?.members;
|
|
30
|
+
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
31
|
+
if (Array.isArray(members)) {
|
|
32
|
+
// The crate is a workspace root and has members defined so we visit the members
|
|
33
|
+
for (const member of members){
|
|
34
|
+
await visit(resolve(absDir, member));
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
// Single crate — follow its deps
|
|
38
|
+
const deps = parsed.dependencies ?? {};
|
|
39
|
+
for (const dep of Object.values(deps)){
|
|
40
|
+
if (!dep || typeof dep !== 'object') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (typeof dep.path === 'string') {
|
|
44
|
+
// Dependency contains "path" hence it's a local dependency. We just check it's a real directory and then we
|
|
45
|
+
// recursively search through it
|
|
46
|
+
const depPath = resolve(absDir, dep.path);
|
|
47
|
+
const s = await stat(depPath);
|
|
48
|
+
if (!s.isDirectory()) {
|
|
49
|
+
throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
|
|
50
|
+
}
|
|
51
|
+
await visit(depPath);
|
|
52
|
+
} else if (!skipGitDeps && typeof dep.git === 'string' && typeof dep.tag === 'string') {
|
|
53
|
+
// Dependency contains "git" hence it's a git dependency. We ensure it has been fetched and fetch it if
|
|
54
|
+
// it's not the case and then we recursively search through it.
|
|
55
|
+
await fetchAndVisit(dep.git, dep.tag, dep.directory);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function fetchAndVisit(gitUrl, tag, directory) {
|
|
61
|
+
// `directory` is set when the dep lives in a subdirectory of a repository, e.g.:
|
|
62
|
+
// aztec = { git = "https://github.com/AztecProtocol/aztec-packages", tag = "v0.82.0",
|
|
63
|
+
// directory = "noir-projects/aztec-nr/aztec" }
|
|
64
|
+
// In that case nargo clones the whole repo and the crate root is <cachePath>/<directory>.
|
|
65
|
+
const cachePath = nargoGitDepPath(gitUrl, tag);
|
|
66
|
+
const crateDir = directory ? join(cachePath, directory) : cachePath;
|
|
67
|
+
await ensureGitDepCached(gitUrl, tag, cachePath);
|
|
68
|
+
await visit(crateDir);
|
|
69
|
+
}
|
|
70
|
+
await visit(startCrateDir);
|
|
71
|
+
return [
|
|
72
|
+
...visited
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
|
|
77
|
+
* Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
|
|
78
|
+
* e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
|
|
79
|
+
*
|
|
80
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
81
|
+
*/ export function nargoGitDepPath(gitUrl, tag) {
|
|
82
|
+
const url = new URL(gitUrl);
|
|
83
|
+
const domain = url.hostname;
|
|
84
|
+
const repoPath = url.pathname.replace(/^\//, '');
|
|
85
|
+
return join(process.env.HOME ?? homedir(), 'nargo', domain, repoPath, tag);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ensures a git dep is present in the nargo cache, cloning it if it isn't. Mirrors nargo's `clone_git_repo`.
|
|
89
|
+
* If cloning fails (e.g. no network), throws with a message suggesting `nargo check` to prime the cache.
|
|
90
|
+
*
|
|
91
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
92
|
+
*/ async function ensureGitDepCached(gitUrl, tag, cachePath) {
|
|
93
|
+
if (existsSync(cachePath)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await mkdir(dirname(cachePath), {
|
|
97
|
+
recursive: true
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
await run('git', [
|
|
101
|
+
'-c',
|
|
102
|
+
'advice.detachedHead=false',
|
|
103
|
+
'clone',
|
|
104
|
+
'--depth',
|
|
105
|
+
'1',
|
|
106
|
+
'--branch',
|
|
107
|
+
tag,
|
|
108
|
+
gitUrl,
|
|
109
|
+
cachePath
|
|
110
|
+
]);
|
|
111
|
+
} catch (err) {
|
|
112
|
+
throw new Error(`Failed to fetch git dependency ${gitUrl}@${tag}: ${err?.message ?? err}.\n` + `Try running \`nargo check\` first to prime the dependency cache.`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
3
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
4
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
5
|
+
* a recompile.
|
|
6
|
+
*
|
|
7
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
8
|
+
*/
|
|
9
|
+
export declare function needsRecompile(): Promise<boolean>;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FXdkQifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAWvD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
6
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
7
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
8
|
+
* a recompile.
|
|
9
|
+
*
|
|
10
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
11
|
+
*/ export async function needsRecompile() {
|
|
12
|
+
const oldestArtifactMs = await getOldestArtifactModificationTime('target');
|
|
13
|
+
if (oldestArtifactMs === undefined) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// Git deps are pinned to a specific tag in Nargo.toml and nargo always fetches an exact tag, so their contents never
|
|
17
|
+
// change without Nargo.toml itself changing — and Nargo.toml is already tracked as a source file. Hence we can
|
|
18
|
+
// safely ignore checking source files of git deps.
|
|
19
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
20
|
+
skipGitDeps: true
|
|
21
|
+
});
|
|
22
|
+
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the last modification time (timestamp in ms) of the oldest .json artifact in targetDir, or undefined if
|
|
26
|
+
* none exist.
|
|
27
|
+
*/ async function getOldestArtifactModificationTime(targetDir) {
|
|
28
|
+
let entries;
|
|
29
|
+
try {
|
|
30
|
+
entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
|
|
31
|
+
} catch (err) {
|
|
32
|
+
if (err?.code === 'ENOENT') {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
if (entries.length === 0) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
let oldest = Infinity;
|
|
41
|
+
for (const entry of entries){
|
|
42
|
+
const s = await stat(join(targetDir, entry));
|
|
43
|
+
if (s.mtimeMs < oldest) {
|
|
44
|
+
oldest = s.mtimeMs;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return oldest;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
51
|
+
*/ async function hasNewerSourceFile(crateDirs, thresholdMs) {
|
|
52
|
+
// Returns true if it find a new file than thresholdMs, false otherwise
|
|
53
|
+
async function walkForNewer(dir) {
|
|
54
|
+
let entries;
|
|
55
|
+
try {
|
|
56
|
+
entries = await readdir(dir, {
|
|
57
|
+
withFileTypes: true
|
|
58
|
+
});
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// We iterate over the entries in the dir
|
|
63
|
+
for (const entry of entries){
|
|
64
|
+
const fullPath = join(dir, entry.name);
|
|
65
|
+
if (entry.isDirectory()) {
|
|
66
|
+
// If the entry is a dir and it's not called `target` we recursively enter it
|
|
67
|
+
if (entry.name === 'target') {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (await walkForNewer(fullPath)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
} else if (entry.name === 'Nargo.toml' || entry.name.endsWith('.nr')) {
|
|
74
|
+
// The entry is a Nargo.toml file or *.nr file so we check the timestamp
|
|
75
|
+
const s = await stat(fullPath);
|
|
76
|
+
if (s.mtimeMs > thresholdMs) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// We search through the crate dirs
|
|
84
|
+
for (const dir of crateDirs){
|
|
85
|
+
if (await walkForNewer(dir)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
/** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */
|
|
3
|
+
export declare function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU25ELG1HQUFtRztBQUNuRyx3QkFBc0IsMEJBQTBCLENBQUMsR0FBRyxFQUFFLEtBQUssRUFBRSxVQUFVLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQTJDL0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warn_if_aztec_version_mismatch.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,mGAAmG;AACnG,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C/F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
2
|
+
import TOML from '@iarna/toml';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
6
|
+
/** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */ export async function warnIfAztecVersionMismatch(log, cliVersion) {
|
|
7
|
+
const version = cliVersion ?? getPackageVersion();
|
|
8
|
+
if (!version) {
|
|
9
|
+
log(`WARNING: aztec CLI version not found. Skipping dependency compatibility check.`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const expectedTag = `v${version}`;
|
|
13
|
+
const mismatches = [];
|
|
14
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
15
|
+
skipGitDeps: true
|
|
16
|
+
});
|
|
17
|
+
for (const dir of crateDirs){
|
|
18
|
+
const tomlPath = join(dir, 'Nargo.toml');
|
|
19
|
+
let content;
|
|
20
|
+
try {
|
|
21
|
+
content = await readFile(tomlPath, 'utf-8');
|
|
22
|
+
} catch {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const parsed = TOML.parse(content);
|
|
26
|
+
const aztecDep = parsed.dependencies?.aztec;
|
|
27
|
+
if (!aztecDep || typeof aztecDep !== 'object' || typeof aztecDep.tag !== 'string') {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (aztecDep.tag !== expectedTag) {
|
|
31
|
+
mismatches.push({
|
|
32
|
+
file: tomlPath,
|
|
33
|
+
tag: aztecDep.tag
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (mismatches.length > 0) {
|
|
38
|
+
const details = mismatches.map((m)=>` ${m.file} (${m.tag})`).join('\n');
|
|
39
|
+
log(`WARNING: Aztec dependency version mismatch detected.\n` + `The following crates have an aztec dependency that does not match the CLI version (${expectedTag}):\n` + `${details}\n\n` + `See https://docs.aztec.network/errors/9 for how to update your dependencies.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dest/cli/util.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
2
|
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
3
|
import type { ViemClient } from '@aztec/ethereum/types';
|
|
4
|
-
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
5
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { ConfigMappingsType, NetworkNames } from '@aztec/foundation/config';
|
|
6
5
|
import { type LogFn } from '@aztec/foundation/log';
|
|
7
|
-
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
8
6
|
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
9
7
|
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
10
8
|
import type { Command } from 'commander';
|
|
@@ -63,6 +61,6 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
|
|
|
63
61
|
* @param log - Logging function
|
|
64
62
|
*/
|
|
65
63
|
export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
66
|
-
export declare function
|
|
64
|
+
export declare function setupVersionChecker(network: NetworkNames, followsCanonicalRollup: boolean, publicClient: ViemClient, signalHandlers: Array<() => Promise<void>>, cacheDir?: string): Promise<void>;
|
|
67
65
|
export declare function stringifyConfig(config: object): string;
|
|
68
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRzdELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3hELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLFlBQVksRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRWpGLE9BQU8sRUFBRSxLQUFLLEtBQUssRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUV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xDQUl0RCJ9
|
package/dest/cli/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEjF,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF,0BAAkB,QAAQ;IACxB,OAAO,IAAI;IACX,KAAK,IAAI;IACT,cAAc,KAAK;IACnB,eAAe,KAAK;IAEpB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,MAAM;IACb,OAAO,MAAM;CACd;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAgB1G;AAED,wBAAgB,cA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;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
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) {
|
|
@@ -237,92 +239,49 @@ export const printAztecStartHelpText = ()=>{
|
|
|
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(' ');
|
|
@@ -70,4 +70,4 @@ export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?
|
|
|
70
70
|
}, options?: {
|
|
71
71
|
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
72
72
|
}): Promise<AztecNodeService>;
|
|
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AI,GAAE;IACJ,kBAAkB,CAAC,EAAE,EAAE,CAAC;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAClC;;;;;;;;;;;;;;;;;;;;;;;GAoBP;AAED,8BAA8B;AAC9B,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IACjD,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,yCAAkC,EAAE,OAAO,EAAE,KAAK;;;GAwJhG;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,GAAE,OAAO,CAAC,eAAe,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,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAO,6BAe7D"}
|
|
@@ -30,6 +30,7 @@ import { createAccountLogs } from '../cli/util.js';
|
|
|
30
30
|
import { DefaultMnemonic } from '../mnemonic.js';
|
|
31
31
|
import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
|
|
32
32
|
import { EpochTestSettler } from '../testing/epoch_test_settler.js';
|
|
33
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
33
34
|
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
34
35
|
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
35
36
|
const logger = createLogger('local-network');
|
|
@@ -68,9 +69,16 @@ const localAnvil = foundry;
|
|
|
68
69
|
if ((config.l1RpcUrls?.length || 0) > 1) {
|
|
69
70
|
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
70
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();
|
|
71
75
|
const aztecNodeConfig = {
|
|
72
76
|
...getConfigEnvVars(),
|
|
73
|
-
...config
|
|
77
|
+
...config,
|
|
78
|
+
txPublicSetupAllowListExtend: [
|
|
79
|
+
...tokenAllowList,
|
|
80
|
+
...config.txPublicSetupAllowListExtend ?? []
|
|
81
|
+
]
|
|
74
82
|
};
|
|
75
83
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
76
84
|
if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
|
|
@@ -101,7 +101,7 @@ 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`);
|
|
@@ -55,7 +55,7 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
55
55
|
* @param node - The Aztec node used to query if a new block has been mined.
|
|
56
56
|
* @param duration - The duration to advance time by (in seconds)
|
|
57
57
|
*/ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
|
|
58
|
-
const currentTimestamp = await this.eth.
|
|
58
|
+
const currentTimestamp = await this.eth.lastBlockTimestamp();
|
|
59
59
|
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
60
60
|
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
61
61
|
}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLHNCQUFzQixDQUFDO0FBQzVFLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBYyxNQUFNLGlDQUFpQyxDQUFDO0FBQy9FLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUdyRSxxQkFBYSxnQkFBZ0I7SUFPekIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLEdBQUc7SUFDWCxPQUFPLENBQUMsT0FBTztJQVJqQixPQUFPLENBQUMsZ0JBQWdCLENBQW1CO0lBQzNDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBZTtJQUVwQyxZQUNFLFVBQVUsRUFBRSxhQUFhLEVBQ3pCLGFBQWEsRUFBRSxVQUFVLEVBQ2pCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLEdBQUcsRUFBRSxNQUFNLEVBQ1gsT0FBTyxFQUFFO1FBQUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO1FBQUMsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUUsRUFHeEU7SUFFSyxLQUFLLGtCQUlWO0lBRUssSUFBSSxrQkFFVDtJQUVLLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQW9DbEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;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,
|
|
1
|
+
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;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}`);
|