Skip to content

Commit 42c7773

Browse files
authored
Merge pull request #21 from AztecProtocol/jc/update-examples-v3-devnet-20251212-clean
Migrate examples to Aztec v3.0.0-devnet.20251212
2 parents 275811b + 8f3ceaa commit 42c7773

File tree

27 files changed

+7378
-7636
lines changed

27 files changed

+7378
-7636
lines changed

.github/workflows/note-send-proof-tests.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
name: Note Send Proof Tests
1818
runs-on: ubuntu-latest
1919
env:
20-
AZTEC_ENV: sandbox
21-
AZTEC_VERSION: 2.0.3
20+
AZTEC_ENV: local-network
21+
AZTEC_VERSION: 3.0.0-devnet.20251212
2222

2323
steps:
2424
- name: Checkout repository
@@ -44,22 +44,23 @@ jobs:
4444
- name: Update path
4545
run: echo "$HOME/.aztec/bin" >> $GITHUB_PATH
4646

47-
- name: Set Aztec version and start sandbox
47+
- name: Set Aztec version and start local network
4848
run: |
4949
aztec-up ${{ env.AZTEC_VERSION }}
50-
aztec start --sandbox &
50+
docker tag aztecprotocol/aztec:${{ env.AZTEC_VERSION }} aztecprotocol/aztec:latest
51+
aztec start --local-network &
5152
52-
- name: Wait for sandbox to be ready
53+
- name: Wait for local network to be ready
5354
run: |
54-
echo "Waiting for sandbox to start..."
55+
echo "Waiting for local network to start..."
5556
MAX_RETRIES=60
5657
for i in $(seq 1 $MAX_RETRIES); do
5758
if curl -s http://localhost:8080/status >/dev/null 2>&1; then
58-
echo "✅ Sandbox is ready!"
59+
echo "✅ Local network is ready!"
5960
break
6061
fi
6162
if [ $i -eq $MAX_RETRIES ]; then
62-
echo "❌ Sandbox failed to start after $MAX_RETRIES attempts"
63+
echo "❌ Local network failed to start after $MAX_RETRIES attempts"
6364
exit 1
6465
fi
6566
echo "Waiting... ($i/$MAX_RETRIES)"
@@ -70,11 +71,7 @@ jobs:
7071
working-directory: note-send-proof
7172
run: yarn install
7273

73-
- name: Compile Aztec contract
74-
working-directory: note-send-proof/sample-contract
75-
run: aztec-nargo compile
76-
77-
- name: Post-process contract and generate artifacts
74+
- name: Compile contract and generate artifacts
7875
working-directory: note-send-proof
7976
run: yarn ccc
8077

@@ -105,7 +102,7 @@ jobs:
105102
- name: Cleanup
106103
if: always()
107104
run: |
108-
echo "Stopping Aztec sandbox..."
105+
echo "Stopping Aztec local network..."
109106
pkill -f "aztec" || true
110107
docker stop $(docker ps -q) || true
111108
docker rm $(docker ps -a -q) || true

.github/workflows/test-wallet-webapp-tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Test Wallet Webapp Tests
1818
runs-on: ubuntu-latest
1919
env:
20-
AZTEC_VERSION: 3.0.0-devnet.5
20+
AZTEC_VERSION: 3.0.0-devnet.20251212
2121

2222
steps:
2323
- name: Checkout repository
@@ -43,23 +43,23 @@ jobs:
4343
- name: Update path
4444
run: echo "$HOME/.aztec/bin" >> $GITHUB_PATH
4545

