@aztec/aztec 4.3.0-nightly.20260426 → 4.3.0-nightly.20260428

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "4.3.0-nightly.20260426",
3
+ "version": "4.3.0-nightly.20260428",
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": "4.3.0-nightly.20260426",
32
- "@aztec/archiver": "4.3.0-nightly.20260426",
33
- "@aztec/aztec-faucet": "4.3.0-nightly.20260426",
34
- "@aztec/aztec-node": "4.3.0-nightly.20260426",
35
- "@aztec/aztec.js": "4.3.0-nightly.20260426",
36
- "@aztec/bb-prover": "4.3.0-nightly.20260426",
37
- "@aztec/bb.js": "4.3.0-nightly.20260426",
38
- "@aztec/blob-client": "4.3.0-nightly.20260426",
39
- "@aztec/bot": "4.3.0-nightly.20260426",
40
- "@aztec/builder": "4.3.0-nightly.20260426",
41
- "@aztec/cli": "4.3.0-nightly.20260426",
42
- "@aztec/constants": "4.3.0-nightly.20260426",
43
- "@aztec/entrypoints": "4.3.0-nightly.20260426",
44
- "@aztec/ethereum": "4.3.0-nightly.20260426",
45
- "@aztec/foundation": "4.3.0-nightly.20260426",
46
- "@aztec/kv-store": "4.3.0-nightly.20260426",
47
- "@aztec/l1-artifacts": "4.3.0-nightly.20260426",
48
- "@aztec/node-lib": "4.3.0-nightly.20260426",
49
- "@aztec/noir-contracts.js": "4.3.0-nightly.20260426",
50
- "@aztec/noir-protocol-circuits-types": "4.3.0-nightly.20260426",
51
- "@aztec/p2p": "4.3.0-nightly.20260426",
52
- "@aztec/p2p-bootstrap": "4.3.0-nightly.20260426",
53
- "@aztec/protocol-contracts": "4.3.0-nightly.20260426",
54
- "@aztec/prover-client": "4.3.0-nightly.20260426",
55
- "@aztec/prover-node": "4.3.0-nightly.20260426",
56
- "@aztec/pxe": "4.3.0-nightly.20260426",
57
- "@aztec/sequencer-client": "4.3.0-nightly.20260426",
58
- "@aztec/stdlib": "4.3.0-nightly.20260426",
59
- "@aztec/telemetry-client": "4.3.0-nightly.20260426",
60
- "@aztec/txe": "4.3.0-nightly.20260426",
61
- "@aztec/validator-ha-signer": "4.3.0-nightly.20260426",
62
- "@aztec/wallets": "4.3.0-nightly.20260426",
63
- "@aztec/world-state": "4.3.0-nightly.20260426",
31
+ "@aztec/accounts": "4.3.0-nightly.20260428",
32
+ "@aztec/archiver": "4.3.0-nightly.20260428",
33
+ "@aztec/aztec-faucet": "4.3.0-nightly.20260428",
34
+ "@aztec/aztec-node": "4.3.0-nightly.20260428",
35
+ "@aztec/aztec.js": "4.3.0-nightly.20260428",
36
+ "@aztec/bb-prover": "4.3.0-nightly.20260428",
37
+ "@aztec/bb.js": "4.3.0-nightly.20260428",
38
+ "@aztec/blob-client": "4.3.0-nightly.20260428",
39
+ "@aztec/bot": "4.3.0-nightly.20260428",
40
+ "@aztec/builder": "4.3.0-nightly.20260428",
41
+ "@aztec/cli": "4.3.0-nightly.20260428",
42
+ "@aztec/constants": "4.3.0-nightly.20260428",
43
+ "@aztec/entrypoints": "4.3.0-nightly.20260428",
44
+ "@aztec/ethereum": "4.3.0-nightly.20260428",
45
+ "@aztec/foundation": "4.3.0-nightly.20260428",
46
+ "@aztec/kv-store": "4.3.0-nightly.20260428",
47
+ "@aztec/l1-artifacts": "4.3.0-nightly.20260428",
48
+ "@aztec/node-lib": "4.3.0-nightly.20260428",
49
+ "@aztec/noir-contracts.js": "4.3.0-nightly.20260428",
50
+ "@aztec/noir-protocol-circuits-types": "4.3.0-nightly.20260428",
51
+ "@aztec/p2p": "4.3.0-nightly.20260428",
52
+ "@aztec/p2p-bootstrap": "4.3.0-nightly.20260428",
53
+ "@aztec/protocol-contracts": "4.3.0-nightly.20260428",
54
+ "@aztec/prover-client": "4.3.0-nightly.20260428",
55
+ "@aztec/prover-node": "4.3.0-nightly.20260428",
56
+ "@aztec/pxe": "4.3.0-nightly.20260428",
57
+ "@aztec/sequencer-client": "4.3.0-nightly.20260428",
58
+ "@aztec/stdlib": "4.3.0-nightly.20260428",
59
+ "@aztec/telemetry-client": "4.3.0-nightly.20260428",
60
+ "@aztec/txe": "4.3.0-nightly.20260428",
61
+ "@aztec/validator-ha-signer": "4.3.0-nightly.20260428",
62
+ "@aztec/wallets": "4.3.0-nightly.20260428",
63
+ "@aztec/world-state": "4.3.0-nightly.20260428",
64
64
  "@iarna/toml": "^2.2.5",
65
65
  "@types/chalk": "^2.2.0",
66
66
  "abitype": "^0.8.11",
@@ -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,64 +32,13 @@ 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
- # 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"
37
+ # Copy template crates and substitute placeholders
38
+ cp -r "$TEMPLATE_DIR/contract" "$contract_dir"
39
+ cp -r "$TEMPLATE_DIR/test" "$test_dir"
40
+ find "$contract_dir" "$test_dir" -type f -exec \
41
+ sed -i -e "s/__CRATE_NAME__/${crate_name}/g" -e "s/__AZTEC_VERSION__/${AZTEC_VERSION}/g" {} +
92
42
 
93
43
  # Add members to workspace Nargo.toml
94
44
  if grep -q 'members\s*=\s*\[\s*\]' Nargo.toml; 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 crate and a test crate, and automatically
20
- adds the Aztec.nr dependency to both.
19
+ a workspace containing a Counter contract example with tests. The Counter
20
+ demonstrates private state, private functions, and utility reads.
21
21
 
22
- If a workspace already exists in the current directory, use
23
- 'aztec new <name>' instead to add another contract.
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,6 @@
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" }
@@ -0,0 +1,10 @@
1
+ use aztec::macros::aztec;
2
+
3
+ #[aztec]
4
+ pub contract Main {
5
+ use aztec::macros::functions::{external, initializer};
6
+
7
+ #[initializer]
8
+ #[external("private")]
9
+ fn constructor() {}
10
+ }
@@ -0,0 +1,7 @@
1
+ [package]
2
+ name = "__CRATE_NAME___test"
3
+ type = "lib"
4
+
5
+ [dependencies]
6
+ aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="aztec" }
7
+ __CRATE_NAME___contract = { path = "../__CRATE_NAME___contract" }
@@ -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,7 @@
1
+ [package]
2
+ name = "__CRATE_NAME___test"
3
+ type = "lib"
4
+
5
+ [dependencies]
6
+ aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="aztec" }
7
+ __CRATE_NAME___contract = { path = "../__CRATE_NAME___contract" }
@@ -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
+ }