@aztec/aztec 0.0.1-commit.2c85e299c → 0.0.1-commit.2d9cb6034
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/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 +12 -5
- 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 +4 -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 +10 -5
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +33 -14
- 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 +7 -1
- 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 +7 -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 +41 -0
- 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/package.json +33 -34
- package/scripts/aztec.sh +1 -1
- package/src/cli/aztec_start_action.ts +7 -5
- package/src/cli/cmds/compile.ts +5 -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 +37 -16
- package/src/cli/cmds/start_node.ts +8 -1
- package/src/cli/cmds/start_prover_broker.ts +8 -1
- 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 +54 -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
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
@@ -16,7 +17,10 @@ export async function needsRecompile(): Promise<boolean> {
|
|
|
16
17
|
return true;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
// Git deps are pinned to a specific tag in Nargo.toml and nargo always fetches an exact tag, so their contents never
|
|
21
|
+
// change without Nargo.toml itself changing — and Nargo.toml is already tracked as a source file. Hence we can
|
|
22
|
+
// safely ignore checking source files of git deps.
|
|
23
|
+
const crateDirs = await collectCrateDirs('.', { skipGitDeps: true });
|
|
20
24
|
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -49,51 +53,6 @@ async function getOldestArtifactModificationTime(targetDir: string): Promise<num
|
|
|
49
53
|
return oldest;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
/**
|
|
53
|
-
* Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
|
|
54
|
-
* Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
|
|
55
|
-
* tagged).
|
|
56
|
-
*/
|
|
57
|
-
async function collectCrateDirs(startCrateDir: string): Promise<string[]> {
|
|
58
|
-
// We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
|
|
59
|
-
// multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
|
|
60
|
-
const visited = new Set<string>();
|
|
61
|
-
|
|
62
|
-
async function visit(crateDir: string): Promise<void> {
|
|
63
|
-
const absDir = resolve(crateDir);
|
|
64
|
-
if (visited.has(absDir)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
visited.add(absDir);
|
|
68
|
-
|
|
69
|
-
// 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
|
|
70
|
-
// error out if it's not the case.
|
|
71
|
-
const tomlPath = join(absDir, 'Nargo.toml');
|
|
72
|
-
const content = await readFile(tomlPath, 'utf-8').catch(() => {
|
|
73
|
-
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// We parse and iterate over the dependencies
|
|
77
|
-
const parsed = TOML.parse(content) as Record<string, any>;
|
|
78
|
-
const deps = (parsed.dependencies as Record<string, any>) ?? {};
|
|
79
|
-
for (const dep of Object.values(deps)) {
|
|
80
|
-
if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
|
|
81
|
-
const depPath = resolve(absDir, dep.path);
|
|
82
|
-
const s = await stat(depPath);
|
|
83
|
-
if (!s.isDirectory()) {
|
|
84
|
-
throw new Error(
|
|
85
|
-
`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
await visit(depPath);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
await visit(startCrateDir);
|
|
94
|
-
return [...visited];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
56
|
/**
|
|
98
57
|
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
99
58
|
*/
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
3
|
+
|
|
4
|
+
import TOML from '@iarna/toml';
|
|
5
|
+
import { readFile } from 'fs/promises';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
9
|
+
|
|
10
|
+
/** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */
|
|
11
|
+
export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void> {
|
|
12
|
+
const version = cliVersion ?? getPackageVersion();
|
|
13
|
+
if (!version) {
|
|
14
|
+
log(`WARNING: aztec CLI version not found. Skipping dependency compatibility check.`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const expectedTag = `v${version}`;
|
|
19
|
+
const mismatches: { file: string; tag: string }[] = [];
|
|
20
|
+
|
|
21
|
+
const crateDirs = await collectCrateDirs('.', { skipGitDeps: true });
|
|
22
|
+
|
|
23
|
+
for (const dir of crateDirs) {
|
|
24
|
+
const tomlPath = join(dir, 'Nargo.toml');
|
|
25
|
+
let content: string;
|
|
26
|
+
try {
|
|
27
|
+
content = await readFile(tomlPath, 'utf-8');
|
|
28
|
+
} catch {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const parsed = TOML.parse(content) as Record<string, any>;
|
|
33
|
+
const aztecDep = (parsed.dependencies as Record<string, any>)?.aztec;
|
|
34
|
+
if (!aztecDep || typeof aztecDep !== 'object' || typeof aztecDep.tag !== 'string') {
|
|
35
|
+
// If a dep called "aztec" doesn't exist or it does not get parsed to an object or it doesn't have a tag defined
|
|
36
|
+
// we skip the check.
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (aztecDep.tag !== expectedTag) {
|
|
41
|
+
mismatches.push({ file: tomlPath, tag: aztecDep.tag });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (mismatches.length > 0) {
|
|
46
|
+
const details = mismatches.map(m => ` ${m.file} (${m.tag})`).join('\n');
|
|
47
|
+
log(
|
|
48
|
+
`WARNING: Aztec dependency version mismatch detected.\n` +
|
|
49
|
+
`The following crates have an aztec dependency that does not match the CLI version (${expectedTag}):\n` +
|
|
50
|
+
`${details}\n\n` +
|
|
51
|
+
`See https://docs.aztec.network/errors/9 for how to update your dependencies.`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -130,7 +130,7 @@ export class AnvilTestWatcher {
|
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
const l1Time = (await this.cheatcodes.
|
|
133
|
+
const l1Time = (await this.cheatcodes.lastBlockTimestamp()) * 1000;
|
|
134
134
|
const wallTime = this.dateProvider.now();
|
|
135
135
|
if (l1Time > wallTime) {
|
|
136
136
|
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
@@ -72,7 +72,7 @@ export class CheatCodes {
|
|
|
72
72
|
* @param duration - The duration to advance time by (in seconds)
|
|
73
73
|
*/
|
|
74
74
|
async warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number) {
|
|
75
|
-
const currentTimestamp = await this.eth.
|
|
75
|
+
const currentTimestamp = await this.eth.lastBlockTimestamp();
|
|
76
76
|
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
77
77
|
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
78
78
|
}
|
|
@@ -4,7 +4,7 @@ import { type EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
4
4
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
5
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
6
6
|
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
-
import {
|
|
7
|
+
import { computeEpochOutHash } from '@aztec/stdlib/messaging';
|
|
8
8
|
|
|
9
9
|
export class EpochTestSettler {
|
|
10
10
|
private rollupCheatCodes: RollupCheatCodes;
|
|
@@ -51,9 +51,8 @@ export class EpochTestSettler {
|
|
|
51
51
|
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
|
|
54
|
+
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
55
|
+
if (!outHash.isZero()) {
|
|
57
56
|
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
58
57
|
} else {
|
|
59
58
|
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|