@aztec/aztec 0.0.1-commit.db765a8 → 0.0.1-commit.df81a97b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/index.js +2 -2
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +16 -7
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +2 -3
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +7 -1
- package/dest/cli/cmds/profile_flamegraph.d.ts +1 -1
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -1
- package/dest/cli/cmds/profile_flamegraph.js +2 -1
- package/dest/cli/cmds/profile_gates.d.ts +1 -1
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +2 -1
- package/dest/cli/cmds/standby.d.ts +32 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_archiver.d.ts +2 -2
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +1 -1
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +19 -71
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +12 -6
- package/dest/cli/cmds/utils/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 +134 -0
- package/dest/cli/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -78
- package/dest/local-network/local-network.d.ts +1 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +9 -1
- package/dest/testing/anvil_test_watcher.js +1 -1
- package/dest/testing/cheat_codes.js +1 -1
- package/dest/testing/epoch_test_settler.d.ts +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +3 -4
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +34 -34
- package/scripts/aztec.sh +3 -0
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +11 -7
- package/src/cli/aztec_start_options.ts +2 -3
- package/src/cli/cmds/compile.ts +8 -1
- package/src/cli/cmds/profile_flamegraph.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +2 -1
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_archiver.ts +1 -1
- package/src/cli/cmds/start_node.ts +24 -102
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/cmds/utils/needs_recompile.ts +151 -0
- package/src/cli/util.ts +41 -74
- package/src/local-network/local-network.ts +6 -0
- package/src/testing/anvil_test_watcher.ts +1 -1
- package/src/testing/cheat_codes.ts +1 -1
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/src/cli/release_version.ts +0 -21
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import TOML from '@iarna/toml';
|
|
2
|
+
import { readFile, readdir, stat } from 'fs/promises';
|
|
3
|
+
import { join, resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
7
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
8
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
9
|
+
* a recompile.
|
|
10
|
+
*
|
|
11
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
12
|
+
*/
|
|
13
|
+
export async function needsRecompile(): Promise<boolean> {
|
|
14
|
+
const oldestArtifactMs = await getOldestArtifactModificationTime('target');
|
|
15
|
+
if (oldestArtifactMs === undefined) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const crateDirs = await collectCrateDirs('.');
|
|
20
|
+
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the last modification time (timestamp in ms) of the oldest .json artifact in targetDir, or undefined if
|
|
25
|
+
* none exist.
|
|
26
|
+
*/
|
|
27
|
+
async function getOldestArtifactModificationTime(targetDir: string): Promise<number | undefined> {
|
|
28
|
+
let entries: string[];
|
|
29
|
+
try {
|
|
30
|
+
entries = (await readdir(targetDir)).filter(f => f.endsWith('.json'));
|
|
31
|
+
} catch (err: any) {
|
|
32
|
+
if (err?.code === 'ENOENT') {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (entries.length === 0) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let oldest = Infinity;
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
const s = await stat(join(targetDir, entry));
|
|
45
|
+
if (s.mtimeMs < oldest) {
|
|
46
|
+
oldest = s.mtimeMs;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return oldest;
|
|
50
|
+
}
|
|
51
|
+
|
|
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
|
+
const parsed = TOML.parse(content) as Record<string, any>;
|
|
77
|
+
|
|
78
|
+
const members = (parsed.workspace as Record<string, any>)?.members as string[] | undefined;
|
|
79
|
+
|
|
80
|
+
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
81
|
+
if (Array.isArray(members)) {
|
|
82
|
+
// The crate is a workspace root and has members defined so we visit the members
|
|
83
|
+
for (const member of members) {
|
|
84
|
+
const memberPath = resolve(absDir, member);
|
|
85
|
+
await visit(memberPath);
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
// The crate is not a workspace root so we check for dependencies
|
|
89
|
+
const deps = (parsed.dependencies as Record<string, any>) ?? {};
|
|
90
|
+
for (const dep of Object.values(deps)) {
|
|
91
|
+
if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
|
|
92
|
+
const depPath = resolve(absDir, dep.path);
|
|
93
|
+
const s = await stat(depPath);
|
|
94
|
+
if (!s.isDirectory()) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
await visit(depPath);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await visit(startCrateDir);
|
|
106
|
+
return [...visited];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
111
|
+
*/
|
|
112
|
+
async function hasNewerSourceFile(crateDirs: string[], thresholdMs: number): Promise<boolean> {
|
|
113
|
+
// Returns true if it find a new file than thresholdMs, false otherwise
|
|
114
|
+
async function walkForNewer(dir: string): Promise<boolean> {
|
|
115
|
+
let entries;
|
|
116
|
+
try {
|
|
117
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
118
|
+
} catch {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// We iterate over the entries in the dir
|
|
123
|
+
for (const entry of entries) {
|
|
124
|
+
const fullPath = join(dir, entry.name);
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
// If the entry is a dir and it's not called `target` we recursively enter it
|
|
127
|
+
if (entry.name === 'target') {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (await walkForNewer(fullPath)) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
} else if (entry.name === 'Nargo.toml' || entry.name.endsWith('.nr')) {
|
|
134
|
+
// The entry is a Nargo.toml file or *.nr file so we check the timestamp
|
|
135
|
+
const s = await stat(fullPath);
|
|
136
|
+
if (s.mtimeMs > thresholdMs) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// We search through the crate dirs
|
|
145
|
+
for (const dir of crateDirs) {
|
|
146
|
+
if (await walkForNewer(dir)) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
package/src/cli/util.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
2
|
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import { getNetworkConfig } from '@aztec/cli/config';
|
|
4
|
+
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
3
5
|
import type { ViemClient } from '@aztec/ethereum/types';
|
|
4
|
-
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
5
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
+
import type { ConfigMappingsType, NetworkNames } from '@aztec/foundation/config';
|
|
6
7
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
7
8
|
import { type LogFn, createLogger } from '@aztec/foundation/log';
|
|
8
|
-
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
9
9
|
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import {
|
|
10
|
+
import { type VersionCheck, getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
11
11
|
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
12
12
|
|
|
13
13
|
import chalk from 'chalk';
|
|
14
14
|
import type { Command } from 'commander';
|
|
15
|
+
import type { Hex } from 'viem';
|
|
15
16
|
|
|
16
17
|
import { type AztecStartOption, aztecStartOptions } from './aztec_start_options.js';
|
|
17
18
|
|
|
@@ -290,92 +291,58 @@ export async function preloadCrsDataForServerSideProving(
|
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
293
|
|
|
293
|
-
export async function
|
|
294
|
-
|
|
295
|
-
updatesLocation: URL,
|
|
294
|
+
export async function setupVersionChecker(
|
|
295
|
+
network: NetworkNames,
|
|
296
296
|
followsCanonicalRollup: boolean,
|
|
297
297
|
publicClient: ViemClient,
|
|
298
|
-
registryContractAddress: EthAddress,
|
|
299
298
|
signalHandlers: Array<() => Promise<void>>,
|
|
300
|
-
|
|
301
|
-
) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
publicClient,
|
|
307
|
-
registryContractAddress,
|
|
308
|
-
});
|
|
299
|
+
cacheDir?: string,
|
|
300
|
+
): Promise<void> {
|
|
301
|
+
const networkConfig = await getNetworkConfig(network, cacheDir);
|
|
302
|
+
if (!networkConfig) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
309
305
|
|
|
310
|
-
|
|
311
|
-
checker.on('newRollupVersion', async ({ latestVersion, currentVersion }) => {
|
|
312
|
-
if (isShuttingDown()) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
306
|
+
const { VersionChecker } = await import('@aztec/stdlib/update-checker');
|
|
315
307
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
308
|
+
const logger = createLogger('version_check');
|
|
309
|
+
const registry = new RegistryContract(publicClient, networkConfig.registryAddress as Hex);
|
|
320
310
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
311
|
+
const checks: Array<VersionCheck> = [];
|
|
312
|
+
checks.push({
|
|
313
|
+
name: 'node',
|
|
314
|
+
currentVersion: getPackageVersion() ?? 'unknown',
|
|
315
|
+
getLatestVersion: async () => {
|
|
316
|
+
const cfg = await getNetworkConfig(network, cacheDir);
|
|
317
|
+
return cfg?.nodeVersion;
|
|
318
|
+
},
|
|
327
319
|
});
|
|
328
320
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
321
|
+
if (followsCanonicalRollup) {
|
|
322
|
+
const getLatestVersion = async () => {
|
|
323
|
+
const version = (await registry.getRollupVersions()).at(-1);
|
|
324
|
+
return version !== undefined ? String(version) : undefined;
|
|
325
|
+
};
|
|
326
|
+
const currentVersion = await getLatestVersion();
|
|
327
|
+
if (currentVersion !== undefined) {
|
|
328
|
+
checks.push({
|
|
329
|
+
name: 'rollup',
|
|
330
|
+
currentVersion,
|
|
331
|
+
getLatestVersion,
|
|
332
|
+
});
|
|
339
333
|
}
|
|
340
|
-
}
|
|
334
|
+
}
|
|
341
335
|
|
|
342
|
-
|
|
343
|
-
checker.on('
|
|
336
|
+
const checker = new VersionChecker(checks, 600_000, logger);
|
|
337
|
+
checker.on('newVersion', ({ name, latestVersion, currentVersion }) => {
|
|
344
338
|
if (isShuttingDown()) {
|
|
345
339
|
return;
|
|
346
340
|
}
|
|
347
341
|
|
|
348
|
-
|
|
349
|
-
logger.warn(`Config change detected. Updating node`, config);
|
|
350
|
-
try {
|
|
351
|
-
await updateNodeConfig(config);
|
|
352
|
-
} catch (err) {
|
|
353
|
-
logger.warn('Failed to update config', { err });
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
// don't notify on these config changes
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
checker.on('updatePublicTelemetryConfig', config => {
|
|
360
|
-
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
361
|
-
logger.warn(`Public telemetry config change detected. Updating telemetry client`, config);
|
|
362
|
-
try {
|
|
363
|
-
const publicIncludeMetrics: unknown = (config as any).publicIncludeMetrics;
|
|
364
|
-
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every(m => typeof m === 'string')) {
|
|
365
|
-
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
366
|
-
}
|
|
367
|
-
const publicMetricsCollectFrom: unknown = (config as any).publicMetricsCollectFrom;
|
|
368
|
-
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every(m => typeof m === 'string')) {
|
|
369
|
-
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
370
|
-
}
|
|
371
|
-
} catch (err) {
|
|
372
|
-
logger.warn('Failed to update config', { err });
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
// don't notify on these config changes
|
|
342
|
+
logger.warn(`New ${name} version available`, { latestVersion, currentVersion });
|
|
376
343
|
});
|
|
377
|
-
|
|
378
344
|
checker.start();
|
|
345
|
+
signalHandlers.push(() => checker.stop());
|
|
379
346
|
}
|
|
380
347
|
|
|
381
348
|
export function stringifyConfig(config: object): string {
|
|
@@ -39,6 +39,7 @@ import { createAccountLogs } from '../cli/util.js';
|
|
|
39
39
|
import { DefaultMnemonic } from '../mnemonic.js';
|
|
40
40
|
import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
|
|
41
41
|
import { EpochTestSettler } from '../testing/epoch_test_settler.js';
|
|
42
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
42
43
|
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
43
44
|
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
44
45
|
|
|
@@ -102,9 +103,14 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
102
103
|
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
// The local network deploys a banana FPC with Token contracts, so include Token entries
|
|
107
|
+
// in the setup allowlist so FPC-based fee payments work out of the box.
|
|
108
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
109
|
+
|
|
105
110
|
const aztecNodeConfig: AztecNodeConfig = {
|
|
106
111
|
...getConfigEnvVars(),
|
|
107
112
|
...config,
|
|
113
|
+
txPublicSetupAllowListExtend: [...tokenAllowList, ...(config.txPublicSetupAllowListExtend ?? [])],
|
|
108
114
|
};
|
|
109
115
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
110
116
|
if (
|
|
@@ -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}`);
|
package/src/testing/index.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
|
2
2
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
4
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
5
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
2
|
+
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
4
|
+
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns Token-specific allowlist entries needed for FPC-based fee payments.
|
|
8
|
+
* These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
9
|
+
*/
|
|
10
|
+
export async function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]> {
|
|
11
|
+
const tokenClassId = (await getContractClassFromArtifact(TokenContractArtifact)).id;
|
|
12
|
+
const target = { classId: tokenClassId };
|
|
13
|
+
return Promise.all([
|
|
14
|
+
// Token: needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
15
|
+
buildAllowedElement(TokenContractArtifact, target, '_increase_public_balance', { onlySelf: true }),
|
|
16
|
+
// Token: needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
17
|
+
buildAllowedElement(TokenContractArtifact, target, 'transfer_in_public'),
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const getCliVersion: () => any;
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVsZWFzZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL3JlbGVhc2VfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxlQUFPLE1BQU0sYUFBYSxXQWV6QixDQUFDIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release_version.d.ts","sourceRoot":"","sources":["../../src/cli/release_version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,WAezB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { dirname, resolve } from 'path';
|
|
4
|
-
export const getCliVersion = ()=>{
|
|
5
|
-
const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
6
|
-
const cliVersion = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
7
|
-
// If the version is 0.1.0, this is a placeholder version and we are in a docker container; query release please for the latest version
|
|
8
|
-
if (cliVersion === '0.1.0') {
|
|
9
|
-
const releasePleasePath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
|
|
10
|
-
const releaseVersion = JSON.parse(readFileSync(releasePleasePath).toString())['.'];
|
|
11
|
-
return releaseVersion;
|
|
12
|
-
}
|
|
13
|
-
return cliVersion;
|
|
14
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
-
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
|
-
import { dirname, resolve } from 'path';
|
|
5
|
-
|
|
6
|
-
export const getCliVersion = () => {
|
|
7
|
-
const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
8
|
-
const cliVersion: string = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
9
|
-
|
|
10
|
-
// If the version is 0.1.0, this is a placeholder version and we are in a docker container; query release please for the latest version
|
|
11
|
-
if (cliVersion === '0.1.0') {
|
|
12
|
-
const releasePleasePath = resolve(
|
|
13
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
14
|
-
'../../../../.release-please-manifest.json',
|
|
15
|
-
);
|
|
16
|
-
const releaseVersion = JSON.parse(readFileSync(releasePleasePath).toString())['.'];
|
|
17
|
-
return releaseVersion;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return cliVersion;
|
|
21
|
-
};
|