46-
- name: Set Aztec version and start sandbox
46+
- name: Set Aztec version and start local network
4747
run: |
4848
aztec-up ${{ env.AZTEC_VERSION }}
4949
docker tag aztecprotocol/aztec:${{ env.AZTEC_VERSION }} aztecprotocol/aztec:latest
50-
aztec start --sandbox &
50+
aztec start --local-network &
5151
52-
- name: Wait for sandbox to be ready
52+
- name: Wait for local network to be ready
5353
run: |
54-
echo "Waiting for sandbox to start..."
54+
echo "Waiting for local network to start..."
5555
MAX_RETRIES=60
5656
for i in $(seq 1 $MAX_RETRIES); do
5757
if curl -s http://localhost:8080/status >/dev/null 2>&1; then
58-
echo "✅ Sandbox is ready!"
58+
echo "✅ Local network is ready!"
5959
break
6060
fi
6161
if [ $i -eq $MAX_RETRIES ]; then
62-
echo "❌ Sandbox failed to start after $MAX_RETRIES attempts"
62+
echo "❌ Local network failed to start after $MAX_RETRIES attempts"
6363
exit 1
6464
fi
6565
echo "Waiting... ($i/$MAX_RETRIES)"
@@ -91,7 +91,7 @@ jobs:
9191
- name: Cleanup
9292
if: always()
9393
run: |
94-
echo "Stopping Aztec sandbox..."
94+
echo "Stopping Aztec local network..."
9595
pkill -f "aztec" || true
9696
docker stop $(docker ps -q) || true
9797
docker rm $(docker ps -a -q) || true

account-contract/Nargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ compiler_version = ">=1.0.0"
55
type = "contract"
66

77
[dependencies]
8-
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-devnet.4", directory = "noir-projects/aztec-nr/aztec" }
9-
poseidon = { tag = "v0.1.1", git = "https://github.com/noir-lang/poseidon" }
8+
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-devnet.20251212", directory = "noir-projects/aztec-nr/aztec" }

account-contract/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const entrypoint = new PasswordAccountEntrypoint(
8888
Compile the Noir contract:
8989

9090
```bash
91-
aztec-nargo compile
91+
aztec compile
9292
```
9393

9494
Install TypeScript dependencies:
@@ -170,18 +170,27 @@ When implementing custom account contracts in Aztec, be aware of these critical
170170
- Failed fee payments will cause the entire transaction to fail
171171
- Consider how users will fund their account contracts with Fee Asset
172172

173+
## Aztec Version Compatibility
174+
175+
This example is compatible with **Aztec v3.0.0-devnet.20251212**.
176+
177+
To set this version:
178+
179+
```bash
180+
aztec-up 3.0.0-devnet.20251212
181+
```
182+
173183
## Dependencies
174184

175185
### Noir Dependencies
176186

177-
- **aztec**: v3.0.0-devnet.4
178-
- **poseidon**: v0.1.1
187+
- **aztec**: v3.0.0-devnet.20251212
179188

180189
### TypeScript Dependencies
181190

182-
- **@aztec/aztec.js**: 3.0.0-devnet.4
183-
- **@aztec/accounts**: 3.0.0-devnet.4
184-
- **@aztec/stdlib**: 3.0.0-devnet.4
191+
- **@aztec/aztec.js**: 3.0.0-devnet.20251212
192+
- **@aztec/accounts**: 3.0.0-devnet.20251212
193+
- **@aztec/stdlib**: 3.0.0-devnet.20251212
185194
- **@aztec/entrypoints**: Included in aztec.js
186195

187196
## Project Structure

account-contract/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"typescript": "^5.0.0"
1313
},
1414
"dependencies": {
15-
"@aztec/accounts": "3.0.0-devnet.4",
16-
"@aztec/aztec.js": "3.0.0-devnet.4",
17-
"@aztec/foundation": "3.0.0-devnet.4",
18-
"@aztec/noir-contracts.js": "3.0.0-devnet.4",
19-
"@aztec/stdlib": "3.0.0-devnet.4",
20-
"@aztec/test-wallet": "3.0.0-devnet.4",
15+
"@aztec/accounts": "3.0.0-devnet.20251212",
16+
"@aztec/aztec.js": "3.0.0-devnet.20251212",
17+
"@aztec/foundation": "3.0.0-devnet.20251212",
18+
"@aztec/noir-contracts.js": "3.0.0-devnet.20251212",
19+
"@aztec/stdlib": "3.0.0-devnet.20251212",
20+
"@aztec/test-wallet": "3.0.0-devnet.20251212",
2121
"tsx": "^4.20.6"
2222
}
2323
}

account-contract/src/account_actions.nr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use dep::aztec::context::PrivateContext;
1+
use aztec::context::PrivateContext;
22

