@aztec/aztec 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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/README.md +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +13 -6
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- 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 +90 -31
- 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 +60 -53
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.js +7 -7
- package/dest/cli/cmds/compile.d.ts +4 -0
- package/dest/cli/cmds/compile.d.ts.map +1 -0
- package/dest/cli/cmds/compile.js +166 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
- package/dest/cli/cmds/migrate_ha_db.js +27 -0
- package/dest/cli/cmds/profile.d.ts +4 -0
- package/dest/cli/cmds/profile.d.ts.map +1 -0
- package/dest/cli/cmds/profile.js +8 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
- package/dest/cli/cmds/profile_flamegraph.js +52 -0
- package/dest/cli/cmds/profile_gates.d.ts +4 -0
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
- package/dest/cli/cmds/profile_gates.js +76 -0
- package/dest/cli/cmds/profile_utils.d.ts +18 -0
- package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
- package/dest/cli/cmds/profile_utils.js +50 -0
- package/dest/cli/cmds/standby.d.ts +30 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_bot.d.ts +3 -3
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +13 -9
- 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 +79 -39
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +2 -3
- 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 +8 -20
- 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 +25 -16
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +6 -5
- package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- 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/spawn.d.ts +3 -0
- package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
- package/dest/cli/cmds/utils/spawn.js +16 -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 +61 -0
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +1 -1
- package/dest/cli/util.d.ts +12 -23
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +57 -91
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +10 -10
- package/dest/examples/util.d.ts +2 -2
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/auth_registry.d.ts +5 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +17 -0
- package/dest/local-network/banana_fpc.d.ts +11 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/banana_fpc.js +14 -10
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/index.js +1 -1
- package/dest/local-network/local-network.d.ts +50 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +248 -0
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +26 -6
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +128 -35
- package/dest/testing/cheat_codes.d.ts +18 -17
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +72 -36
- package/dest/testing/epoch_test_settler.d.ts +19 -0
- package/dest/testing/epoch_test_settler.d.ts.map +1 -0
- package/dest/testing/epoch_test_settler.js +63 -0
- package/dest/testing/index.d.ts +4 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +2 -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 +42 -37
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +73 -0
- package/scripts/init.sh +39 -0
- package/scripts/new.sh +83 -0
- package/scripts/setup_workspace.sh +69 -0
- package/scripts/templates/blank/contract/Nargo.toml +6 -0
- package/scripts/templates/blank/contract/src/main.nr +10 -0
- package/scripts/templates/blank/test/Nargo.toml +7 -0
- package/scripts/templates/blank/test/src/lib.nr +11 -0
- package/scripts/templates/counter/contract/Nargo.toml +7 -0
- package/scripts/templates/counter/contract/src/main.nr +48 -0
- package/scripts/templates/counter/test/Nargo.toml +7 -0
- package/scripts/templates/counter/test/src/lib.nr +32 -0
- package/src/bin/index.ts +14 -6
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +83 -26
- package/src/cli/aztec_start_options.ts +68 -59
- package/src/cli/cli.ts +11 -11
- package/src/cli/cmds/compile.ts +192 -0
- package/src/cli/cmds/migrate_ha_db.ts +43 -0
- package/src/cli/cmds/profile.ts +26 -0
- package/src/cli/cmds/profile_flamegraph.ts +64 -0
- package/src/cli/cmds/profile_gates.ts +84 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_bot.ts +12 -11
- package/src/cli/cmds/start_node.ts +90 -44
- package/src/cli/cmds/start_p2p_bootstrap.ts +3 -3
- package/src/cli/cmds/start_prover_agent.ts +9 -20
- package/src/cli/cmds/start_prover_broker.ts +29 -26
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +44 -0
- 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/spawn.ts +16 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/util.ts +66 -104
- package/src/examples/token.ts +11 -11
- package/src/examples/util.ts +1 -1
- package/src/index.ts +2 -2
- package/src/local-network/auth_registry.ts +19 -0
- package/src/{sandbox → local-network}/banana_fpc.ts +17 -9
- package/src/{sandbox → local-network}/index.ts +1 -1
- package/src/local-network/local-network.ts +303 -0
- package/src/{sandbox → local-network}/sponsored_fpc.ts +3 -2
- package/src/testing/anvil_test_watcher.ts +142 -33
- package/src/testing/cheat_codes.ts +92 -38
- package/src/testing/epoch_test_settler.ts +69 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/cmds/start_archiver.d.ts +0 -9
- package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
- package/dest/cli/cmds/start_archiver.js +0 -50
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -33
- package/dest/cli/cmds/start_prover_node.d.ts +0 -7
- package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
- package/dest/cli/cmds/start_prover_node.js +0 -108
- 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/dest/sandbox/banana_fpc.d.ts +0 -10
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -4
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/sandbox.d.ts +0 -74
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sandbox.js +0 -183
- package/dest/sandbox/sponsored_fpc.d.ts +0 -4
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/src/cli/cmds/start_archiver.ts +0 -61
- package/src/cli/cmds/start_blob_sink.ts +0 -57
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
- package/src/sandbox/sandbox.ts +0 -242
- /package/dest/{sandbox → local-network}/sponsored_fpc.js +0 -0
|
@@ -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,3 @@
|
|
|
1
|
+
/** Spawns a command with inherited stdio and rejects on non-zero exit. */
|
|
2
|
+
export declare function run(cmd: string, args: string[]): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhd24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jbGkvY21kcy91dGlscy9zcGF3bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSwwRUFBMEU7QUFDMUUsd0JBQWdCLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBWTlEIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/spawn.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
/** Spawns a command with inherited stdio and rejects on non-zero exit. */ export function run(cmd, args) {
|
|
3
|
+
return new Promise((resolve, reject)=>{
|
|
4
|
+
const child = spawn(cmd, args, {
|
|
5
|
+
stdio: 'inherit'
|
|
6
|
+
});
|
|
7
|
+
child.on('error', reject);
|
|
8
|
+
child.on('close', (code)=>{
|
|
9
|
+
if (code !== 0) {
|
|
10
|
+
reject(new Error(`${cmd} exited with code ${code}`));
|
|
11
|
+
} else {
|
|
12
|
+
resolve();
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
/** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */
|
|
3
|
+
export declare function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBMkJuRCxpSEFBaUg7QUFDakgsd0JBQXNCLDBCQUEwQixDQUFDLEdBQUcsRUFBRSxLQUFLLEVBQUUsVUFBVSxDQUFDLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0ErQy9GIn0=
|
|
@@ -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;AA2BnD,iHAAiH;AACjH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C/F"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DEV_VERSION, 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
|
+
/** Returns true if the given git URL points to the AztecProtocol/aztec-nr repository. */ function isAztecNrGitUrl(gitUrl) {
|
|
7
|
+
let url;
|
|
8
|
+
try {
|
|
9
|
+
url = new URL(gitUrl);
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (url.hostname !== 'github.com') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const repoPath = url.pathname.replace(/^\//, '').replace(/\.git$/, '').replace(/\/$/, '');
|
|
17
|
+
return repoPath === 'AztecProtocol/aztec-nr';
|
|
18
|
+
}
|
|
19
|
+
/** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */ export async function warnIfAztecVersionMismatch(log, cliVersion) {
|
|
20
|
+
const version = cliVersion ?? getPackageVersion();
|
|
21
|
+
if (version === DEV_VERSION) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const expectedTag = `v${version}`;
|
|
25
|
+
const mismatches = [];
|
|
26
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
27
|
+
skipGitDeps: true
|
|
28
|
+
});
|
|
29
|
+
for (const dir of crateDirs){
|
|
30
|
+
const tomlPath = join(dir, 'Nargo.toml');
|
|
31
|
+
let content;
|
|
32
|
+
try {
|
|
33
|
+
content = await readFile(tomlPath, 'utf-8');
|
|
34
|
+
} catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const parsed = TOML.parse(content);
|
|
38
|
+
const deps = parsed.dependencies ?? {};
|
|
39
|
+
for (const [depName, dep] of Object.entries(deps)){
|
|
40
|
+
// Skip non-object deps (e.g. malformed entries) and anything that isn't a tagged git dep.
|
|
41
|
+
if (!dep || typeof dep !== 'object' || typeof dep.git !== 'string' || typeof dep.tag !== 'string') {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// Only flag deps that are sourced from the aztec-nr repo.
|
|
45
|
+
if (!isAztecNrGitUrl(dep.git)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (dep.tag !== expectedTag) {
|
|
49
|
+
mismatches.push({
|
|
50
|
+
file: tomlPath,
|
|
51
|
+
depName,
|
|
52
|
+
tag: dep.tag
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (mismatches.length > 0) {
|
|
58
|
+
const details = mismatches.map((m)=>` ${m.file} — ${m.depName} (${m.tag})`).join('\n');
|
|
59
|
+
log(`WARNING: Aztec dependency version mismatch detected.\n` + `The following aztec-nr dependencies do not match the CLI version (${expectedTag}):\n` + `${details}\n\n` + `See https://docs.aztec.network/errors/9 for how to update your dependencies.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
package/dest/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './cli.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxVQUFVLENBQUMifQ==
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
export declare function preloadCrs(_options: any, userLog: LogFn, _debugLogger: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlbG9hZF9jcnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGkvcHJlbG9hZF9jcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSTNELHdCQUFzQixVQUFVLENBQUMsUUFBUSxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUVuRiJ9
|
package/dest/cli/util.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type { ViemClient } from '@aztec/ethereum';
|
|
6
|
-
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
|
+
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import type { ViemClient } from '@aztec/ethereum/types';
|
|
4
|
+
import type { ConfigMappingsType, NetworkNames } from '@aztec/foundation/config';
|
|
7
5
|
import { type LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
9
6
|
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import type {
|
|
7
|
+
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
11
8
|
import type { Command } from 'commander';
|
|
12
9
|
import { type AztecStartOption } from './aztec_start_options.js';
|
|
13
10
|
export declare const enum ExitCode {
|
|
14
11
|
SUCCESS = 0,
|
|
15
12
|
ERROR = 1,
|
|
16
|
-
ROLLUP_UPGRADE = 78
|
|
17
|
-
VERSION_UPGRADE = 79
|
|
13
|
+
ROLLUP_UPGRADE = 78,
|
|
14
|
+
VERSION_UPGRADE = 79,
|
|
18
15
|
SIGHUP = 129,
|
|
19
16
|
SIGINT = 130,
|
|
20
17
|
SIGQUIT = 131,
|
|
@@ -22,23 +19,14 @@ export declare const enum ExitCode {
|
|
|
22
19
|
}
|
|
23
20
|
export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
|
|
24
21
|
export declare function isShuttingDown(): boolean;
|
|
25
|
-
export declare const installSignalHandlers: (logFn: LogFn, cb?:
|
|
22
|
+
export declare const installSignalHandlers: (logFn: LogFn, cb?: (() => Promise<void>)[] | undefined) => void;
|
|
26
23
|
/**
|
|
27
24
|
* Creates logs for the initial accounts
|
|
28
25
|
* @param accounts - The initial accounts
|
|
29
|
-
* @param wallet - A
|
|
26
|
+
* @param wallet - A EmbeddedWallet instance to get the registered accounts
|
|
30
27
|
* @returns A string array containing the initial accounts details
|
|
31
28
|
*/
|
|
32
|
-
export declare function createAccountLogs(
|
|
33
|
-
/**
|
|
34
|
-
* The account object
|
|
35
|
-
*/
|
|
36
|
-
account: AccountManager;
|
|
37
|
-
/**
|
|
38
|
-
* The secret key of the account
|
|
39
|
-
*/
|
|
40
|
-
secretKey: Fr;
|
|
41
|
-
}[], wallet: TestWallet): Promise<string[]>;
|
|
29
|
+
export declare function createAccountLogs(accountManagers: AccountManager[], wallet: EmbeddedWallet): Promise<string[]>;
|
|
42
30
|
export declare function getMaxLengths(sections: {
|
|
43
31
|
[key: string]: AztecStartOption[];
|
|
44
32
|
}): [number, number];
|
|
@@ -73,5 +61,6 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
|
|
|
73
61
|
* @param log - Logging function
|
|
74
62
|
*/
|
|
75
63
|
export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
76
|
-
export declare function
|
|
77
|
-
|
|
64
|
+
export declare function setupVersionChecker(network: NetworkNames, followsCanonicalRollup: boolean, publicClient: ViemClient, signalHandlers: Array<() => Promise<void>>, cacheDir?: string): Promise<void>;
|
|
65
|
+
export declare function stringifyConfig(config: object): string;
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRzdELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3hELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQU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Q0FBQyxJQUFJLENBQUMsQ0FBQyxFQUMxQyxRQUFRLENBQUMsRUFBRSxNQUFNLEdBQ2hCLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0E4Q2Y7QUFFRCx3QkFBZ0IsZUFBZSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsTUFBTSxDQUl0RCJ9
|
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,
|
|
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,EAA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EAC/B,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA8Cf;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';
|
|
3
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
1
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import {
|
|
3
|
-
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
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) {
|
|
@@ -25,7 +27,7 @@ export function shutdown(logFn, exitCode, cb) {
|
|
|
25
27
|
exitCode
|
|
26
28
|
});
|
|
27
29
|
if (cb) {
|
|
28
|
-
shutdownPromise = Promise.allSettled(cb).then(()=>process.exit(exitCode));
|
|
30
|
+
shutdownPromise = Promise.allSettled(cb.map((fn)=>fn())).then(()=>process.exit(exitCode));
|
|
29
31
|
} else {
|
|
30
32
|
// synchronously shuts down the process
|
|
31
33
|
// no need to set shutdownPromise on this branch of the if statement because no more code will be executed
|
|
@@ -64,23 +66,26 @@ export const installSignalHandlers = (logFn, cb)=>{
|
|
|
64
66
|
/**
|
|
65
67
|
* Creates logs for the initial accounts
|
|
66
68
|
* @param accounts - The initial accounts
|
|
67
|
-
* @param wallet - A
|
|
69
|
+
* @param wallet - A EmbeddedWallet instance to get the registered accounts
|
|
68
70
|
* @returns A string array containing the initial accounts details
|
|
69
|
-
*/ export async function createAccountLogs(
|
|
71
|
+
*/ export async function createAccountLogs(accountManagers, wallet) {
|
|
70
72
|
const registeredAccounts = await wallet.getAccounts();
|
|
71
73
|
const accountLogStrings = [
|
|
72
74
|
`Initial Accounts:\n\n`
|
|
73
75
|
];
|
|
74
|
-
for (const
|
|
75
|
-
const
|
|
76
|
+
for (const accountManager of accountManagers){
|
|
77
|
+
const account = await accountManager.getAccount();
|
|
78
|
+
const completeAddress = account.getCompleteAddress();
|
|
76
79
|
if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
|
|
77
80
|
accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
|
|
78
81
|
accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
|
|
79
|
-
accountLogStrings.push(` Secret Key: ${
|
|
80
|
-
accountLogStrings.push(` Master nullifier public key: ${completeAddress.publicKeys.
|
|
81
|
-
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.
|
|
82
|
-
accountLogStrings.push(` Master outgoing viewing public key: ${completeAddress.publicKeys.
|
|
83
|
-
accountLogStrings.push(` Master tagging public key: ${completeAddress.publicKeys.
|
|
82
|
+
accountLogStrings.push(` Secret Key: ${account.getSecretKey().toString()}\n`);
|
|
83
|
+
accountLogStrings.push(` Master nullifier public key hash: ${completeAddress.publicKeys.npkMHash.toString()}\n`);
|
|
84
|
+
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.ivpkM.toString()}\n\n`);
|
|
85
|
+
accountLogStrings.push(` Master outgoing viewing public key hash: ${completeAddress.publicKeys.ovpkMHash.toString()}\n\n`);
|
|
86
|
+
accountLogStrings.push(` Master tagging public key hash: ${completeAddress.publicKeys.tpkMHash.toString()}\n\n`);
|
|
87
|
+
accountLogStrings.push(` Master message-signing public key hash: ${completeAddress.publicKeys.mspkMHash.toString()}\n\n`);
|
|
88
|
+
accountLogStrings.push(` Master fallback public key hash: ${completeAddress.publicKeys.fbpkMHash.toString()}\n\n`);
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
return accountLogStrings;
|
|
@@ -219,7 +224,7 @@ export const printAztecStartHelpText = ()=>{
|
|
|
219
224
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
220
225
|
await Promise.all([
|
|
221
226
|
Crs.new(2 ** 1, undefined, log),
|
|
222
|
-
GrumpkinCrs.new(2 ** 16
|
|
227
|
+
GrumpkinCrs.new(2 ** 16, undefined, log)
|
|
223
228
|
]);
|
|
224
229
|
}
|
|
225
230
|
}
|
|
@@ -231,94 +236,55 @@ export const printAztecStartHelpText = ()=>{
|
|
|
231
236
|
if (realProofs) {
|
|
232
237
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
233
238
|
await Promise.all([
|
|
234
|
-
Crs.new(2 ** 25
|
|
235
|
-
GrumpkinCrs.new(2 ** 18
|
|
239
|
+
Crs.new(2 ** 25, undefined, log),
|
|
240
|
+
GrumpkinCrs.new(2 ** 18, undefined, log)
|
|
236
241
|
]);
|
|
237
242
|
}
|
|
238
243
|
}
|
|
239
|
-
export async function
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
256
|
-
logger.info(`New rollup version detected. Please restart the node`, {
|
|
257
|
-
latestVersion,
|
|
258
|
-
currentVersion
|
|
259
|
-
});
|
|
260
|
-
await shutdown(logger.info, 78, signalHandlers);
|
|
261
|
-
} else if (autoUpdateMode === 'notify') {
|
|
262
|
-
logger.warn(`New rollup detected. Please restart the node`, {
|
|
263
|
-
latestVersion,
|
|
264
|
-
currentVersion
|
|
265
|
-
});
|
|
244
|
+
export async function setupVersionChecker(network, followsCanonicalRollup, publicClient, signalHandlers, cacheDir) {
|
|
245
|
+
const networkConfig = await getNetworkConfig(network, cacheDir);
|
|
246
|
+
if (!networkConfig) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const { VersionChecker } = await import('@aztec/stdlib/update-checker');
|
|
250
|
+
const logger = createLogger('version_check');
|
|
251
|
+
const registry = new RegistryContract(publicClient, networkConfig.registryAddress);
|
|
252
|
+
const checks = [];
|
|
253
|
+
checks.push({
|
|
254
|
+
name: 'node',
|
|
255
|
+
currentVersion: getPackageVersion(),
|
|
256
|
+
getLatestVersion: async ()=>{
|
|
257
|
+
const cfg = await getNetworkConfig(network, cacheDir);
|
|
258
|
+
return cfg?.nodeVersion;
|
|
266
259
|
}
|
|
267
260
|
});
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else if (autoUpdateMode === 'notify') {
|
|
280
|
-
logger.info(`New node version detected. Please update and restart the node`, {
|
|
281
|
-
latestVersion,
|
|
282
|
-
currentVersion
|
|
261
|
+
if (followsCanonicalRollup) {
|
|
262
|
+
const getLatestVersion = async ()=>{
|
|
263
|
+
const version = (await registry.getRollupVersions()).at(-1);
|
|
264
|
+
return version !== undefined ? String(version) : undefined;
|
|
265
|
+
};
|
|
266
|
+
const currentVersion = await getLatestVersion();
|
|
267
|
+
if (currentVersion !== undefined) {
|
|
268
|
+
checks.push({
|
|
269
|
+
name: 'rollup',
|
|
270
|
+
currentVersion,
|
|
271
|
+
getLatestVersion
|
|
283
272
|
});
|
|
284
273
|
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
checker.on('
|
|
274
|
+
}
|
|
275
|
+
const checker = new VersionChecker(checks, 600_000, logger);
|
|
276
|
+
checker.on('newVersion', ({ name, latestVersion, currentVersion })=>{
|
|
288
277
|
if (isShuttingDown()) {
|
|
289
278
|
return;
|
|
290
279
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
} catch (err) {
|
|
296
|
-
logger.warn('Failed to update config', {
|
|
297
|
-
err
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
// don't notify on these config changes
|
|
302
|
-
});
|
|
303
|
-
checker.on('updatePublicTelemetryConfig', (config)=>{
|
|
304
|
-
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
305
|
-
logger.warn(`Public telemetry config change detected. Updating telemetry client`, config);
|
|
306
|
-
try {
|
|
307
|
-
const publicIncludeMetrics = config.publicIncludeMetrics;
|
|
308
|
-
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every((m)=>typeof m === 'string')) {
|
|
309
|
-
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
310
|
-
}
|
|
311
|
-
const publicMetricsCollectFrom = config.publicMetricsCollectFrom;
|
|
312
|
-
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every((m)=>typeof m === 'string')) {
|
|
313
|
-
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
314
|
-
}
|
|
315
|
-
} catch (err) {
|
|
316
|
-
logger.warn('Failed to update config', {
|
|
317
|
-
err
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
// don't notify on these config changes
|
|
280
|
+
logger.warn(`New ${name} version available`, {
|
|
281
|
+
latestVersion,
|
|
282
|
+
currentVersion
|
|
283
|
+
});
|
|
322
284
|
});
|
|
323
285
|
checker.start();
|
|
286
|
+
signalHandlers.push(()=>checker.stop());
|
|
287
|
+
}
|
|
288
|
+
export function stringifyConfig(config) {
|
|
289
|
+
return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
|
|
324
290
|
}
|
package/dest/cli/versioning.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
2
2
|
import { type ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
3
3
|
export declare function getVersions(config?: ChainConfig): Partial<ComponentsVersions>;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS92ZXJzaW9uaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3hELE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFtQyxNQUFNLDBCQUEwQixDQUFDO0FBRXBHLHdCQUFnQixXQUFXLENBQUMsTUFBTSxDQUFDLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQU83RSJ9
|
package/dest/examples/token.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW4uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy90b2tlbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|