@aztec/aztec 0.0.1-commit.343b43af6 → 0.0.1-commit.350e0a4d
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 +3 -1
- 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 +22 -23
- 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 -15
- 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 +34 -25
- package/dest/cli/cmds/profile.d.ts +1 -1
- package/dest/cli/cmds/profile.d.ts.map +1 -1
- package/dest/cli/cmds/profile.js +1 -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 +2 -2
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +23 -4
- package/dest/cli/cmds/prover.d.ts +4 -0
- package/dest/cli/cmds/prover.d.ts.map +1 -0
- package/dest/cli/cmds/prover.js +24 -0
- package/dest/cli/cmds/standby.d.ts +39 -10
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +80 -18
- package/dest/cli/cmds/start_bot.d.ts +1 -1
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +8 -4
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +29 -48
- 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 +5 -17
- 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 +17 -8
- 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 +6 -1
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -1
- 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 +1 -1
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
- package/dest/cli/cmds/utils/needs_recompile.js +9 -43
- 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/util.d.ts +10 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +26 -53
- package/dest/examples/token.js +3 -3
- 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 +3 -2
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +11 -7
- package/dest/local-network/local-network.d.ts +8 -32
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +52 -73
- package/dest/testing/cheat_codes.d.ts +17 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +17 -43
- package/dest/testing/epoch_test_settler.d.ts +2 -2
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +6 -26
- package/dest/testing/index.d.ts +1 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +0 -1
- package/dest/testing/token_allowed_setup.d.ts +9 -4
- package/dest/testing/token_allowed_setup.d.ts.map +1 -1
- package/dest/testing/token_allowed_setup.js +12 -8
- package/package.json +34 -34
- package/scripts/add_crate.sh +11 -60
- package/scripts/aztec.sh +6 -2
- package/scripts/init.sh +5 -5
- package/scripts/new.sh +2 -2
- package/scripts/setup_workspace.sh +3 -2
- 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 +3 -1
- package/src/cli/aztec_start_action.ts +18 -19
- package/src/cli/aztec_start_options.ts +22 -23
- package/src/cli/cmds/compile.ts +39 -24
- package/src/cli/cmds/profile.ts +2 -1
- package/src/cli/cmds/profile_flamegraph.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +22 -5
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +95 -22
- package/src/cli/cmds/start_bot.ts +9 -6
- package/src/cli/cmds/start_node.ts +37 -40
- package/src/cli/cmds/start_prover_agent.ts +5 -8
- package/src/cli/cmds/start_prover_broker.ts +17 -11
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +5 -0
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +8 -49
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/util.ts +27 -68
- package/src/examples/token.ts +3 -3
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +12 -8
- package/src/local-network/local-network.ts +56 -83
- package/src/testing/cheat_codes.ts +18 -49
- package/src/testing/epoch_test_settler.ts +8 -32
- package/src/testing/index.ts +0 -1
- package/src/testing/token_allowed_setup.ts +15 -8
- 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 -48
- package/dest/testing/anvil_test_watcher.d.ts +0 -42
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -181
- package/src/cli/cmds/start_archiver.ts +0 -50
- package/src/testing/anvil_test_watcher.ts +0 -210
|
@@ -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
|
+
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
8
8
|
*/
|
|
9
9
|
export declare function needsRecompile(): Promise<boolean>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FXdkQifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
6
6
|
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
@@ -13,7 +13,12 @@ import { join, resolve } from 'path';
|
|
|
13
13
|
if (oldestArtifactMs === undefined) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
|
|
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
|
+
});
|
|
17
22
|
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
@@ -41,45 +46,6 @@ import { join, resolve } from 'path';
|
|
|
41
46
|
}
|
|
42
47
|
return oldest;
|
|
43
48
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
|
|
46
|
-
* Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
|
|
47
|
-
* tagged).
|
|
48
|
-
*/ async function collectCrateDirs(startCrateDir) {
|
|
49
|
-
// We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
|
|
50
|
-
// multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
|
|
51
|
-
const visited = new Set();
|
|
52
|
-
async function visit(crateDir) {
|
|
53
|
-
const absDir = resolve(crateDir);
|
|
54
|
-
if (visited.has(absDir)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
visited.add(absDir);
|
|
58
|
-
// Every dep is its own crate and every crate needs to have Nargo.toml defined in the root so we try to load it and
|
|
59
|
-
// error out if it's not the case.
|
|
60
|
-
const tomlPath = join(absDir, 'Nargo.toml');
|
|
61
|
-
const content = await readFile(tomlPath, 'utf-8').catch(()=>{
|
|
62
|
-
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
63
|
-
});
|
|
64
|
-
// We parse and iterate over the dependencies
|
|
65
|
-
const parsed = TOML.parse(content);
|
|
66
|
-
const deps = parsed.dependencies ?? {};
|
|
67
|
-
for (const dep of Object.values(deps)){
|
|
68
|
-
if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
|
|
69
|
-
const depPath = resolve(absDir, dep.path);
|
|
70
|
-
const s = await stat(depPath);
|
|
71
|
-
if (!s.isDirectory()) {
|
|
72
|
-
throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
|
|
73
|
-
}
|
|
74
|
-
await visit(depPath);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
await visit(startCrateDir);
|
|
79
|
-
return [
|
|
80
|
-
...visited
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
49
|
/**
|
|
84
50
|
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
85
51
|
*/ async function hasNewerSourceFile(crateDirs, thresholdMs) {
|
|
@@ -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/util.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
2
|
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import { type LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
6
5
|
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
7
6
|
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
8
7
|
import type { Command } from 'commander';
|
|
@@ -19,6 +18,13 @@ export declare const enum ExitCode {
|
|
|
19
18
|
}
|
|
20
19
|
export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
|
|
21
20
|
export declare function isShuttingDown(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Stops the node's subsystems (via the registered signal handlers) without exiting the process, leaving
|
|
23
|
+
* the HTTP health server listening so K8s liveness/readiness probes keep passing. Unlike {@link shutdown}
|
|
24
|
+
* this deliberately does not latch `shutdownPromise` or call `process.exit`; instead it re-arms
|
|
25
|
+
* SIGTERM/SIGINT so a later K8s pod deletion still terminates the wound-down pod with a clean exit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function softShutdown(logFn: LogFn, signalHandlers: Array<() => Promise<void>>): Promise<void>;
|
|
22
28
|
export declare const installSignalHandlers: (logFn: LogFn, cb?: (() => Promise<void>)[] | undefined) => void;
|
|
23
29
|
/**
|
|
24
30
|
* Creates logs for the initial accounts
|
|
@@ -61,6 +67,5 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
|
|
|
61
67
|
* @param log - Logging function
|
|
62
68
|
*/
|
|
63
69
|
export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
64
|
-
export declare function setupVersionChecker(network: NetworkNames, followsCanonicalRollup: boolean, publicClient: ViemClient, signalHandlers: Array<() => Promise<void>>, cacheDir?: string): Promise<void>;
|
|
65
70
|
export declare function stringifyConfig(config: object): string;
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
71
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFbkUsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDcEUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFHOUQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBRXpDLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUFxQixNQUFNLDBCQUEwQixDQUFDO0FBRXBGLDBCQUFrQixRQUFRO0lBQ3hCLE9BQU8sSUFBSTtJQUNYLEtBQUssSUFBSTt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3ZCLE1BQU0sQ0FLUjtBQWlDRCxlQUFPLE1BQU0sVUFBVSxxREFTdEIsQ0FBQztBQUVGLGVBQU8sTUFBTSx1QkFBdUIsY0F5Qm5DLENBQUM7QUFFRjs7Ozs7R0FLRztBQUNILGVBQU8sTUFBTSx3QkFBd0IsMEVBU3BDLENBQUM7QUFFRjs7Ozs7OztHQU9HO0FBQ0gsZUFBTyxNQUFNLHNCQUFzQixHQUFJLENBQUMsd0ZBa0N2QyxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILHdCQUFzQiwwQkFBMEIsQ0FDOUMsRUFBRSxVQUFVLEVBQUUsRUFBRSxJQUFJLENBQUMsZUFBZSxFQUFFLFlBQVksQ0FBQyxFQUNuRCxHQUFHLEVBQUUsS0FBSyxHQUNULE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FLZjtBQUVEOzs7O0dBSUc7QUFDSCx3QkFBc0Isa0NBQWtDLENBQ3RELEVBQUUsVUFBVSxFQUFFLEVBQUUsSUFBSSxDQUFDLFlBQVksRUFBRSxZQUFZLENBQUMsRUFDaEQsR0FBRyxFQUFFLEtBQUssR0FDVCxPQUFPLENBQUMsSUFBSSxDQUFDLENBS2Y7QUFFRCx3QkFBZ0IsZUFBZSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsTUFBTSxDQUl0RCJ9
|
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,c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AAc,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAKR;AAiCD,eAAO,MAAM,UAAU,qDAStB,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAyBnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,0EASpC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,wFAkCvC,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACnD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;GAIG;AACH,wBAAsB,kCAAkC,CACtD,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAChD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
package/dest/cli/util.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { getNetworkConfig } from '@aztec/cli/config';
|
|
2
|
-
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
3
1
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
6
2
|
import chalk from 'chalk';
|
|
7
3
|
import { aztecStartOptions } from './aztec_start_options.js';
|
|
8
4
|
export var ExitCode = /*#__PURE__*/ function(ExitCode) {
|
|
@@ -38,6 +34,25 @@ export function shutdown(logFn, exitCode, cb) {
|
|
|
38
34
|
export function isShuttingDown() {
|
|
39
35
|
return shutdownPromise !== undefined;
|
|
40
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Stops the node's subsystems (via the registered signal handlers) without exiting the process, leaving
|
|
39
|
+
* the HTTP health server listening so K8s liveness/readiness probes keep passing. Unlike {@link shutdown}
|
|
40
|
+
* this deliberately does not latch `shutdownPromise` or call `process.exit`; instead it re-arms
|
|
41
|
+
* SIGTERM/SIGINT so a later K8s pod deletion still terminates the wound-down pod with a clean exit.
|
|
42
|
+
*/ export async function softShutdown(logFn, signalHandlers) {
|
|
43
|
+
logFn('Canonical rollup upgrade detected: stopping subsystems, health server stays up.', {
|
|
44
|
+
exitCode: 78
|
|
45
|
+
});
|
|
46
|
+
await Promise.allSettled(signalHandlers.map((fn)=>fn()));
|
|
47
|
+
for (const sig of [
|
|
48
|
+
'SIGTERM',
|
|
49
|
+
'SIGINT'
|
|
50
|
+
]){
|
|
51
|
+
process.removeAllListeners(sig);
|
|
52
|
+
process.once(sig, ()=>process.exit(78));
|
|
53
|
+
}
|
|
54
|
+
logFn('Subsystems stopped due to rollup upgrade. Health server remains active.');
|
|
55
|
+
}
|
|
41
56
|
export const installSignalHandlers = (logFn, cb)=>{
|
|
42
57
|
const signals = [
|
|
43
58
|
[
|
|
@@ -79,11 +94,13 @@ export const installSignalHandlers = (logFn, cb)=>{
|
|
|
79
94
|
if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
|
|
80
95
|
accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
|
|
81
96
|
accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
|
|
82
|
-
accountLogStrings.push(` Secret Key: ${
|
|
83
|
-
accountLogStrings.push(` Master nullifier public key: ${completeAddress.publicKeys.
|
|
84
|
-
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.
|
|
85
|
-
accountLogStrings.push(` Master outgoing viewing public key: ${completeAddress.publicKeys.
|
|
86
|
-
accountLogStrings.push(` Master tagging public key: ${completeAddress.publicKeys.
|
|
97
|
+
accountLogStrings.push(` Secret Key: ${accountManager.getSecretKey().toString()}\n`);
|
|
98
|
+
accountLogStrings.push(` Master nullifier public key hash: ${completeAddress.publicKeys.npkMHash.toString()}\n`);
|
|
99
|
+
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.ivpkM.toString()}\n\n`);
|
|
100
|
+
accountLogStrings.push(` Master outgoing viewing public key hash: ${completeAddress.publicKeys.ovpkMHash.toString()}\n\n`);
|
|
101
|
+
accountLogStrings.push(` Master tagging public key hash: ${completeAddress.publicKeys.tpkMHash.toString()}\n\n`);
|
|
102
|
+
accountLogStrings.push(` Master message-signing public key hash: ${completeAddress.publicKeys.mspkMHash.toString()}\n\n`);
|
|
103
|
+
accountLogStrings.push(` Master fallback public key hash: ${completeAddress.publicKeys.fbpkMHash.toString()}\n\n`);
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
106
|
return accountLogStrings;
|
|
@@ -239,50 +256,6 @@ export const printAztecStartHelpText = ()=>{
|
|
|
239
256
|
]);
|
|
240
257
|
}
|
|
241
258
|
}
|
|
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;
|
|
257
|
-
}
|
|
258
|
-
});
|
|
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
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
const checker = new VersionChecker(checks, 600_000, logger);
|
|
274
|
-
checker.on('newVersion', ({ name, latestVersion, currentVersion })=>{
|
|
275
|
-
if (isShuttingDown()) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
logger.warn(`New ${name} version available`, {
|
|
279
|
-
latestVersion,
|
|
280
|
-
currentVersion
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
checker.start();
|
|
284
|
-
signalHandlers.push(()=>checker.stop());
|
|
285
|
-
}
|
|
286
259
|
export function stringifyConfig(config) {
|
|
287
260
|
return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
|
|
288
261
|
}
|
package/dest/examples/token.js
CHANGED
|
@@ -13,10 +13,10 @@ const TRANSFER_AMOUNT = 33n;
|
|
|
13
13
|
*/ async function main() {
|
|
14
14
|
logger.info('Running token contract test on HTTP interface.');
|
|
15
15
|
const wallet = await EmbeddedWallet.create(node);
|
|
16
|
-
// During local network setup we
|
|
16
|
+
// During local network setup we create a few initializerless accounts. Below we add them to our wallet.
|
|
17
17
|
const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
|
|
18
|
-
await wallet.
|
|
19
|
-
await wallet.
|
|
18
|
+
await wallet.createSchnorrInitializerlessAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
|
|
19
|
+
await wallet.createSchnorrInitializerlessAccount(bobInitialAccountData.secret, bobInitialAccountData.salt);
|
|
20
20
|
const alice = aliceInitialAccountData.address;
|
|
21
21
|
const bob = bobInitialAccountData.address;
|
|
22
22
|
logger.info(`Fetched Alice and Bob accounts: ${alice.toString()}, ${bob.toString()}`);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
export declare function publishStandardAuthRegistry(wallet: Wallet, from: AztecAddress, waitOpts?: WaitOpts): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aF9yZWdpc3RyeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvYXV0aF9yZWdpc3RyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVyRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSx3QkFBc0IsMkJBQTJCLENBQy9DLE1BQU0sRUFBRSxNQUFNLEVBQ2QsSUFBSSxFQUFFLFlBQVksRUFDbEIsUUFBUSxDQUFDLEVBQUUsUUFBUSxHQUNsQixPQUFPLENBQUMsSUFBSSxDQUFDLENBUWYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_registry.d.ts","sourceRoot":"","sources":["../../src/local-network/auth_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
2
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
3
|
+
export async function publishStandardAuthRegistry(wallet, from, waitOpts) {
|
|
4
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
5
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
6
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
|
|
7
|
+
from,
|
|
8
|
+
wait: waitOpts
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
12
|
+
await publishInstance(wallet, instance).send({
|
|
13
|
+
from,
|
|
14
|
+
wait: waitOpts
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
3
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
export declare function getBananaCoinAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
|
|
6
7
|
export declare function getBananaFPCAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
|
|
7
|
-
export declare function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn): Promise<void>;
|
|
8
|
+
export declare function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn, waitOpts?: WaitOpts): Promise<void>;
|
|
8
9
|
export declare function registerDeployedBananaCoinInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
|
|
9
10
|
export declare function registerDeployedBananaFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFuYW5hX2ZwYy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvYmFuYW5hX2ZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBOEIsTUFBTSx5QkFBeUIsQ0FBQztBQUM5RixPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVyRCxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUduRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUF3QjNELHdCQUFzQixvQkFBb0IsQ0FBQyxlQUFlLEVBQUUsa0JBQWtCLEVBQUUseUJBRS9FO0FBV0Qsd0JBQXNCLG1CQUFtQixDQUFDLGVBQWUsRUFBRSxrQkFBa0IsRUFBRSx5QkFFOUU7QUFFRCx3QkFBc0IsY0FBYyxDQUNsQyxlQUFlLEVBQUUsa0JBQWtCLEVBQUUsRUFDckMsTUFBTSxFQUFFLE1BQU0sRUFDZCxHQUFHLEVBQUUsS0FBSyxFQUNWLFFBQVEsQ0FBQyxFQUFFLFFBQVEsaUJBaUJwQjtBQUVELHdCQUFzQiwrQ0FBK0MsQ0FBQyxNQUFNLEVBQUUsTUFBTSx5QkFNbkY7QUFFRCx3QkFBc0IsOENBQThDLENBQUMsTUFBTSxFQUFFLE1BQU0seUJBTWxGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/local-network/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAwB3D,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE/E;AAWD,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE9E;AAED,wBAAsB,cAAc,
|
|
1
|
+
{"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/local-network/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAwB3D,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE/E;AAWD,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE9E;AAED,wBAAsB,cAAc,CAClC,eAAe,EAAE,kBAAkB,EAAE,EACrC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,QAAQ,CAAC,EAAE,QAAQ,iBAiBpB;AAED,wBAAsB,+CAA+C,CAAC,MAAM,EAAE,MAAM,yBAMnF;AAED,wBAAsB,8CAA8C,CAAC,MAAM,EAAE,MAAM,yBAMlF"}
|
|
@@ -43,19 +43,23 @@ async function getBananaFPCInstance(initialAccounts) {
|
|
|
43
43
|
export async function getBananaFPCAddress(initialAccounts) {
|
|
44
44
|
return (await getBananaFPCInstance(initialAccounts)).address;
|
|
45
45
|
}
|
|
46
|
-
export async function setupBananaFPC(initialAccounts, wallet, log) {
|
|
46
|
+
export async function setupBananaFPC(initialAccounts, wallet, log, waitOpts) {
|
|
47
47
|
const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
|
|
48
48
|
const admin = getBananaAdmin(initialAccounts);
|
|
49
49
|
const [{ contract: bananaCoin }, { contract: fpc }] = await Promise.all([
|
|
50
|
-
TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal
|
|
51
|
-
|
|
52
|
-
contractAddressSalt: BANANA_COIN_SALT,
|
|
50
|
+
TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal, {
|
|
51
|
+
salt: BANANA_COIN_SALT,
|
|
53
52
|
universalDeploy: true
|
|
54
|
-
})
|
|
55
|
-
FPCContract.deploy(wallet, bananaCoinAddress, admin).send({
|
|
53
|
+
}).send({
|
|
56
54
|
from: admin,
|
|
57
|
-
|
|
55
|
+
wait: waitOpts
|
|
56
|
+
}),
|
|
57
|
+
FPCContract.deploy(wallet, bananaCoinAddress, admin, {
|
|
58
|
+
salt: BANANA_FPC_SALT,
|
|
58
59
|
universalDeploy: true
|
|
60
|
+
}).send({
|
|
61
|
+
from: admin,
|
|
62
|
+
wait: waitOpts
|
|
59
63
|
})
|
|
60
64
|
]);
|
|
61
65
|
log(`BananaCoin: ${bananaCoin.address}`);
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-warnings
|
|
2
|
-
import { AztecNodeService } from '@aztec/aztec-node';
|
|
3
2
|
import { type AztecNodeConfig } from '@aztec/aztec-node/config';
|
|
4
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
4
|
import { type BlobClientInterface } from '@aztec/blob-client/client';
|
|
6
|
-
import {
|
|
5
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
7
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
7
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
8
|
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import type {
|
|
9
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
10
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
12
|
-
import {
|
|
11
|
+
import type { Hex } from 'viem';
|
|
13
12
|
/**
|
|
14
13
|
* Function to deploy our L1 contracts to the local network L1
|
|
15
14
|
* @param aztecNodeConfig - The Aztec Node Config
|
|
@@ -18,30 +17,7 @@ import { type Hex } from 'viem';
|
|
|
18
17
|
export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, privateKey: Hex, opts?: {
|
|
19
18
|
genesisArchiveRoot?: Fr;
|
|
20
19
|
feeJuicePortalInitialBalance?: bigint;
|
|
21
|
-
}): Promise<
|
|
22
|
-
coinIssuerAddress: EthAddress;
|
|
23
|
-
feeJuiceAddress: EthAddress;
|
|
24
|
-
feeJuicePortalAddress: EthAddress;
|
|
25
|
-
governanceAddress: EthAddress;
|
|
26
|
-
governanceProposerAddress: EthAddress;
|
|
27
|
-
inboxAddress: EthAddress;
|
|
28
|
-
outboxAddress: EthAddress;
|
|
29
|
-
registryAddress: EthAddress;
|
|
30
|
-
rewardDistributorAddress: EthAddress;
|
|
31
|
-
rollupAddress: EthAddress;
|
|
32
|
-
stakingAssetAddress: EthAddress;
|
|
33
|
-
} & {
|
|
34
|
-
slashFactoryAddress?: EthAddress | undefined;
|
|
35
|
-
feeAssetHandlerAddress?: EthAddress | undefined;
|
|
36
|
-
stakingAssetHandlerAddress?: EthAddress | undefined;
|
|
37
|
-
zkPassportVerifierAddress?: EthAddress | undefined;
|
|
38
|
-
gseAddress?: EthAddress | undefined;
|
|
39
|
-
dateGatedRelayerAddress?: EthAddress | undefined;
|
|
40
|
-
} & {
|
|
41
|
-
rollupAddress: EthAddress;
|
|
42
|
-
} & Pick<import("@aztec/ethereum/l1-contract-addresses").L1ContractAddresses, "rollupAddress"> & {
|
|
43
|
-
rollupAddress: EthAddress;
|
|
44
|
-
}>;
|
|
20
|
+
}): Promise<L1ContractAddresses>;
|
|
45
21
|
/** Local network settings. */
|
|
46
22
|
export type LocalNetworkConfig = AztecNodeConfig & {
|
|
47
23
|
/** Mnemonic used to derive the L1 deployer private key.*/
|
|
@@ -55,7 +31,7 @@ export type LocalNetworkConfig = AztecNodeConfig & {
|
|
|
55
31
|
* @param config - Optional local network settings.
|
|
56
32
|
*/
|
|
57
33
|
export declare function createLocalNetwork(config: Partial<LocalNetworkConfig> | undefined, userLog: LogFn): Promise<{
|
|
58
|
-
node: AztecNodeService;
|
|
34
|
+
node: import("@aztec/aztec-node").AztecNodeService;
|
|
59
35
|
stop: () => Promise<void>;
|
|
60
36
|
}>;
|
|
61
37
|
/**
|
|
@@ -68,6 +44,6 @@ export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?
|
|
|
68
44
|
dateProvider?: DateProvider;
|
|
69
45
|
proverBroker?: ProvingJobBroker;
|
|
70
46
|
}, options?: {
|
|
71
|
-
|
|
72
|
-
}): Promise<AztecNodeService>;
|
|
73
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
47
|
+
genesis?: GenesisData;
|
|
48
|
+
}): Promise<import("@aztec/aztec-node").AztecNodeService>;
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsIn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CLEdBQUcsZUFBZSxHQUFHO0lBQ2pELDBEQUEwRDtJQUMxRCxVQUFVLEVBQUUsTUFBTSxDQUFDO0lBQ25CLDZEQUE2RDtJQUM3RCxZQUFZLEVBQUUsT0FBTyxDQUFDO0NBQ3ZCLENBQUM7QUFFRjs7OztHQUlHO0FBQ0gsd0JBQXNCLGtCQUFrQixDQUFDLE1BQU0seUNBQWtDLEVBQUUsT0FBTyxFQUFFLEtBQUs7OztHQTRIaEc7QUFFRDs7O0dBR0c7QUFDSCx3QkFBc0IsZUFBZSxDQUNuQyxNQUFNLEdBQUUsT0FBTyxDQUFDLGVBQWUsQ0FBTSxFQUNyQyxJQUFJLEdBQUU7SUFDSixTQUFTLENBQUMsRUFBRSxlQUFlLENBQUM7SUFDNUIsVUFBVSxDQUFDLEVBQUUsbUJBQW1CLENBQUM7SUFDakMsWUFBWSxDQUFDLEVBQUUsWUFBWSxDQUFDO0lBQzVCLFlBQVksQ0FBQyxFQUFFLGdCQUFnQixDQUFDO0NBQzVCLEVBQ04sT0FBTyxHQUFFO0lBQUUsT0FBTyxDQUFDLEVBQUUsV0FBVyxDQUFBO0NBQU8seURBY3hDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-network.d.ts","sourceRoot":"","sources":["../../src/local-network/local-network.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"local-network.d.ts","sourceRoot":"","sources":["../../src/local-network/local-network.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,2BAA2B,CAAC;AAMvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAoB,M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