@aztec/aztec 5.0.0-private.20260319 → 5.0.0-rc.2
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 +16 -24
- 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 +32 -24
- 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_gates.d.ts +2 -2
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +21 -3
- 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 +30 -6
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +48 -5
- 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 +22 -47
- 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 +11 -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 -53
- 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 +25 -52
- 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 +48 -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 -25
- 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 -33
- 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 +14 -17
- package/src/cli/aztec_start_options.ts +22 -23
- package/src/cli/cmds/compile.ts +37 -23
- package/src/cli/cmds/profile.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +20 -4
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +59 -7
- package/src/cli/cmds/start_bot.ts +9 -6
- package/src/cli/cmds/start_node.ts +29 -39
- package/src/cli/cmds/start_prover_agent.ts +5 -8
- package/src/cli/cmds/start_prover_broker.ts +10 -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 -61
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/util.ts +26 -67
- 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 +52 -83
- package/src/testing/cheat_codes.ts +18 -49
- package/src/testing/epoch_test_settler.ts +8 -31
- 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
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import type {
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @deprecated
|
|
8
|
-
* they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
|
|
9
|
-
* codes, please consider whether it makes sense to just introduce new utils in your tests instead.
|
|
5
|
+
* Wrapper for Aztec Debug API.
|
|
6
|
+
* @deprecated use the AztecNode debug API directly.
|
|
10
7
|
*/
|
|
11
8
|
export declare class CheatCodes {
|
|
12
9
|
/** Cheat codes for L1.*/
|
|
@@ -20,24 +17,21 @@ export declare class CheatCodes {
|
|
|
20
17
|
rollup: RollupCheatCodes);
|
|
21
18
|
static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
|
|
22
19
|
/**
|
|
23
|
-
* Warps the L1 timestamp to
|
|
24
|
-
* the target
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
28
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
29
|
-
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
20
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
21
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
22
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
23
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
24
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
30
25
|
*/
|
|
31
|
-
warpL2TimeAtLeastTo(
|
|
26
|
+
warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
|
|
32
27
|
/**
|
|
33
|
-
* Warps the L1 timestamp forward by
|
|
34
|
-
* least by the duration.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param
|
|
38
|
-
* @
|
|
39
|
-
* @param duration - The duration to advance time by (in seconds)
|
|
28
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
29
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
30
|
+
* queue.
|
|
31
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
32
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
33
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
40
34
|
*/
|
|
41
|
-
warpL2TimeAtLeastBy(
|
|
35
|
+
warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void>;
|
|
42
36
|
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsY0FBYyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakY7OztHQUdHO0FBQ0gscUJBQWEsVUFBVTtJQUVuQix5QkFBeUI7SUFDbEIsR0FBRyxFQUFFLGFBQWE7SUFDekIsdURBQXVEO0lBQ2hELE1BQU0sRUFBRSxnQkFBZ0I7SUFKakM7SUFDRSx5QkFBeUI7SUFDbEIsR0FBRyxFQUFFLGFBQWE7SUFDekIsdURBQXVEO0lBQ2hELE1BQU0sRUFBRSxnQkFBZ0IsRUFDN0I7SUFFSixPQUFhLE1BQU0sQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUUsSUFBSSxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FPdkc7SUFFRDs7Ozs7O09BTUc7SUFDSCxtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsU0FBUyxHQUFHLGNBQWMsRUFBRSxlQUFlLEVBQUUsTUFBTSxHQUFHLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRXJHO0lBRUQ7Ozs7Ozs7T0FPRztJQUNILG1CQUFtQixDQUFDLElBQUksRUFBRSxTQUFTLEdBQUcsY0FBYyxFQUFFLFFBQVEsRUFBRSxNQUFNLEdBQUcsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFOUY7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;GAGG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IAJjC;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErG;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F;CACF"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @deprecated
|
|
6
|
-
* they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
|
|
7
|
-
* codes, please consider whether it makes sense to just introduce new utils in your tests instead.
|
|
3
|
+
* Wrapper for Aztec Debug API.
|
|
4
|
+
* @deprecated use the AztecNode debug API directly.
|
|
8
5
|
*/ export class CheatCodes {
|
|
9
6
|
eth;
|
|
10
7
|
rollup;
|
|
@@ -18,45 +15,22 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
18
15
|
return new CheatCodes(ethCheatCodes, rollupCheatCodes);
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
|
-
* Warps the L1 timestamp to
|
|
22
|
-
* the target
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
|
|
29
|
-
const currentL2BlockNumber = await node.getBlockNumber();
|
|
30
|
-
// We warp the L1 timestamp
|
|
31
|
-
await this.eth.warp(targetTimestamp, {
|
|
32
|
-
resetBlockInterval: true
|
|
33
|
-
});
|
|
34
|
-
// Wait until an L2 block is mined
|
|
35
|
-
const sequencer = sequencerClient.getSequencer();
|
|
36
|
-
const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
|
|
37
|
-
sequencer.updateConfig({
|
|
38
|
-
minTxsPerBlock: 0
|
|
39
|
-
});
|
|
40
|
-
await retryUntil(async ()=>{
|
|
41
|
-
const newL2BlockNumber = await node.getBlockNumber();
|
|
42
|
-
return newL2BlockNumber > currentL2BlockNumber;
|
|
43
|
-
}, 'new block after warping L2 time', 36, 1);
|
|
44
|
-
// Restore original minTxsPerBlock
|
|
45
|
-
sequencer.updateConfig({
|
|
46
|
-
minTxsPerBlock
|
|
47
|
-
});
|
|
18
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
19
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
20
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
21
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
22
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
23
|
+
*/ warpL2TimeAtLeastTo(node, targetTimestamp) {
|
|
24
|
+
return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
|
|
48
25
|
}
|
|
49
26
|
/**
|
|
50
|
-
* Warps the L1 timestamp forward by
|
|
51
|
-
* least by the duration.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param
|
|
55
|
-
* @
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const currentTimestamp = await this.eth.timestamp();
|
|
59
|
-
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
60
|
-
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
27
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
28
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
29
|
+
* queue.
|
|
30
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
31
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
32
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
33
|
+
*/ warpL2TimeAtLeastBy(node, duration) {
|
|
34
|
+
return node.warpL2TimeAtLeastBy(Number(duration));
|
|
61
35
|
}
|
|
62
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EthCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import {
|
|
2
|
+
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
4
|
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
5
5
|
export declare class EpochTestSettler {
|
|
@@ -16,4 +16,4 @@ export declare class EpochTestSettler {
|
|
|
16
16
|
stop(): Promise<void>;
|
|
17
17
|
handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLHNCQUFzQixDQUFDO0FBQzVFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVyRSxxQkFBYSxnQkFBZ0I7SUFPekIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLEdBQUc7SUFDWCxPQUFPLENBQUMsT0FBTztJQVJqQixPQUFPLENBQUMsZ0JBQWdCLENBQW1CO0lBQzNDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBZTtJQUVwQyxZQUNFLFVBQVUsRUFBRSxhQUFhLEVBQ3pCLGFBQWEsRUFBRSxVQUFVLEVBQ2pCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLEdBQUcsRUFBRSxNQUFNLEVBQ1gsT0FBTyxFQUFFO1FBQUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO1FBQUMsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUUsRUFHeEU7SUFFSyxLQUFLLGtCQUlWO0lBRUssSUFBSSxrQkFFVDtJQUVLLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQWNsRTtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAclE;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import {
|
|
2
|
+
import { settleEpochOutbox } from '@aztec/prover-client/test';
|
|
3
3
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
4
|
-
import { computeEpochOutHash } from '@aztec/stdlib/messaging';
|
|
5
4
|
export class EpochTestSettler {
|
|
6
5
|
l2BlockSource;
|
|
7
6
|
log;
|
|
@@ -27,30 +26,12 @@ export class EpochTestSettler {
|
|
|
27
26
|
await this.epochMonitor?.stop();
|
|
28
27
|
}
|
|
29
28
|
async handleEpochReadyToProve(epoch) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const lastCheckpoint = await settleEpochOutbox({
|
|
30
|
+
rollupCheatCodes: this.rollupCheatCodes,
|
|
31
|
+
l2BlockSource: this.l2BlockSource,
|
|
32
|
+
epoch,
|
|
33
|
+
log: this.log
|
|
34
34
|
});
|
|
35
|
-
const messagesInEpoch = [];
|
|
36
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
37
|
-
let checkpointIndex = -1;
|
|
38
|
-
for (const block of blocks){
|
|
39
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
40
|
-
if (slotNumber !== previousSlotNumber) {
|
|
41
|
-
checkpointIndex++;
|
|
42
|
-
messagesInEpoch[checkpointIndex] = [];
|
|
43
|
-
previousSlotNumber = slotNumber;
|
|
44
|
-
}
|
|
45
|
-
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
|
|
46
|
-
}
|
|
47
|
-
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
48
|
-
if (!outHash.isZero()) {
|
|
49
|
-
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
50
|
-
} else {
|
|
51
|
-
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
|
52
|
-
}
|
|
53
|
-
const lastCheckpoint = checkpointedBlocks.at(-1)?.checkpointNumber;
|
|
54
35
|
if (lastCheckpoint !== undefined) {
|
|
55
36
|
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
56
37
|
} else {
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
2
1
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
2
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
3
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
5
4
|
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dest/testing/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
1
2
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
2
3
|
/**
|
|
3
|
-
* Returns
|
|
4
|
-
*
|
|
4
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
5
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
6
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
7
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
8
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
9
|
+
* mainnet alpha.
|
|
5
10
|
*/
|
|
6
|
-
export declare function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
export declare function getTokenAllowedSetupFunctions(artifact?: ContractArtifact): Promise<AllowedElement[]>;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRTFELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXRFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELFFBQVEsR0FBRSxnQkFBd0MsR0FDakQsT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUzNCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,GAAE,gBAAwC,GACjD,OAAO,CAAC,cAAc,EAAE,CAAC,CAS3B"}
|
|
@@ -2,19 +2,23 @@ import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
|
2
2
|
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
3
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
4
4
|
/**
|
|
5
|
-
* Returns
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
6
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
7
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
8
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
9
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
10
|
+
* mainnet alpha.
|
|
11
|
+
*/ export async function getTokenAllowedSetupFunctions(artifact = TokenContractArtifact) {
|
|
12
|
+
const tokenClassId = (await getContractClassFromArtifact(artifact)).id;
|
|
9
13
|
const target = {
|
|
10
14
|
classId: tokenClassId
|
|
11
15
|
};
|
|
12
16
|
return Promise.all([
|
|
13
|
-
//
|
|
14
|
-
buildAllowedElement(
|
|
17
|
+
// needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
18
|
+
buildAllowedElement(artifact, target, '_increase_public_balance', {
|
|
15
19
|
onlySelf: true
|
|
16
20
|
}),
|
|
17
|
-
//
|
|
18
|
-
buildAllowedElement(
|
|
21
|
+
// needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
22
|
+
buildAllowedElement(artifact, target, 'transfer_in_public')
|
|
19
23
|
]);
|
|
20
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,38 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "5.0.0-
|
|
32
|
-
"@aztec/archiver": "5.0.0-
|
|
33
|
-
"@aztec/aztec-node": "5.0.0-
|
|
34
|
-
"@aztec/aztec.js": "5.0.0-
|
|
35
|
-
"@aztec/bb-prover": "5.0.0-
|
|
36
|
-
"@aztec/bb.js": "5.0.0-
|
|
37
|
-
"@aztec/blob-client": "5.0.0-
|
|
38
|
-
"@aztec/bot": "5.0.0-
|
|
39
|
-
"@aztec/builder": "5.0.0-
|
|
40
|
-
"@aztec/cli": "5.0.0-
|
|
41
|
-
"@aztec/constants": "5.0.0-
|
|
42
|
-
"@aztec/entrypoints": "5.0.0-
|
|
43
|
-
"@aztec/ethereum": "5.0.0-
|
|
44
|
-
"@aztec/foundation": "5.0.0-
|
|
45
|
-
"@aztec/kv-store": "5.0.0-
|
|
46
|
-
"@aztec/l1-artifacts": "5.0.0-
|
|
47
|
-
"@aztec/node-lib": "5.0.0-
|
|
48
|
-
"@aztec/noir-contracts.js": "5.0.0-
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "5.0.0-
|
|
50
|
-
"@aztec/p2p": "5.0.0-
|
|
51
|
-
"@aztec/p2p-bootstrap": "5.0.0-
|
|
52
|
-
"@aztec/protocol-contracts": "5.0.0-
|
|
53
|
-
"@aztec/prover-client": "5.0.0-
|
|
54
|
-
"@aztec/prover-node": "5.0.0-
|
|
55
|
-
"@aztec/pxe": "5.0.0-
|
|
56
|
-
"@aztec/sequencer-client": "5.0.0-
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
59
|
-
"@aztec/
|
|
60
|
-
"@aztec/
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
31
|
+
"@aztec/accounts": "5.0.0-rc.2",
|
|
32
|
+
"@aztec/archiver": "5.0.0-rc.2",
|
|
33
|
+
"@aztec/aztec-node": "5.0.0-rc.2",
|
|
34
|
+
"@aztec/aztec.js": "5.0.0-rc.2",
|
|
35
|
+
"@aztec/bb-prover": "5.0.0-rc.2",
|
|
36
|
+
"@aztec/bb.js": "5.0.0-rc.2",
|
|
37
|
+
"@aztec/blob-client": "5.0.0-rc.2",
|
|
38
|
+
"@aztec/bot": "5.0.0-rc.2",
|
|
39
|
+
"@aztec/builder": "5.0.0-rc.2",
|
|
40
|
+
"@aztec/cli": "5.0.0-rc.2",
|
|
41
|
+
"@aztec/constants": "5.0.0-rc.2",
|
|
42
|
+
"@aztec/entrypoints": "5.0.0-rc.2",
|
|
43
|
+
"@aztec/ethereum": "5.0.0-rc.2",
|
|
44
|
+
"@aztec/foundation": "5.0.0-rc.2",
|
|
45
|
+
"@aztec/kv-store": "5.0.0-rc.2",
|
|
46
|
+
"@aztec/l1-artifacts": "5.0.0-rc.2",
|
|
47
|
+
"@aztec/node-lib": "5.0.0-rc.2",
|
|
48
|
+
"@aztec/noir-contracts.js": "5.0.0-rc.2",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "5.0.0-rc.2",
|
|
50
|
+
"@aztec/p2p": "5.0.0-rc.2",
|
|
51
|
+
"@aztec/p2p-bootstrap": "5.0.0-rc.2",
|
|
52
|
+
"@aztec/protocol-contracts": "5.0.0-rc.2",
|
|
53
|
+
"@aztec/prover-client": "5.0.0-rc.2",
|
|
54
|
+
"@aztec/prover-node": "5.0.0-rc.2",
|
|
55
|
+
"@aztec/pxe": "5.0.0-rc.2",
|
|
56
|
+
"@aztec/sequencer-client": "5.0.0-rc.2",
|
|
57
|
+
"@aztec/standard-contracts": "5.0.0-rc.2",
|
|
58
|
+
"@aztec/stdlib": "5.0.0-rc.2",
|
|
59
|
+
"@aztec/telemetry-client": "5.0.0-rc.2",
|
|
60
|
+
"@aztec/txe": "5.0.0-rc.2",
|
|
61
|
+
"@aztec/validator-ha-signer": "5.0.0-rc.2",
|
|
62
|
+
"@aztec/wallets": "5.0.0-rc.2",
|
|
63
|
+
"@aztec/world-state": "5.0.0-rc.2",
|
|
63
64
|
"@iarna/toml": "^2.2.5",
|
|
64
65
|
"@types/chalk": "^2.2.0",
|
|
65
66
|
"abitype": "^0.8.11",
|
package/scripts/add_crate.sh
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Creates a contract+test crate pair and adds them to an existing workspace.
|
|
5
|
-
# Usage: add_crate.sh <crate_name>
|
|
5
|
+
# Usage: add_crate.sh <crate_name> <template>
|
|
6
6
|
# Must be called from a workspace root that already has Nargo.toml with [workspace].
|
|
7
7
|
|
|
8
8
|
crate_name=$1
|
|
9
|
+
template=$2
|
|
9
10
|
|
|
10
11
|
if [ -z "$crate_name" ]; then
|
|
11
12
|
echo "Error: crate name is required"
|
|
@@ -31,72 +32,22 @@ fi
|
|
|
31
32
|
|
|
32
33
|
# Get the actual aztec version for the git tag.
|
|
33
34
|
AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
|
|
35
|
+
TEMPLATE_DIR="$(dirname $0)/templates/$template"
|
|
34
36
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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"
|
|
37
|
+
# Copy template crates and substitute placeholders
|
|
38
|
+
cp -r "$TEMPLATE_DIR/contract" "$contract_dir"
|
|
39
|
+
cp -r "$TEMPLATE_DIR/test" "$test_dir"
|
|
40
|
+
# Use perl -i for portability across os.
|
|
41
|
+
find "$contract_dir" "$test_dir" -type f -exec \
|
|
42
|
+
perl -i -pe "s/__CRATE_NAME__/${crate_name}/g; s/__AZTEC_VERSION__/${AZTEC_VERSION}/g" {} +
|
|
92
43
|
|
|
93
44
|
# Add members to workspace Nargo.toml
|
|
94
45
|
if grep -q 'members\s*=\s*\[\s*\]' Nargo.toml; then
|
|
95
46
|
# Empty array: members = []
|
|
96
|
-
|
|
47
|
+
perl -i -pe "s|members\s*=\s*\[\s*\]|members = [\"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml
|
|
97
48
|
else
|
|
98
49
|
# Non-empty array: add before closing ]
|
|
99
|
-
|
|
50
|
+
perl -i -pe "s|(members\s*=\s*\[.*)\]|\1, \"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml
|
|
100
51
|
fi
|
|
101
52
|
|
|
102
53
|
echo "Created crates '${contract_dir}' and '${test_dir}'"
|
package/scripts/aztec.sh
CHANGED
|
@@ -23,13 +23,17 @@ case $cmd in
|
|
|
23
23
|
# Attempt to compile, no-op if there are no changes
|
|
24
24
|
node --no-warnings "$script_dir/../dest/bin/index.js" compile
|
|
25
25
|
|
|
26
|
-
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:
|
|
26
|
+
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:^contract:"}"
|
|
27
27
|
aztec start --txe --port 8081 &
|
|
28
28
|
server_pid=$!
|
|
29
29
|
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
30
|
+
if ! command -v nc &>/dev/null; then
|
|
31
|
+
echo "Error: 'nc' (netcat) is required but not installed." >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
30
34
|
while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
|
|
31
35
|
export NARGO_FOREIGN_CALL_TIMEOUT=300000
|
|
32
|
-
nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081
|
|
36
|
+
nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081 "$@"
|
|
33
37
|
;;
|
|
34
38
|
start)
|
|
35
39
|
if [ "${1:-}" == "--local-network" ]; then
|
package/scripts/init.sh
CHANGED
|
@@ -16,11 +16,11 @@ Options:
|
|
|
16
16
|
-h, --help Print help
|
|
17
17
|
|
|
18
18
|
This command creates a new Aztec Noir project in the current directory with
|
|
19
|
-
a workspace containing a contract
|
|
20
|
-
|
|
19
|
+
a workspace containing a Counter contract example with tests. The Counter
|
|
20
|
+
demonstrates private state, private functions, and utility reads.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Use 'aztec new <name>' to create a blank contract project, or to add another
|
|
23
|
+
contract to an existing workspace.
|
|
24
24
|
EOF
|
|
25
25
|
exit 0
|
|
26
26
|
;;
|
|
@@ -36,4 +36,4 @@ done
|
|
|
36
36
|
package_name="$(basename $(pwd))"
|
|
37
37
|
|
|
38
38
|
echo "Initializing Aztec contract project..."
|
|
39
|
-
$script_path/setup_workspace.sh "$package_name"
|
|
39
|
+
$script_path/setup_workspace.sh "$package_name" counter
|
package/scripts/new.sh
CHANGED
|
@@ -68,7 +68,7 @@ fi
|
|
|
68
68
|
if [ -f "Nargo.toml" ] && grep -q '\[workspace\]' Nargo.toml; then
|
|
69
69
|
# Add crate pair to existing workspace
|
|
70
70
|
echo "Adding contract '$package_name' to existing workspace..."
|
|
71
|
-
$script_path/add_crate.sh "$package_name"
|
|
71
|
+
$script_path/add_crate.sh "$package_name" blank
|
|
72
72
|
else
|
|
73
73
|
# Create new workspace
|
|
74
74
|
if [ -d "$project_path" ] && [ "$(ls -A $project_path 2>/dev/null)" ]; then
|
|
@@ -79,5 +79,5 @@ else
|
|
|
79
79
|
echo "Creating new Aztec contract project at $project_path..."
|
|
80
80
|
mkdir -p "$project_path"
|
|
81
81
|
cd "$project_path"
|
|
82
|
-
$script_path/setup_workspace.sh "$package_name"
|
|
82
|
+
$script_path/setup_workspace.sh "$package_name" blank
|
|
83
83
|
fi
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Creates an Aztec contract workspace with a contract crate and a test crate.
|
|
5
|
-
# Usage: setup_workspace.sh <package_name>
|
|
5
|
+
# Usage: setup_workspace.sh <package_name> <template>
|
|
6
6
|
# Must be called from the workspace root directory.
|
|
7
7
|
|
|
8
8
|
package_name=$1
|
|
9
|
+
template=$2
|
|
9
10
|
script_path=$(realpath $(dirname "$0"))
|
|
10
11
|
|
|
11
12
|
if [ -z "$package_name" ]; then
|
|
@@ -26,7 +27,7 @@ members = []
|
|
|
26
27
|
EOF
|
|
27
28
|
|
|
28
29
|
# Create the first crate pair
|
|
29
|
-
$script_path/add_crate.sh "$package_name"
|
|
30
|
+
$script_path/add_crate.sh "$package_name" "$template"
|
|
30
31
|
|
|
31
32
|
# Create README
|
|
32
33
|
cat > README.md << REOF
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
use aztec::test::helpers::test_environment::TestEnvironment;
|
|
2
|
+
use __CRATE_NAME___contract::Main;
|
|
3
|
+
|
|
4
|
+
#[test]
|
|
5
|
+
unconstrained fn test_constructor() {
|
|
6
|
+
let mut env = TestEnvironment::new();
|
|
7
|
+
let deployer = env.create_light_account();
|
|
8
|
+
|
|
9
|
+
let _contract_address = env.deploy("@__CRATE_NAME___contract/Main")
|
|
10
|
+
.with_private_initializer(deployer, Main::interface().constructor());
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "__CRATE_NAME___contract"
|
|
3
|
+
type = "contract"
|
|
4
|
+
|
|
5
|
+
[dependencies]
|
|
6
|
+
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="aztec" }
|
|
7
|
+
balance_set = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="balance-set" }
|