@aztec/aztec 0.0.1-commit.2448fdb → 0.0.1-commit.2606882
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 +1 -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 +10 -6
- 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 +2 -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 +6 -8
- 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/standby.d.ts +3 -5
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +3 -3
- 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 +3 -3
- 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 +5 -9
- package/dest/cli/cmds/start_prover_agent.js +2 -2
- 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/warn_if_aztec_version_mismatch.d.ts +1 -1
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -1
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +2 -3
- package/dest/cli/util.js +10 -8
- 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 +5 -28
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +36 -14
- package/dest/testing/anvil_test_watcher.d.ts +15 -3
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +32 -4
- package/dest/testing/cheat_codes.d.ts +10 -5
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +40 -6
- 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 +6 -4
- package/dest/testing/index.d.ts +2 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/package.json +34 -34
- package/scripts/add_crate.sh +11 -60
- package/scripts/aztec.sh +7 -4
- 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 +1 -1
- package/src/cli/aztec_start_action.ts +11 -6
- package/src/cli/aztec_start_options.ts +9 -23
- package/src/cli/cmds/compile.ts +7 -9
- package/src/cli/cmds/profile.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +20 -4
- package/src/cli/cmds/standby.ts +4 -4
- package/src/cli/cmds/start_bot.ts +3 -5
- package/src/cli/cmds/start_node.ts +5 -9
- package/src/cli/cmds/start_prover_agent.ts +2 -2
- package/src/cli/cmds/start_prover_broker.ts +10 -11
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +2 -3
- package/src/cli/util.ts +9 -9
- 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 +39 -13
- package/src/testing/anvil_test_watcher.ts +43 -3
- package/src/testing/cheat_codes.ts +54 -7
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -1
- 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/src/cli/cmds/start_archiver.ts +0 -50
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,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,
|
|
1
|
+
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGrE,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,CAmClE;CACF"}
|
|
@@ -27,8 +27,10 @@ export class EpochTestSettler {
|
|
|
27
27
|
await this.epochMonitor?.stop();
|
|
28
28
|
}
|
|
29
29
|
async handleEpochReadyToProve(epoch) {
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const blocks = await this.l2BlockSource.getBlocks({
|
|
31
|
+
epoch,
|
|
32
|
+
onlyCheckpointed: true
|
|
33
|
+
});
|
|
32
34
|
this.log.info(`Settling epoch ${epoch} with blocks ${blocks[0]?.header.getBlockNumber()} to ${blocks.at(-1)?.header.getBlockNumber()}`, {
|
|
33
35
|
blocks: blocks.map((b)=>b.toBlockInfo())
|
|
34
36
|
});
|
|
@@ -46,11 +48,11 @@ export class EpochTestSettler {
|
|
|
46
48
|
}
|
|
47
49
|
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
48
50
|
if (!outHash.isZero()) {
|
|
49
|
-
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
51
|
+
await this.rollupCheatCodes.insertOutbox(epoch, messagesInEpoch.length, outHash.toBigInt());
|
|
50
52
|
} else {
|
|
51
53
|
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
|
52
54
|
}
|
|
53
|
-
const lastCheckpoint =
|
|
55
|
+
const lastCheckpoint = blocks.at(-1)?.checkpointNumber;
|
|
54
56
|
if (lastCheckpoint !== undefined) {
|
|
55
57
|
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
56
58
|
} else {
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
1
|
+
export { AnvilTestWatcher, type AnvilTestWatcherOpts } 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
5
|
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxLQUFLLG9CQUFvQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEYsT0FBTyxFQUFFLGFBQWEsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3ZFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUM5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtF,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.2606882",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-
|
|
34
|
-
"@aztec/aztec
|
|
35
|
-
"@aztec/
|
|
36
|
-
"@aztec/bb
|
|
37
|
-
"@aztec/
|
|
38
|
-
"@aztec/
|
|
39
|
-
"@aztec/
|
|
40
|
-
"@aztec/
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/noir-
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/prover-
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
59
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
60
|
-
"@aztec/txe": "0.0.1-commit.
|
|
61
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
62
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
63
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.2606882",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.2606882",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.2606882",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.2606882",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.2606882",
|
|
36
|
+
"@aztec/bb.js": "0.0.1-commit.2606882",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.2606882",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.2606882",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.2606882",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.2606882",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.2606882",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.2606882",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.2606882",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.2606882",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.2606882",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.2606882",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.2606882",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.2606882",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.2606882",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.2606882",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.2606882",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.2606882",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.2606882",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.2606882",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.2606882",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.2606882",
|
|
57
|
+
"@aztec/standard-contracts": "0.0.1-commit.2606882",
|
|
58
|
+
"@aztec/stdlib": "0.0.1-commit.2606882",
|
|
59
|
+
"@aztec/telemetry-client": "0.0.1-commit.2606882",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.2606882",
|
|
61
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.2606882",
|
|
62
|
+
"@aztec/wallets": "0.0.1-commit.2606882",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.2606882",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@types/chalk": "^2.2.0",
|
|
66
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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
|
-
shopt -s inherit_errexit
|
|
4
3
|
|
|
5
4
|
# Re-execute using correct version if we have an .aztecrc file.
|
|
6
5
|
if [ "${AZTEC_VERSIONED:-0}" -eq 0 ] && [ -f .aztecrc ] && command -v aztec-up &>/dev/null; then
|
|
@@ -24,13 +23,17 @@ case $cmd in
|
|
|
24
23
|
# Attempt to compile, no-op if there are no changes
|
|
25
24
|
node --no-warnings "$script_dir/../dest/bin/index.js" compile
|
|
26
25
|
|
|
27
|
-
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:
|
|
26
|
+
export LOG_LEVEL="${LOG_LEVEL:-"error;trace:^contract:"}"
|
|
28
27
|
aztec start --txe --port 8081 &
|
|
29
28
|
server_pid=$!
|
|
30
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
|
|
31
34
|
while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
|
|
32
35
|
export NARGO_FOREIGN_CALL_TIMEOUT=300000
|
|
33
|
-
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 "$@"
|
|
34
37
|
;;
|
|
35
38
|
start)
|
|
36
39
|
if [ "${1:-}" == "--local-network" ]; then
|
|
@@ -50,7 +53,7 @@ case $cmd in
|
|
|
50
53
|
export ETHEREUM_HOSTS=${ETHEREUM_HOSTS:-"http://127.0.0.1:${ANVIL_PORT}"}
|
|
51
54
|
|
|
52
55
|
anvil --version
|
|
53
|
-
anvil --silent &
|
|
56
|
+
anvil --silent --port "$ANVIL_PORT" &
|
|
54
57
|
anvil_pid=$!
|
|
55
58
|
trap 'kill $anvil_pid &>/dev/null' EXIT
|
|
56
59
|
fi
|
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" }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
use aztec::macros::aztec;
|
|
2
|
+
|
|
3
|
+
#[aztec]
|
|
4
|
+
pub contract Counter {
|
|
5
|
+
use aztec::{
|
|
6
|
+
macros::{functions::{external, initializer}, storage::storage},
|
|
7
|
+
messages::message_delivery::MessageDelivery,
|
|
8
|
+
protocol::address::AztecAddress,
|
|
9
|
+
state_vars::Owned,
|
|
10
|
+
};
|
|
11
|
+
use balance_set::BalanceSet;
|
|
12
|
+
|
|
13
|
+
#[storage]
|
|
14
|
+
struct Storage<Context> {
|
|
15
|
+
// Each owner has their own counter, stored as private encrypted notes.
|
|
16
|
+
// Owned: dictates who will receive the encrypted notes.
|
|
17
|
+
// BalanceSet: manages the underlying notes, providing add/sub/balance_of.
|
|
18
|
+
counters: Owned<BalanceSet<Context>, Context>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Sets the owner's counter to an initial value.
|
|
22
|
+
//
|
|
23
|
+
// #[external("private")]: executes on the user's device, inputs are hidden from everyone.
|
|
24
|
+
#[initializer]
|
|
25
|
+
#[external("private")]
|
|
26
|
+
fn constructor(initial_value: u128, owner: AztecAddress) {
|
|
27
|
+
// Delivers the note to the recipient onchain with provable correctness.
|
|
28
|
+
// Without delivery, the recipient can't find or decrypt the note.
|
|
29
|
+
self.storage.counters.at(owner).add(initial_value).deliver(
|
|
30
|
+
MessageDelivery::onchain_constrained(),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Adds 1 to the owner's counter.
|
|
35
|
+
#[external("private")]
|
|
36
|
+
fn increment(owner: AztecAddress) {
|
|
37
|
+
self.storage.counters.at(owner).add(1).deliver(MessageDelivery::onchain_constrained());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Returns the current value of the owner's counter.
|
|
41
|
+
//
|
|
42
|
+
// #[external("utility")]: runs off-chain, no transaction created, no cost.
|
|
43
|
+
// Only the owner can decrypt and read their own counter.
|
|
44
|
+
#[external("utility")]
|
|
45
|
+
unconstrained fn get_counter(owner: AztecAddress) -> u128 {
|
|
46
|
+
self.storage.counters.at(owner).balance_of()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
use aztec::{protocol::address::AztecAddress, test::helpers::test_environment::TestEnvironment};
|
|
2
|
+
use __CRATE_NAME___contract::Counter;
|
|
3
|
+
|
|
4
|
+
unconstrained fn setup(initial_value: u128) -> (TestEnvironment, AztecAddress, AztecAddress) {
|
|
5
|
+
let mut env = TestEnvironment::new();
|
|
6
|
+
let owner = env.create_light_account();
|
|
7
|
+
|
|
8
|
+
let contract_address = env.deploy("@__CRATE_NAME___contract/Counter")
|
|
9
|
+
.with_private_initializer(owner, Counter::interface().constructor(initial_value, owner));
|
|
10
|
+
|
|
11
|
+
(env, contract_address, owner)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[test]
|
|
15
|
+
unconstrained fn test_constructor() {
|
|
16
|
+
let initial_value = 5;
|
|
17
|
+
let (env, contract_address, owner) = setup(initial_value);
|
|
18
|
+
|
|
19
|
+
let counter = env.execute_utility(Counter::at(contract_address).get_counter(owner));
|
|
20
|
+
assert_eq(counter, initial_value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[test]
|
|
24
|
+
unconstrained fn test_increment() {
|
|
25
|
+
let initial_value = 5;
|
|
26
|
+
let (mut env, contract_address, owner) = setup(initial_value);
|
|
27
|
+
|
|
28
|
+
env.call_private(owner, Counter::at(contract_address).increment(owner));
|
|
29
|
+
|
|
30
|
+
let counter = env.execute_utility(Counter::at(contract_address).get_counter(owner));
|
|
31
|
+
assert_eq(counter, initial_value + 1);
|
|
32
|
+
}
|
package/src/bin/index.ts
CHANGED
|
@@ -47,7 +47,7 @@ async function main() {
|
|
|
47
47
|
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
48
48
|
enrichEnvironmentWithChainName(networkName);
|
|
49
49
|
|
|
50
|
-
const cliVersion = getPackageVersion()
|
|
50
|
+
const cliVersion = getPackageVersion();
|
|
51
51
|
let program = new Command('aztec');
|
|
52
52
|
program.description('Aztec command line interface').version(cliVersion).enablePositionalOptions();
|
|
53
53
|
program = injectAztecCommands(program, userLog, debugLogger);
|
|
@@ -10,7 +10,7 @@ import type { ChainConfig } from '@aztec/stdlib/config';
|
|
|
10
10
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
12
12
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
13
|
-
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
13
|
+
import { getOtelJsonRpcDiagnosticsMiddleware, getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
14
14
|
|
|
15
15
|
import { createLocalNetwork } from '../local-network/index.js';
|
|
16
16
|
import { github, splash } from '../splash.js';
|
|
@@ -29,7 +29,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
29
29
|
if (options.localNetwork) {
|
|
30
30
|
const localNetwork = extractNamespacedOptions(options, 'localNetwork');
|
|
31
31
|
userLog(`${splash}\n${github}\n\n`);
|
|
32
|
-
userLog(`Setting up Aztec local network ${packageVersion
|
|
32
|
+
userLog(`Setting up Aztec local network ${packageVersion}, please stand by...`);
|
|
33
33
|
|
|
34
34
|
const { node, stop } = await createLocalNetwork(
|
|
35
35
|
{
|
|
@@ -67,9 +67,6 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
67
67
|
} else if (options.bot) {
|
|
68
68
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
69
69
|
await startBot(options, signalHandlers, services, userLog);
|
|
70
|
-
} else if (options.archiver) {
|
|
71
|
-
const { startArchiver } = await import('./cmds/start_archiver.js');
|
|
72
|
-
({ config } = await startArchiver(options, signalHandlers, services));
|
|
73
70
|
} else if (options.p2pBootstrap) {
|
|
74
71
|
const { startP2PBootstrap } = await import('./cmds/start_p2p_bootstrap.js');
|
|
75
72
|
({ config } = await startP2PBootstrap(options, signalHandlers, services, userLog));
|
|
@@ -81,7 +78,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
81
78
|
await startProverBroker(options, signalHandlers, services, userLog);
|
|
82
79
|
} else if (options.txe) {
|
|
83
80
|
const { startTXE } = await import('./cmds/start_txe.js');
|
|
84
|
-
await startTXE(options, debugLogger);
|
|
81
|
+
await startTXE(options, signalHandlers, debugLogger);
|
|
85
82
|
} else if (options.sequencer) {
|
|
86
83
|
userLog(`Cannot run a standalone sequencer without a node`);
|
|
87
84
|
process.exit(1);
|
|
@@ -97,7 +94,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
97
94
|
|
|
98
95
|
// Start the main JSON-RPC server
|
|
99
96
|
if (Object.entries(services).length > 0) {
|
|
97
|
+
if (services.node) {
|
|
98
|
+
const { BarretenbergSync } = await import('@aztec/bb.js');
|
|
99
|
+
// JSON-RPC schema parsing may decompress compressed Chonk proofs before the node handler runs.
|
|
100
|
+
await BarretenbergSync.initSingleton();
|
|
101
|
+
}
|
|
102
|
+
|
|
100
103
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
104
|
+
diagnostic: getOtelJsonRpcDiagnosticsMiddleware(),
|
|
101
105
|
http200OnError: false,
|
|
102
106
|
log: debugLogger,
|
|
103
107
|
middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)],
|
|
@@ -129,6 +133,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
const rpcServer = createNamespacedSafeJsonRpcServer(adminServices, {
|
|
136
|
+
diagnostic: getOtelJsonRpcDiagnosticsMiddleware(),
|
|
132
137
|
http200OnError: false,
|
|
133
138
|
log: debugLogger,
|
|
134
139
|
middlewares: adminMiddlewares,
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
isBooleanConfigValue,
|
|
13
13
|
omitConfigMappings,
|
|
14
14
|
} from '@aztec/foundation/config';
|
|
15
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
16
15
|
import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
17
16
|
import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p/config';
|
|
18
17
|
import { proverAgentConfigMappings, proverBrokerConfigMappings } from '@aztec/prover-client/broker/config';
|
|
@@ -20,6 +19,7 @@ import { proverNodeConfigMappings } from '@aztec/prover-node/config';
|
|
|
20
19
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
21
20
|
import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
22
21
|
import { chainConfigMappings, nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
22
|
+
import { dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
23
23
|
import { telemetryClientConfigMappings } from '@aztec/telemetry-client/config';
|
|
24
24
|
import { worldStateConfigMappings } from '@aztec/world-state/config';
|
|
25
25
|
|
|
@@ -36,7 +36,7 @@ export interface AztecStartOption {
|
|
|
36
36
|
parseVal?: (val: string) => any;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping
|
|
39
|
+
export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping<unknown>>) => {
|
|
40
40
|
const options: AztecStartOption[] = [];
|
|
41
41
|
for (const [key, { env, defaultValue: def, parseEnv, description, printDefault, fallback }] of Object.entries(
|
|
42
42
|
configMappings,
|
|
@@ -58,7 +58,11 @@ export const getOptions = (namespace: string, configMappings: Record<string, Con
|
|
|
58
58
|
return options;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
const configToFlag = (
|
|
61
|
+
const configToFlag = (
|
|
62
|
+
flag: string,
|
|
63
|
+
configMapping: ConfigMapping<unknown>,
|
|
64
|
+
overrideDefaultValue?: any,
|
|
65
|
+
): AztecStartOption => {
|
|
62
66
|
if (!configMapping.isBoolean) {
|
|
63
67
|
flag += ' <value>';
|
|
64
68
|
}
|
|
@@ -218,12 +222,6 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
218
222
|
},
|
|
219
223
|
],
|
|
220
224
|
ARCHIVER: [
|
|
221
|
-
{
|
|
222
|
-
flag: '--archiver',
|
|
223
|
-
description: 'Starts Aztec Archiver with options',
|
|
224
|
-
defaultValue: undefined,
|
|
225
|
-
env: undefined,
|
|
226
|
-
},
|
|
227
225
|
...getOptions(
|
|
228
226
|
'archiver',
|
|
229
227
|
omitConfigMappings(archiverConfigMappings, Object.keys(l1ContractsConfigMappings) as (keyof ArchiverConfig)[]),
|
|
@@ -270,11 +268,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
270
268
|
defaultValue: undefined,
|
|
271
269
|
env: undefined,
|
|
272
270
|
},
|
|
273
|
-
...getOptions(
|
|
274
|
-
'proverBroker',
|
|
275
|
-
// filter out archiver options from prover node options as they're passed separately in --archiver
|
|
276
|
-
proverBrokerConfigMappings,
|
|
277
|
-
),
|
|
271
|
+
...getOptions('proverBroker', proverBrokerConfigMappings),
|
|
278
272
|
],
|
|
279
273
|
'PROVER AGENT': [
|
|
280
274
|
{
|
|
@@ -322,15 +316,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
322
316
|
},
|
|
323
317
|
...getOptions('bot', botConfigMappings),
|
|
324
318
|
],
|
|
325
|
-
PXE: [
|
|
326
|
-
{
|
|
327
|
-
flag: '--pxe',
|
|
328
|
-
description: 'Starts Aztec PXE with options',
|
|
329
|
-
defaultValue: undefined,
|
|
330
|
-
env: undefined,
|
|
331
|
-
},
|
|
332
|
-
...getOptions('pxe', allPxeConfigMappings),
|
|
333
|
-
],
|
|
319
|
+
PXE: [...getOptions('pxe', allPxeConfigMappings)],
|
|
334
320
|
TXE: [
|
|
335
321
|
{
|
|
336
322
|
flag: '--txe',
|