3-
use dep::aztec::protocol_types::{
3+
use aztec::protocol_types::{
44
constants::GENERATOR_INDEX__TX_NULLIFIER, hash::poseidon2_hash_with_separator, traits::Hash,
55
};
66

7-
use dep::aztec::authwit::auth::{compute_authwit_message_hash, IS_VALID_SELECTOR};
8-
use dep::aztec::authwit::entrypoint::app::AppPayload;
7+
use aztec::authwit::auth::{compute_authwit_message_hash, IS_VALID_SELECTOR};
8+
use aztec::authwit::entrypoint::app::AppPayload;
99

1010
pub struct AccountActions<Context> {
1111
context: Context,

account-contract/src/main.nr

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use dep::aztec::macros::aztec;
1+
use aztec::macros::aztec;
22

33
mod account_actions;
44

55
#[aztec]
66
pub contract PasswordAccount {
7-
use dep::aztec::{
7+
use aztec::{
88
authwit::{
99
auth::compute_authwit_nullifier,
1010
entrypoint::app::AppPayload,
@@ -16,12 +16,10 @@ pub contract PasswordAccount {
1616
get_nullifier_membership_witness::get_low_nullifier_membership_witness,
1717
notes::{get_sender_for_tags, set_sender_for_tags},
1818
},
19-
protocol_types::address::AztecAddress,
19+
protocol_types::{address::AztecAddress, hash::poseidon2_hash},
2020
state_vars::PublicImmutable,
2121
};
2222

23-
use dep::poseidon;
24-
2523
use crate::account_actions::AccountActions;
2624

2725
#[storage]
@@ -33,7 +31,7 @@ pub contract PasswordAccount {
3331
#[external("private")]
3432
#[initializer]
3533
fn constructor(password: Field) {
36-
let hashed_password = poseidon::poseidon2::Poseidon2::hash([password], 1);
34+
let hashed_password = poseidon2_hash([password]);
3735
self.enqueue_self.set_hashed_password(hashed_password);
3836

3937
// Safety: The sender for tags is only used to compute unconstrained shared secrets for emitting logs.
@@ -88,7 +86,7 @@ pub contract PasswordAccount {
8886

8987
let hashed_password_from_account = storage.hashed_password.read();
9088

91-
let hashed_password = poseidon::poseidon2::Poseidon2::hash([password], 1);
89+
let hashed_password = poseidon2_hash([password]);
9290

9391
hashed_password_from_account == hashed_password
9492
}
@@ -103,7 +101,7 @@ pub contract PasswordAccount {
103101
unconstrained fn lookup_validity(consumer: AztecAddress, inner_hash: Field, password: Field) -> bool {
104102
let hashed_password_from_account = self.storage.hashed_password.read();
105103

106-
let hashed_password = poseidon::poseidon2::Poseidon2::hash([password], 1);
104+
let hashed_password = poseidon2_hash([password]);
107105

108106
let valid_in_private = hashed_password_from_account == hashed_password;
109107

account-contract/ts/deploy-account-contract.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
// import { DeployAccountMethod, DeployAccountOptions } from '@aztec/aztec.js/wallet';
2-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
1+
import { AztecAddress } from '@aztec/aztec.js/addresses';
2+
import { Fr } from '@aztec/aztec.js/fields';
33
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
4+
import { Contract, DeployMethod, type DeployOptions } from '@aztec/aztec.js/contracts';
5+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
6+
import { deriveKeys } from '@aztec/aztec.js/keys';
47
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
5-
import { CardGameContract } from '@aztec/noir-contracts.js/CardGame';
68
import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/SponsoredFPC';
79
import { SPONSORED_FPC_SALT } from '@aztec/constants';
8-
import { Fr } from '@aztec/foundation/fields';
910
import { PasswordAccountContract } from './password-account-entrypoint';
10-
import { deriveKeys } from '@aztec/stdlib/keys';
11-
import { Contract, DeployMethod, DeployOptions } from '@aztec/aztec.js/contracts';
1211
import { TestWallet } from '@aztec/test-wallet/server';
13-
import { createAztecNodeClient } from '@aztec/aztec.js/node';
1412

1513
async function getSponsoredPFCContract() {
1614
const instance = await getContractInstanceFromInstantiationParams(
@@ -66,7 +64,7 @@ const accountContractDeployMethod = new DeployMethod(
6664
publicKeys,
6765
wallet,
6866
artifact,
69-
address => Contract.at(address, artifact, wallet),
67+
(instance, wallet) => Contract.at(instance.address, artifact, wallet),
7068
constructorArgs,
7169
constructorName,
7270
)
@@ -78,8 +76,8 @@ console.log(stats);
7876

7977
const deployedAccountContract = await accountContractDeployMethod.send(deployAccountOpts).wait();
8078

81-
await wallet.createAccount({ secret: Fr.random(), contract: passwordAccountContract, salt: Fr.random() });
82-
83-
const cardGameContract = await CardGameContract.deploy(wallet).send({ from: deployedAccountContract.contract.address }).deployed();
79+
console.log('PasswordAccount contract deployed at:', deployedAccountContract.contract.address);
8480

85-
console.log(cardGameContract)
81+
// Create and register an account using the deployed contract
82+
const account = await wallet.createAccount({ secret: Fr.random(), contract: passwordAccountContract, salt: Fr.random() });
83+
console.log('Account registered at:', account.address.toString());

account-contract/ts/password-account-entrypoint.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { Fr } from '@aztec/foundation/fields';
2-
import { ContractArtifact, type FunctionAbi, FunctionSelector, encodeArguments, loadContractArtifact } from '@aztec/stdlib/abi';
3-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1+
import { Fr } from '@aztec/aztec.js/fields';
2+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
3+
import { type ContractArtifact, type FunctionAbi, FunctionSelector, encodeArguments, loadContractArtifact } from '@aztec/stdlib/abi';
44
import type { GasSettings } from '@aztec/stdlib/gas';
5-
import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
6-
7-
import { AuthWitnessProvider, ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
8-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
9-
import { EncodedAppEntrypointCalls } from '@aztec/entrypoints/encoding';
10-
import { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
11-
import { AccountContract, AccountInterface } from '@aztec/aztec.js/account';
5+
import { HashedValues, TxContext, TxExecutionRequest, type ExecutionPayload } from '@aztec/stdlib/tx';
126
import { CompleteAddress } from '@aztec/stdlib/contract';
137
import { AuthWitness } from '@aztec/stdlib/auth-witness';
14-
import { NoirCompiledContract } from '@aztec/stdlib/noir';
8+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
9+
10+
import type { AuthWitnessProvider, ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
11+
import { EncodedAppEntrypointCalls } from '@aztec/entrypoints/encoding';
12+
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
13+
import type { AccountContract, AccountInterface } from '@aztec/aztec.js/account';
1514

1615
import PasswordAccountContractJson from '../target/custom_account-PasswordAccount.json' with { type: 'json' };
1716

@@ -81,6 +80,7 @@ export class PasswordAccountEntrypoint implements EntrypointInterface {
8180
functionType: 'private',
8281
isInternal: false,
8382
isStatic: false,
83+
isOnlySelf: false,
8484
parameters: [{"name":"app_payload","type":{"kind":"struct","fields":[{"name":"function_calls","type":{"kind":"array","length":5,"type":{"kind":"struct","fields":[{"name":"args_hash","type":{"kind":"field"}},{"name":"function_selector","type":{"kind":"struct","fields":[{"name":"inner","type":{"kind":"integer","sign":"unsigned","width":32}}],"path":"aztec::protocol_types::abis::function_selector::FunctionSelector"}},{"name":"target_address","type":{"kind":"struct","fields":[{"name":"inner","type":{"kind":"field"}}],"path":"aztec::protocol_types::address::aztec_address::AztecAddress"}},{"name":"is_public","type":{"kind":"boolean"}},{"name":"hide_msg_sender","type":{"kind":"boolean"}},{"name":"is_static","type":{"kind":"boolean"}}],"path":"aztec::authwit::entrypoint::function_call::FunctionCall"}}},{"name":"tx_nonce","type":{"kind":"field"}}],"path":"aztec::authwit::entrypoint::app::AppPayload"},"visibility":"private"},{"name":"fee_payment_method","type":{"kind":"integer","sign":"unsigned","width":8},"visibility":"private"},{"name":"cancellable","type":{"kind":"boolean"},"visibility":"private"},{"name":"password","type":{"kind":"field"},"visibility":"private"}],
8585
returnTypes: [],
8686
errorTypes: {},

0 commit comments

Comments
 (0)