@aztec/aztec 0.0.1-commit.f504929 → 0.0.1-commit.f81dbcf
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 +11 -6
- 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 +1 -2
- package/dest/cli/cli.js +3 -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 +0 -92
- 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_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/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +40 -81
- 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/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 +2 -1
- package/scripts/init.sh +19 -23
- package/scripts/new.sh +24 -48
- package/scripts/setup_project.sh +31 -0
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +9 -6
- package/src/cli/aztec_start_options.ts +1 -2
- package/src/cli/cli.ts +3 -3
- package/src/cli/cmds/compile.ts +0 -104
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_node.ts +24 -102
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/util.ts +43 -76
- package/src/local-network/local-network.ts +6 -0
- 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/scripts/add_crate.sh +0 -102
- package/scripts/setup_workspace.sh +0 -68
- package/src/cli/release_version.ts +0 -21
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
|
|
|
@@ -271,7 +272,7 @@ export async function preloadCrsDataForVerifying(
|
|
|
271
272
|
): Promise<void> {
|
|
272
273
|
if (realProofs) {
|
|
273
274
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
274
|
-
await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16, undefined, log)]);
|
|
275
|
+
await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16 + 1, undefined, log)]);
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
278
|
|
|
@@ -286,96 +287,62 @@ export async function preloadCrsDataForServerSideProving(
|
|
|
286
287
|
): Promise<void> {
|
|
287
288
|
if (realProofs) {
|
|
288
289
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
289
|
-
await Promise.all([Crs.new(2 ** 25, undefined, log), GrumpkinCrs.new(2 ** 18, undefined, log)]);
|
|
290
|
+
await Promise.all([Crs.new(2 ** 25 + 1, undefined, log), GrumpkinCrs.new(2 ** 18 + 1, undefined, log)]);
|
|
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 (
|
|
@@ -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
|
-
};
|
package/scripts/add_crate.sh
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# Creates a contract+test crate pair and adds them to an existing workspace.
|
|
5
|
-
# Usage: add_crate.sh <crate_name>
|
|
6
|
-
# Must be called from a workspace root that already has Nargo.toml with [workspace].
|
|
7
|
-
|
|
8
|
-
crate_name=$1
|
|
9
|
-
|
|
10
|
-
if [ -z "$crate_name" ]; then
|
|
11
|
-
echo "Error: crate name is required"
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
if [[ "$crate_name" == *"/"* ]] || [[ "$crate_name" == *"\\"* ]]; then
|
|
16
|
-
echo "Error: crate name must not contain path separators"
|
|
17
|
-
exit 1
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
contract_dir="${crate_name}_contract"
|
|
21
|
-
test_dir="${crate_name}_test"
|
|
22
|
-
|
|
23
|
-
if [ -d "$contract_dir" ]; then
|
|
24
|
-
echo "Error: directory '$contract_dir' already exists"
|
|
25
|
-
exit 1
|
|
26
|
-
fi
|
|
27
|
-
if [ -d "$test_dir" ]; then
|
|
28
|
-
echo "Error: directory '$test_dir' already exists"
|
|
29
|
-
exit 1
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
# Get the actual aztec version for the git tag.
|
|
33
|
-
AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
|
|
34
|
-
|
|
35
|
-
# Create contract crate
|
|
36
|
-
mkdir -p "$contract_dir/src"
|
|
37
|
-
cat > "$contract_dir/Nargo.toml" << CEOF
|
|
38
|
-
[package]
|
|
39
|
-
name = "${crate_name}_contract"
|
|
40
|
-
type = "contract"
|
|
41
|
-
|
|
42
|
-
[dependencies]
|
|
43
|
-
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v${AZTEC_VERSION}", directory="aztec" }
|
|
44
|
-
CEOF
|
|
45
|
-
|
|
46
|
-
cat > "$contract_dir/src/main.nr" << 'EOF'
|
|
47
|
-
use aztec::macros::aztec;
|
|
48
|
-
|
|
49
|
-
#[aztec]
|
|
50
|
-
pub contract Main {
|
|
51
|
-
use aztec::macros::functions::{external, initializer};
|
|
52
|
-
|
|
53
|
-
#[initializer]
|
|
54
|
-
#[external("private")]
|
|
55
|
-
fn constructor() {}
|
|
56
|
-
}
|
|
57
|
-
EOF
|
|
58
|
-
|
|
59
|
-
# Create test crate
|
|
60
|
-
mkdir -p "$test_dir/src"
|
|
61
|
-
cat > "$test_dir/Nargo.toml" << TEOF
|
|
62
|
-
[package]
|
|
63
|
-
name = "${crate_name}_test"
|
|
64
|
-
type = "lib"
|
|
65
|
-
|
|
66
|
-
[dependencies]
|
|
67
|
-
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v${AZTEC_VERSION}", directory="aztec" }
|
|
68
|
-
${crate_name}_contract = { path = "../${contract_dir}" }
|
|
69
|
-
TEOF
|
|
70
|
-
|
|
71
|
-
cat > "$test_dir/src/lib.nr" << 'NOIR'
|
|
72
|
-
use aztec::test::helpers::test_environment::TestEnvironment;
|
|
73
|
-
use __CRATE_NAME___contract::Main;
|
|
74
|
-
|
|
75
|
-
#[test]
|
|
76
|
-
unconstrained fn test_constructor() {
|
|
77
|
-
let mut env = TestEnvironment::new();
|
|
78
|
-
let deployer = env.create_light_account();
|
|
79
|
-
|
|
80
|
-
// Deploy the contract with the default constructor:
|
|
81
|
-
let contract_address = env.deploy("@__CRATE_NAME___contract/Main").with_private_initializer(
|
|
82
|
-
deployer,
|
|
83
|
-
Main::interface().constructor(),
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// Deploy without an initializer:
|
|
87
|
-
let contract_address = env.deploy("@__CRATE_NAME___contract/Main").without_initializer();
|
|
88
|
-
}
|
|
89
|
-
NOIR
|
|
90
|
-
|
|
91
|
-
sed -i "s/__CRATE_NAME__/${crate_name}/g" "$test_dir/src/lib.nr"
|
|
92
|
-
|
|
93
|
-
# Add members to workspace Nargo.toml
|
|
94
|
-
if grep -q 'members\s*=\s*\[\s*\]' Nargo.toml; then
|
|
95
|
-
# Empty array: members = []
|
|
96
|
-
sed -i "s|members\s*=\s*\[\s*\]|members = [\"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml
|
|
97
|
-
else
|
|
98
|
-
# Non-empty array: add before closing ]
|
|
99
|
-
sed -i "s|\(members\s*=\s*\[.*\)\]|\1, \"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
echo "Created crates '${contract_dir}' and '${test_dir}'"
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# Creates an Aztec contract workspace with a contract crate and a test crate.
|
|
5
|
-
# Usage: setup_workspace.sh <package_name>
|
|
6
|
-
# Must be called from the workspace root directory.
|
|
7
|
-
|
|
8
|
-
package_name=$1
|
|
9
|
-
script_path=$(realpath $(dirname "$0"))
|
|
10
|
-
|
|
11
|
-
if [ -z "$package_name" ]; then
|
|
12
|
-
echo "Error: package name is required"
|
|
13
|
-
exit 1
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
if [ -f "Nargo.toml" ]; then
|
|
17
|
-
echo "Error: Nargo.toml already exists in the current directory."
|
|
18
|
-
echo "To add another contract crate to this workspace, use 'aztec new <name>' instead."
|
|
19
|
-
exit 1
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
# Create workspace root Nargo.toml with empty members (add_crate.sh will populate)
|
|
23
|
-
cat > Nargo.toml << 'EOF'
|
|
24
|
-
[workspace]
|
|
25
|
-
members = []
|
|
26
|
-
EOF
|
|
27
|
-
|
|
28
|
-
# Create the first crate pair
|
|
29
|
-
$script_path/add_crate.sh "$package_name"
|
|
30
|
-
|
|
31
|
-
# Create README
|
|
32
|
-
cat > README.md << REOF
|
|
33
|
-
# ${package_name}
|
|
34
|
-
|
|
35
|
-
An Aztec Noir contract project.
|
|
36
|
-
|
|
37
|
-
## Compile
|
|
38
|
-
|
|
39
|
-
\`\`\`bash
|
|
40
|
-
aztec compile
|
|
41
|
-
\`\`\`
|
|
42
|
-
|
|
43
|
-
This compiles all contract crates and outputs artifacts to \`target/\`.
|
|
44
|
-
|
|
45
|
-
## Test
|
|
46
|
-
|
|
47
|
-
\`\`\`bash
|
|
48
|
-
aztec test
|
|
49
|
-
\`\`\`
|
|
50
|
-
|
|
51
|
-
This runs all tests in the workspace.
|
|
52
|
-
|
|
53
|
-
## Generate TypeScript bindings
|
|
54
|
-
|
|
55
|
-
\`\`\`bash
|
|
56
|
-
aztec codegen target -o src/artifacts
|
|
57
|
-
\`\`\`
|
|
58
|
-
|
|
59
|
-
This generates TypeScript contract artifacts from the compiled output in \`target/\` into \`src/artifacts/\`.
|
|
60
|
-
REOF
|
|
61
|
-
|
|
62
|
-
# Create .gitignore
|
|
63
|
-
cat > .gitignore << 'GEOF'
|
|
64
|
-
target/
|
|
65
|
-
codegenCache.json
|
|
66
|
-
GEOF
|
|
67
|
-
|
|
68
|
-
echo "Created Aztec contract workspace with crates '${package_name}_contract' and '${package_name}_test'"
|
|
@@ -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
|
-
};
|