From 243c74d0dba8e91b4f1dabea5ae8eccfa131b367 Mon Sep 17 00:00:00 2001 From: Josh Crites Date: Tue, 30 Jun 2026 09:41:18 -0400 Subject: [PATCH 1/3] Update testnet RPC endpoint to v5 --- config/testnet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/testnet.json b/config/testnet.json index 0d80561..401a692 100644 --- a/config/testnet.json +++ b/config/testnet.json @@ -2,7 +2,7 @@ "name": "testnet", "environment": "testnet", "network": { - "nodeUrl": "https://rpc.testnet.aztec-labs.com", + "nodeUrl": "https://v5.testnet.rpc.aztec-labs.com", "l1RpcUrl": "https://ethereum-sepolia-rpc.publicnode.com", "l1ChainId": 11155111 }, From b9817f5193997bf9547c0b6d592b49fb01f21100 Mon Sep 17 00:00:00 2001 From: Josh Crites Date: Tue, 30 Jun 2026 12:15:16 -0400 Subject: [PATCH 2/3] Update Aztec to 5.0.0-rc.2 for the v5 testnet The testnet node at v5.testnet.rpc.aztec-labs.com runs 5.0.0-rc.2; the 4.1.0 client failed with "Method not found: node_registerContractFunctionSignatures". Bump all @aztec packages, the aztec-nr dependency, config/toolchain versions, and docs to 5.0.0-rc.2, and migrate code for v5 breaking changes: - Noir: MessageDelivery moved to aztec::messages::delivery and now uses constructor syntax (MessageDelivery::onchain_constrained()). - Run TS scripts with tsx instead of ts-node/esm (ts-node's ESM loader cannot resolve @aztec/standard-contracts subpath-pattern exports that @aztec/pxe now imports at runtime). - AztecAddress.fromString -> AztecAddress.fromStringUnsafe. - from: AztecAddress.ZERO -> NO_FROM for account/contract deployments. - Deploy: pass salt via deploy options and read contract/instance from the send result (returnReceipt option removed). - GasSettings.fallback now requires explicit gasLimits. - Fee-juice claims: wait for the bridged L1->L2 message to be available before claiming (rc.2 needs more than two blocks for the message to sync to L2). --- CLAUDE.md | 2 +- Nargo.toml | 2 +- ONBOARDING.md | 45 +- README.md | 2 +- config/local-network.json | 2 +- config/testnet.json | 2 +- docs/ONBOARDING.src.md | 6 +- package.json | 69 +- scripts/deploy_contract.ts | 14 +- scripts/fees.ts | 42 +- scripts/interaction_existing_contract.ts | 8 +- scripts/multiple_wallet.ts | 16 +- scripts/read_debug_logs.ts | 7 +- src/main.nr | 4 +- src/test/e2e/accounts.test.ts | 72 +- src/test/e2e/index.test.ts | 25 +- src/test/e2e/public_logging.test.ts | 12 +- src/utils/deploy_account.ts | 6 +- src/utils/sponsored_fpc.ts | 9 +- yarn.lock | 1069 ++++++++++------------ 20 files changed, 699 insertions(+), 715 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 48dae3a..320fd67 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co Aztec Starter — a Pod Racing game contract built with Noir on the Aztec network. Two players allocate points across 5 tracks over 3 rounds with private state; scores are revealed at the end (commit-reveal pattern). The player who wins more tracks (best of 5) wins. -**Aztec version: `4.1.0`** — pinned across `Nargo.toml`, `package.json`, `config/*.json`, and README. All must stay in sync when updating. +**Aztec version: `5.0.0-rc.2`** — pinned across `Nargo.toml`, `package.json`, `config/*.json`, and README. All must stay in sync when updating. ## Build & Development Commands diff --git a/Nargo.toml b/Nargo.toml index 17a7b4b..34a5098 100644 --- a/Nargo.toml +++ b/Nargo.toml @@ -5,4 +5,4 @@ authors = [ "" ] compiler_version = ">=0.18.0" [dependencies] -aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v4.1.0", directory = "aztec" } +aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v5.0.0-rc.2", directory = "aztec" } diff --git a/ONBOARDING.md b/ONBOARDING.md index 2b202a9..9b03b68 100644 --- a/ONBOARDING.md +++ b/ONBOARDING.md @@ -9,7 +9,7 @@ This guide takes you from "reading code in a browser" to "deploying on devnet" * **Phases 1-2** need only a browser (read code, compile in a Codespace) * **Phases 3-6** need local tools (deploy, interact, extend, advanced topics) -**Aztec version pinned in this repo:** `4.1.0` (check `Nargo.toml` and `package.json` for source of truth) +**Aztec version pinned in this repo:** `5.0.0-rc.2` (check `Nargo.toml` and `package.json` for source of truth) **Links:** @@ -101,7 +101,7 @@ struct Storage { } ``` -Source code: /src/main.nr#Lstorage +Source code: /src/main.nr#Lstorage **What is `Context`?** You'll notice `Context` appears as a generic parameter throughout the storage definition. In Aztec, the context is the execution environment passed to every function — it's how your contract accesses blockchain state like `context.msg_sender()` (the caller's address) and `context.block_number()`. Think of it as an expanded version of Solidity's global variables (`msg.sender`, `block.number`, etc.), but packaged as an object. The `` generic on storage types lets the same storage struct work in both public and private execution contexts. You don't need to construct it yourself — the framework provides `self.context` automatically in every contract function. @@ -149,7 +149,7 @@ fn constructor(admin: AztecAddress) { } ``` -Source code: /src/main.nr#Lconstructor +Source code: /src/main.nr#Lconstructor Sets the admin address. The `#[initializer]` macro means this runs once at deployment, like a Solidity constructor. @@ -180,7 +180,7 @@ fn create_game(game_id: Field) { } ``` -Source code: /src/main.nr#Lcreate-game +Source code: /src/main.nr#Lcreate-game Creates a new game. Checks the game ID isn't taken (player1 must be zero address), then writes a new `Race` struct with the caller as player1 and an expiration time. @@ -202,7 +202,7 @@ fn join_game(game_id: Field) { } ``` -Source code: /src/main.nr#Ljoin-game +Source code: /src/main.nr#Ljoin-game A second player joins. The `Race::join()` method validates that player1 exists, the player2 slot is empty, and the joiner isn't player1. @@ -236,7 +236,7 @@ fn finalize_game(game_id: Field) { } ``` -Source code: /src/main.nr#Lfinalize-game +Source code: /src/main.nr#Lfinalize-game After both players have revealed, this compares track scores, determines the winner, and updates the leaderboard. @@ -280,7 +280,7 @@ pub struct Race { } ``` -Source code: /src/race.nr#Lrace-struct +Source code: /src/race.nr#Lrace-struct Key methods: @@ -332,7 +332,7 @@ fn play_round( .at(game_id) .at(player) .insert(GameRoundNote::new(track1, track2, track3, track4, track5, round, player)) - .deliver(MessageDelivery.ONCHAIN_CONSTRAINED); + .deliver(MessageDelivery::onchain_constrained()); // Enqueue a public function call to update the round counter // This reveals that a round was played, but not the point allocation @@ -344,7 +344,7 @@ fn play_round( } ``` -Source code: /src/main.nr#Lplay-round +Source code: /src/main.nr#Lplay-round Three things happen here that have no direct Ethereum equivalent: @@ -406,7 +406,7 @@ fn finish_game(game_id: Field) { } ``` -Source code: /src/main.nr#Lfinish-game +Source code: /src/main.nr#Lfinish-game This is the "reveal" phase: @@ -442,7 +442,7 @@ pub struct GameRoundNote { } ``` -Source code: /src/game_round_note.nr#Lgame-round-note +Source code: /src/game_round_note.nr#Lgame-round-note The `#[note]` macro makes this a private state primitive. Each note stores one round's point allocation and the owner's address. Only the owner can read it. @@ -526,7 +526,7 @@ The `.devcontainer/` configures: * **Base image:** Ubuntu 24.04 with Node.js v22.15.0 * **Docker-in-Docker** for running the Aztec local network -* **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/4.1.0" | VERSION="4.1.0" bash -s` +* **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/5.0.0-rc.2" | VERSION="5.0.0-rc.2" bash -s` * **VS Code extension:** `noir-lang.vscode-noir` for Noir syntax highlighting * **Dependencies:** `yarn install` runs automatically @@ -586,7 +586,7 @@ unconstrained fn test_initializer() { } ``` -Source code: /src/test/pod_racing.nr#Ltest-initializer +Source code: /src/test/pod_racing.nr#Ltest-initializer The `unconstrained` keyword means this test runs outside the ZK circuit (it's a test, not a provable function). `utils::setup()` deploys a fresh contract and returns the environment, contract address, and admin. @@ -611,7 +611,7 @@ unconstrained fn test_fail_play_round_too_many_points() { } ``` -Source code: /src/test/pod_racing.nr#Ltest-fail-too-many-points +Source code: /src/test/pod_racing.nr#Ltest-fail-too-many-points The `#[test(should_fail)]` attribute is like Foundry's `vm.expectRevert()`. @@ -646,7 +646,7 @@ pub unconstrained fn max_allocation() -> (u8, u8, u8, u8, u8) { } ``` -Source code: /src/test/helpers.nr#Lallocation-strategies +Source code: /src/test/helpers.nr#Lallocation-strategies And higher-level helpers: @@ -694,7 +694,7 @@ pub unconstrained fn play_all_rounds_with_strategy( } ``` -Source code: /src/test/helpers.nr#Lsetup-helpers +Source code: /src/test/helpers.nr#Lsetup-helpers #### Test setup (`src/test/utils.nr`) @@ -715,7 +715,7 @@ pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) { } ``` -Source code: /src/test/utils.nr#Ltest-setup +Source code: /src/test/utils.nr#Ltest-setup **Ethereum analogies:** @@ -737,7 +737,7 @@ pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) { **Aztec toolkit:** ```bash -export VERSION=4.1.0 +export VERSION=5.0.0-rc.2 curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s ``` @@ -849,7 +849,7 @@ export async function getSponsoredFPCInstance(): PromiseSource code: /src/utils/sponsored_fpc.ts#Lget-sponsored-fpc +Source code: /src/utils/sponsored_fpc.ts#Lget-sponsored-fpc **Run it:** @@ -880,15 +880,14 @@ const deployRequest = PodRacingContract.deploy(wallet, address); await deployRequest.simulate({ from: address, }); -const { receipt } = await deployRequest.send({ +const { contract: podRacingContract, instance } = await deployRequest.send({ from: address, fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: timeouts.deployTimeout, returnReceipt: true } + wait: { timeout: timeouts.deployTimeout } }); -const podRacingContract = receipt.contract; ``` -Source code: /scripts/deploy_contract.ts#Ldeploy-contract +Source code: /scripts/deploy_contract.ts#Ldeploy-contract > **Important:** Always call `.simulate()` before `.send()`. Simulation runs the transaction locally and surfaces revert reasons immediately. Without it, a failing transaction hangs until timeout with an opaque error. diff --git a/README.md b/README.md index 1566f0a..822ddfc 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Use **Node.js version 22.15.0**. Install the **Aztec toolkit** (local network, CLI, and other tooling) at the correct version: ```bash -export VERSION=4.1.0 +export VERSION=5.0.0-rc.2 curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s ``` diff --git a/config/local-network.json b/config/local-network.json index fd812ac..ad0c8f7 100644 --- a/config/local-network.json +++ b/config/local-network.json @@ -8,7 +8,7 @@ }, "settings": { "skipLocalNetwork": false, - "version": "4.1.0" + "version": "5.0.0-rc.2" }, "timeouts": { "deployTimeout": 120000, diff --git a/config/testnet.json b/config/testnet.json index 401a692..9c0ed66 100644 --- a/config/testnet.json +++ b/config/testnet.json @@ -8,7 +8,7 @@ }, "settings": { "skipLocalNetwork": true, - "version": "4.1.0" + "version": "5.0.0-rc.2" }, "timeouts": { "deployTimeout": 1200000, diff --git a/docs/ONBOARDING.src.md b/docs/ONBOARDING.src.md index 69c7fcc..e7f99ec 100644 --- a/docs/ONBOARDING.src.md +++ b/docs/ONBOARDING.src.md @@ -9,7 +9,7 @@ This guide takes you from "reading code in a browser" to "deploying on devnet" - **Phases 1-2** need only a browser (read code, compile in a Codespace) - **Phases 3-6** need local tools (deploy, interact, extend, advanced topics) -**Aztec version pinned in this repo:** `4.1.0` (check `Nargo.toml` and `package.json` for source of truth) +**Aztec version pinned in this repo:** `5.0.0-rc.2` (check `Nargo.toml` and `package.json` for source of truth) **Links:** @@ -262,7 +262,7 @@ The `.devcontainer/` configures: - **Base image:** Ubuntu 24.04 with Node.js v22.15.0 - **Docker-in-Docker** for running the Aztec local network -- **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/4.1.0" | VERSION="4.1.0" bash -s` +- **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/5.0.0-rc.2" | VERSION="5.0.0-rc.2" bash -s` - **VS Code extension:** `noir-lang.vscode-noir` for Noir syntax highlighting - **Dependencies:** `yarn install` runs automatically @@ -357,7 +357,7 @@ And higher-level helpers: **Aztec toolkit:** ```bash -export VERSION=4.1.0 +export VERSION=5.0.0-rc.2 curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s ``` diff --git a/package.json b/package.json index 1a7bbab..f184124 100644 --- a/package.json +++ b/package.json @@ -8,34 +8,34 @@ "private": true, "type": "module", "scripts": { - "fees": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/fees.ts", - "fees::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/fees.ts", - "fees::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/fees.ts", + "fees": "NODE_NO_WARNINGS=1 tsx scripts/fees.ts", + "fees::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/fees.ts", + "fees::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/fees.ts", "clean": "rm -rf ./src/artifacts ./target ./codegenCache.json", "clear-store": "rm -rf ./store", "codegen": "aztec codegen target --outdir src/artifacts", "compile": "aztec compile", - "deploy": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/deploy_contract.ts", - "deploy::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/deploy_contract.ts", - "deploy::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/deploy_contract.ts", - "deploy-account": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/deploy_account.ts", - "deploy-account::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/deploy_account.ts", - "deploy-account::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/deploy_account.ts", - "interaction-existing-contract": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/interaction_existing_contract.ts", - "interaction-existing-contract::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/interaction_existing_contract.ts", - "interaction-existing-contract::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/interaction_existing_contract.ts", - "multiple-wallet": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/multiple_wallet.ts", - "multiple-wallet::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/multiple_wallet.ts", - "multiple-wallet::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/multiple_wallet.ts", - "get-block": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/get_block.ts", - "get-block::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/get_block.ts", - "get-block::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/get_block.ts", - "profile": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/profile_deploy.ts", - "profile::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/profile_deploy.ts", - "profile::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet node --loader ts-node/esm scripts/profile_deploy.ts", - "read-logs": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' node --loader ts-node/esm scripts/read_debug_logs.ts", - "read-logs::devnet": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' AZTEC_ENV=devnet node --loader ts-node/esm scripts/read_debug_logs.ts", - "read-logs::testnet": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' AZTEC_ENV=testnet node --loader ts-node/esm scripts/read_debug_logs.ts", + "deploy": "NODE_NO_WARNINGS=1 tsx scripts/deploy_contract.ts", + "deploy::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/deploy_contract.ts", + "deploy::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/deploy_contract.ts", + "deploy-account": "NODE_NO_WARNINGS=1 tsx scripts/deploy_account.ts", + "deploy-account::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/deploy_account.ts", + "deploy-account::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/deploy_account.ts", + "interaction-existing-contract": "NODE_NO_WARNINGS=1 tsx scripts/interaction_existing_contract.ts", + "interaction-existing-contract::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/interaction_existing_contract.ts", + "interaction-existing-contract::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/interaction_existing_contract.ts", + "multiple-wallet": "NODE_NO_WARNINGS=1 tsx scripts/multiple_wallet.ts", + "multiple-wallet::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/multiple_wallet.ts", + "multiple-wallet::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/multiple_wallet.ts", + "get-block": "NODE_NO_WARNINGS=1 tsx scripts/get_block.ts", + "get-block::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/get_block.ts", + "get-block::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/get_block.ts", + "profile": "NODE_NO_WARNINGS=1 tsx scripts/profile_deploy.ts", + "profile::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet tsx scripts/profile_deploy.ts", + "profile::testnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=testnet tsx scripts/profile_deploy.ts", + "read-logs": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' tsx scripts/read_debug_logs.ts", + "read-logs::devnet": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' AZTEC_ENV=devnet tsx scripts/read_debug_logs.ts", + "read-logs::testnet": "NODE_NO_WARNINGS=1 LOG_LEVEL='info; debug:contract_log' AZTEC_ENV=testnet tsx scripts/read_debug_logs.ts", "test": "yarn test:js && yarn test:nr", "test::devnet": "AZTEC_ENV=devnet yarn test:js", "test::testnet": "AZTEC_ENV=testnet yarn test:js", @@ -45,16 +45,16 @@ "update-readme-version": "node ./.github/scripts/update-readme-version.js" }, "dependencies": { - "@aztec/accounts": "4.1.0", - "@aztec/aztec.js": "4.1.0", - "@aztec/constants": "4.1.0", - "@aztec/entrypoints": "4.1.0", - "@aztec/noir-contracts.js": "4.1.0", - "@aztec/protocol-contracts": "4.1.0", - "@aztec/pxe": "4.1.0", - "@aztec/stdlib": "4.1.0", - "@aztec/wallet-sdk": "4.1.0", - "@aztec/wallets": "4.1.0", + "@aztec/accounts": "5.0.0-rc.2", + "@aztec/aztec.js": "5.0.0-rc.2", + "@aztec/constants": "5.0.0-rc.2", + "@aztec/entrypoints": "5.0.0-rc.2", + "@aztec/noir-contracts.js": "5.0.0-rc.2", + "@aztec/protocol-contracts": "5.0.0-rc.2", + "@aztec/pxe": "5.0.0-rc.2", + "@aztec/stdlib": "5.0.0-rc.2", + "@aztec/wallet-sdk": "5.0.0-rc.2", + "@aztec/wallets": "5.0.0-rc.2", "dotenv": "^17.2.2" }, "devDependencies": { @@ -67,6 +67,7 @@ "remark-cli": "^12.0.1", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", + "tsx": "^4.22.4", "typescript": "^5.4.4" }, "jest": { diff --git a/scripts/deploy_contract.ts b/scripts/deploy_contract.ts index a00526a..36a6eda 100644 --- a/scripts/deploy_contract.ts +++ b/scripts/deploy_contract.ts @@ -46,14 +46,12 @@ async function main() { await deployRequest.simulate({ from: address, }); - const { receipt } = await deployRequest.send({ + const { contract: podRacingContract, instance } = await deployRequest.send({ from: address, fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: timeouts.deployTimeout, returnReceipt: true } + wait: { timeout: timeouts.deployTimeout } }); - const podRacingContract = receipt.contract; // docs:end:deploy-contract - const instance = receipt.instance; logger.info(`🎉 Pod Racing Contract deployed successfully!`); logger.info(`📍 Contract address: ${podRacingContract.address}`); @@ -69,10 +67,10 @@ async function main() { logger.info(`Salt: ${instance.salt}`); logger.info(`Deployer: ${instance.deployer}`); if (instance.publicKeys) { - logger.info(`Public Keys - Master Nullifier: ${instance.publicKeys.masterNullifierPublicKey}`); - logger.info(`Public Keys - Master Incoming Viewing: ${instance.publicKeys.masterIncomingViewingPublicKey}`); - logger.info(`Public Keys - Master Outgoing Viewing: ${instance.publicKeys.masterOutgoingViewingPublicKey}`); - logger.info(`Public Keys - Master Tagging: ${instance.publicKeys.masterTaggingPublicKey}`); + logger.info(`Public Keys - Master Nullifier: ${instance.publicKeys.npkMHash}`); + logger.info(`Public Keys - Master Incoming Viewing: ${instance.publicKeys.ivpkM}`); + logger.info(`Public Keys - Master Outgoing Viewing: ${instance.publicKeys.ovpkMHash}`); + logger.info(`Public Keys - Master Tagging: ${instance.publicKeys.tpkMHash}`); } logger.info(`Constructor args: ${JSON.stringify([address.toString()])}`); } diff --git a/scripts/fees.ts b/scripts/fees.ts index 69cf90d..1503d0a 100644 --- a/scripts/fees.ts +++ b/scripts/fees.ts @@ -22,8 +22,10 @@ import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/Sponsored import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice'; import { createAztecNodeClient } from '@aztec/aztec.js/node'; import { AztecAddress } from '@aztec/aztec.js/addresses'; +import { NO_FROM } from '@aztec/aztec.js/account'; import { getAztecNodeUrl, getTimeouts } from '../config/config.js'; -import { GasSettings } from '@aztec/stdlib/gas'; +import { GasSettings, Gas } from '@aztec/stdlib/gas'; +import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging'; const MNEMONIC = 'test test test test test test test test test test test junk'; const FEE_FUNDING_FOR_TESTER_ACCOUNT = 1000000000000000000000n; @@ -70,6 +72,29 @@ async function main() { const paymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address); const timeouts = getTimeouts(); + // A bridged L1->L2 message only becomes consumable once the sequencer has synced + // the L1 deposit and progressed enough L2 blocks. Progress blocks (by deploying + // arbitrary contracts) until the claim's message is available before claiming. + const feeJuiceAddress = nodeInfo.protocolContractAddresses.feeJuice; + const waitForClaimReady = async (claimToCheck: { messageHash: string, claimSecret: Fr }) => { + const isReady = async () => !!(await getNonNullifiedL1ToL2MessageWitness( + node, + feeJuiceAddress, + Fr.fromHexString(claimToCheck.messageHash), + claimToCheck.claimSecret, + ).catch(() => undefined)); + for (let attempt = 0; attempt < 10 && !(await isReady()); attempt++) { + await PodRacingContract.deploy(wallet, account1.address).send({ + from: account1.address, + fee: { paymentMethod }, + wait: { timeout: timeouts.deployTimeout } + }); + } + if (!(await isReady())) { + throw new Error('L1->L2 message did not become available after progressing blocks'); + } + }; + // Two arbitrary txs to make the L1 message available on L2 // Simulate before sending to surface revert reasons const podRacingDeploy = PodRacingContract.deploy(wallet, account1.address); @@ -90,9 +115,10 @@ async function main() { // Claim Fee Juice & Pay Fees yourself + await waitForClaimReady(claim); const claimAndPay = new FeeJuicePaymentMethodWithClaim(account2.address, claim); const deployMethod = await account2.getDeployMethod(); - await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod: claimAndPay }, wait: { timeout: timeouts.deployTimeout } }); + await deployMethod.send({ from: NO_FROM, fee: { paymentMethod: claimAndPay }, wait: { timeout: timeouts.deployTimeout } }); logger.info(`New account at ${account2.address} deployed using claimed funds for fees.`) // Pay fees yourself @@ -135,25 +161,25 @@ async function main() { fee: { paymentMethod }, wait: { timeout: timeouts.txTimeout } }); - const bananaBalanceResult = await bananaCoin.methods.balance_of_private(account2.address).simulate({ + const { result: bananaBalance } = await bananaCoin.methods.balance_of_private(account2.address).simulate({ from: account2.address }); - logger.info(`BananaCoin balance of newWallet is ${bananaBalanceResult.result ?? bananaBalanceResult}`) + logger.info(`BananaCoin balance of newWallet is ${bananaBalance}`) const feeJuiceInstance = await getCanonicalFeeJuice(); await wallet.registerContract(feeJuiceInstance.instance, FeeJuiceContract.artifact); const feeJuice = await FeeJuiceContract.at(feeJuiceInstance.address, wallet); + await waitForClaimReady(fpcClaim); await feeJuice.methods.claim(fpc.address, fpcClaim.claimAmount, fpcClaim.claimSecret, fpcClaim.messageLeafIndex).send({ from: account2.address, wait: { timeout: timeouts.txTimeout } }); - const fpcBalance = await feeJuice.methods.balance_of_public(fpc.address).simulate({ + logger.info(`Fpc fee juice balance ${(await feeJuice.methods.balance_of_public(fpc.address).simulate({ from: account2.address - }); - logger.info(`Fpc fee juice balance ${fpcBalance.result ?? fpcBalance}`); + })).result}`); const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1.5); - const gasSettings = GasSettings.default({ maxFeesPerGas }); + const gasSettings = GasSettings.fallback({ gasLimits: Gas.from(nodeInfo.txsLimits.gas), maxFeesPerGas }); const privateFee = new PrivateFeePaymentMethod(fpc.address, account2.address, wallet, gasSettings); await bananaCoin.methods.transfer_in_private(account2.address, account1.address, 10, 0).simulate({ from: account2.address }); diff --git a/scripts/interaction_existing_contract.ts b/scripts/interaction_existing_contract.ts index b7ba3e9..f3f72b7 100644 --- a/scripts/interaction_existing_contract.ts +++ b/scripts/interaction_existing_contract.ts @@ -8,7 +8,7 @@ import { setupWallet } from "../src/utils/setup_wallet.js"; import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js"; import { getAccountFromEnv } from "../src/utils/create_account_from_env.js"; import { getTimeouts } from "../config/config.js"; -import { getContractInstanceFromInstantiationParams } from "@aztec/stdlib/contract"; +import { getContractInstanceFromInstantiationParams } from "@aztec/aztec.js/contracts"; async function main() { let logger: Logger; @@ -57,7 +57,7 @@ async function main() { .trim() // Remove leading/trailing whitespace .replace(/^['"]|['"]$/g, ''); // Remove surrounding quotes from .env parsing - constructorArgs = JSON.parse(cleanedJson).map((arg: string) => AztecAddress.fromString(arg)); + constructorArgs = JSON.parse(cleanedJson).map((arg: string) => AztecAddress.fromStringUnsafe(arg)); } catch (error) { logger.error(`Failed to parse constructor args: ${constructorArgsJson}`); logger.error(`Error: ${error}`); @@ -65,12 +65,12 @@ async function main() { } // Reconstruct contract instance - const podRacingContractAddress = AztecAddress.fromString(contractAddress); + const podRacingContractAddress = AztecAddress.fromStringUnsafe(contractAddress); const instance = await getContractInstanceFromInstantiationParams(PodRacingContract.artifact, { constructorArgs, salt: Fr.fromString(contractSalt), - deployer: AztecAddress.fromString(contractDeployer) + deployer: AztecAddress.fromStringUnsafe(contractDeployer) }); logger.info("✅ Contract instance reconstructed successfully"); diff --git a/scripts/multiple_wallet.ts b/scripts/multiple_wallet.ts index a432c37..067aa7c 100644 --- a/scripts/multiple_wallet.ts +++ b/scripts/multiple_wallet.ts @@ -1,6 +1,6 @@ import { Fr } from "@aztec/aztec.js/fields"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; -import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee"; import { createAztecNodeClient } from "@aztec/aztec.js/node"; import { TokenContract } from "@aztec/noir-contracts.js/Token" @@ -36,19 +36,19 @@ async function main() { let salt = Fr.random(); let schnorrAccount = await wallet1.createSchnorrAccount(secretKey, salt, signingKey); const deployMethod = await schnorrAccount.getDeployMethod(); - await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout } }); + await deployMethod.send({ from: NO_FROM, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout } }); let ownerAddress = schnorrAccount.address; // Simulate before sending to surface revert reasons - const tokenDeploy = TokenContract.deploy(wallet1, ownerAddress, 'Clean USDC', 'USDC', 6); + const tokenDeploy = TokenContract.deploy(wallet1, ownerAddress, 'Clean USDC', 'USDC', 6, { + salt: L2_TOKEN_CONTRACT_SALT, + }); await tokenDeploy.simulate({ from: ownerAddress }); - const { receipt } = await tokenDeploy.send({ + const { contract: token } = await tokenDeploy.send({ from: ownerAddress, - contractAddressSalt: L2_TOKEN_CONTRACT_SALT, fee: { paymentMethod }, - wait: { timeout: timeouts.deployTimeout, returnReceipt: true } + wait: { timeout: timeouts.deployTimeout } }); - const token = receipt.contract; // setup account on 2nd pxe @@ -61,7 +61,7 @@ async function main() { // deploy account on 2nd pxe const deployMethod2 = await schnorrAccount2.getDeployMethod(); - await deployMethod2.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout } }); + await deployMethod2.send({ from: NO_FROM, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout } }); let wallet2Address = schnorrAccount2.address; await wallet2.registerSender(ownerAddress, '') diff --git a/scripts/read_debug_logs.ts b/scripts/read_debug_logs.ts index cb65ebd..62a81ef 100644 --- a/scripts/read_debug_logs.ts +++ b/scripts/read_debug_logs.ts @@ -14,8 +14,9 @@ import { PodRacingContract } from "../src/artifacts/PodRacing.js"; import { createLogger } from "@aztec/foundation/log"; import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee"; import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC"; -import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { Fr } from "@aztec/aztec.js/fields"; +import { AztecAddress } from "@aztec/aztec.js/addresses"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; import { setupWallet } from "../src/utils/setup_wallet.js"; import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js"; @@ -36,14 +37,14 @@ async function main() { // Create two player accounts const p1Account = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random()); await (await p1Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout }, }); const p2Account = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random()); await (await p2Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout }, }); diff --git a/src/main.nr b/src/main.nr index ef6477d..173a9e2 100644 --- a/src/main.nr +++ b/src/main.nr @@ -24,7 +24,7 @@ use ::aztec::macros::aztec; pub contract PodRacing { use ::aztec::{ macros::{functions::{external, initializer, only_self}, storage::storage}, - messages::message_delivery::MessageDelivery, + messages::delivery::MessageDelivery, note::note_getter_options::NoteGetterOptions, oracle::logging::debug_log_format, }; @@ -147,7 +147,7 @@ pub contract PodRacing { .at(game_id) .at(player) .insert(GameRoundNote::new(track1, track2, track3, track4, track5, round, player)) - .deliver(MessageDelivery.ONCHAIN_CONSTRAINED); + .deliver(MessageDelivery::onchain_constrained()); // Enqueue a public function call to update the round counter // This reveals that a round was played, but not the point allocation diff --git a/src/test/e2e/accounts.test.ts b/src/test/e2e/accounts.test.ts index 7e841dd..75996b4 100644 --- a/src/test/e2e/accounts.test.ts +++ b/src/test/e2e/accounts.test.ts @@ -12,8 +12,10 @@ import { EmbeddedWallet } from "@aztec/wallets/embedded"; import { type AztecNode, createAztecNodeClient } from "@aztec/aztec.js/node"; import { L1FeeJuicePortalManager, type L2AmountClaim } from "@aztec/aztec.js/ethereum"; import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { type Logger, createLogger } from "@aztec/foundation/log"; -import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from "@aztec/stdlib/contract"; +import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from "@aztec/aztec.js/contracts"; +import { getNonNullifiedL1ToL2MessageWitness } from "@aztec/stdlib/messaging"; import { Fr } from "@aztec/aztec.js/fields"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; import { ContractDeployer } from "@aztec/aztec.js/deployment"; @@ -68,7 +70,7 @@ describe("Accounts", () => { let salt = Fr.random(); ownerAccount = await wallet.createSchnorrAccount(secretKey, salt, signingKey); await (await ownerAccount.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -116,29 +118,42 @@ describe("Accounts", () => { } console.log(`Total claims created: ${claims.length}`); - // arbitrary transactions to progress 2 blocks, and have fee juice on Aztec ready to claim - console.log('Deploying first PodRacingContract to progress blocks...'); - await PodRacingContract.deploy(wallet, ownerAccount.address).send({ - from: ownerAccount.address, - fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: getTimeouts().deployTimeout } - }); - console.log('First PodRacingContract deployed'); - - console.log('Deploying second PodRacingContract to progress blocks...'); - await PodRacingContract.deploy(wallet, ownerAccount.address).send({ - from: ownerAccount.address, - fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: getTimeouts().deployTimeout } - }); - console.log('Second PodRacingContract deployed'); + // The bridged L1->L2 messages only become consumable once the sequencer has + // synced the L1 deposits and progressed enough L2 blocks. Progress blocks (by + // deploying arbitrary contracts) until every claim's message is available on L2. + const messagesAvailable = async () => { + for (const claim of claims) { + const witness = await getNonNullifiedL1ToL2MessageWitness( + node, + feeJuiceAddress, + Fr.fromHexString(claim.messageHash), + claim.claimSecret, + ).catch(() => undefined); + if (!witness) return false; + } + return true; + }; + + console.log('Progressing blocks until L1->L2 messages are available...'); + for (let attempt = 0; attempt < 10 && !(await messagesAvailable()); attempt++) { + console.log(`Deploying PodRacingContract to progress blocks (attempt ${attempt + 1})...`); + await PodRacingContract.deploy(wallet, ownerAccount.address).send({ + from: ownerAccount.address, + fee: { paymentMethod: sponsoredPaymentMethod }, + wait: { timeout: getTimeouts().deployTimeout } + }); + } + if (!(await messagesAvailable())) { + throw new Error('L1->L2 messages did not become available after progressing blocks'); + } + console.log('L1->L2 messages available on L2'); // Now deploy random accounts using FeeJuicePaymentMethodWithClaim (which claims and pays in one tx) console.log('Starting account deployments with FeeJuicePaymentMethodWithClaim...'); for (let i = 0; i < randomAccountManagers.length; i++) { const paymentMethod = new FeeJuicePaymentMethodWithClaim(randomAddresses[i], claims[i]); await (await randomAccountManagers[i].getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -146,15 +161,15 @@ describe("Accounts", () => { }); it("Deploys first unfunded account from first funded account", async () => { - const receipt = await (await randomAccountManagers[0].getDeployMethod()) + const { receipt } = await (await randomAccountManagers[0].getDeployMethod()) .send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: getTimeouts().deployTimeout, returnReceipt: true } + wait: { timeout: getTimeouts().deployTimeout } }); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(receipt.receipt.status); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(receipt.status); const deployedAccount = await randomAccountManagers[0].getAccount(); expect(deployedAccount.getAddress()).toEqual(randomAccountManagers[0].address); @@ -178,7 +193,7 @@ describe("Accounts", () => { await Promise.all(accounts.map(async (a, i) => { logger.info(`Deploying account ${i}: ${a.address.toString()}`); return (await a.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -198,19 +213,18 @@ describe("Accounts", () => { deployer: deployerAccount.getAddress() }); const deployer = new ContractDeployer(PodRacingArtifact, wallet); - const receipt = await deployer.deploy(adminAddress).send({ + const { contract: deployedContract, receipt } = await deployer.deploy([adminAddress], { salt, deployer: deployerAccount.getAddress() }).send({ from: deployerAddress, - contractAddressSalt: salt, fee: { paymentMethod: sponsoredPaymentMethod }, - wait: { timeout: getTimeouts().deployTimeout, returnReceipt: true } + wait: { timeout: getTimeouts().deployTimeout } }); expect(await wallet.getContractMetadata(deploymentData.address)).toBeDefined(); const metadata = await wallet.getContractMetadata(deploymentData.address); expect(metadata.instance).toBeTruthy(); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(receipt.receipt.status); - expect(receipt.receipt.contract.address).toEqual(deploymentData.address); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(receipt.status); + expect(deployedContract.address).toEqual(deploymentData.address); }) }); diff --git a/src/test/e2e/index.test.ts b/src/test/e2e/index.test.ts index 4ba8cfb..7f35400 100644 --- a/src/test/e2e/index.test.ts +++ b/src/test/e2e/index.test.ts @@ -8,8 +8,9 @@ import { setupWallet } from "../../utils/setup_wallet.js"; import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC"; import { getTimeouts } from "../../../config/config.js"; import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { type Logger, createLogger } from "@aztec/foundation/log"; -import { type ContractInstanceWithAddress } from "@aztec/stdlib/contract"; +import { type ContractInstanceWithAddress } from "@aztec/aztec.js/contracts"; import { Fr } from "@aztec/aztec.js/fields"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; import { TxStatus } from "@aztec/stdlib/tx"; @@ -54,7 +55,7 @@ async function playRound( strategy.track1, strategy.track2, strategy.track3, strategy.track4, strategy.track5 ).simulate({ from: playerAccount }); - return await contract.methods.play_round( + const { receipt } = await contract.methods.play_round( gameId, round, strategy.track1, @@ -67,6 +68,7 @@ async function playRound( fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout } }); + return receipt; } // Helper to setup a game (create + join) @@ -119,7 +121,7 @@ describe("Pod Racing Game", () => { let salt1 = Fr.random(); player1Account = await wallet.createSchnorrAccount(secretKey1, salt1, signingKey1); await (await player1Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -129,7 +131,7 @@ describe("Pod Racing Game", () => { let salt2 = Fr.random(); player2Account = await wallet.createSchnorrAccount(secretKey2, salt2, signingKey2); await (await player2Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -141,12 +143,11 @@ describe("Pod Racing Game", () => { // Deploy the contract once for all tests logger.info('Deploying Pod Racing contract...'); const adminAddress = player1Account.address; - const deployResult = await PodRacingContract.deploy(wallet, adminAddress).send({ + ({ contract } = await PodRacingContract.deploy(wallet, adminAddress).send({ from: adminAddress, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } - }); - contract = deployResult.contract; + })); logger.info(`Contract deployed at: ${contract.address.toString()}`); }, 600000) @@ -161,14 +162,14 @@ describe("Pod Racing Game", () => { logger.info('Starting create game test'); const gameId = new Fr(TEST_GAME_IDS.CREATE); - const tx = await contract.methods.create_game(gameId).send({ + const { receipt: tx } = await contract.methods.create_game(gameId).send({ from: player1Account.address, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().txTimeout } }); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.receipt.status); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.status); logger.info('Game created successfully'); }, 600000) @@ -215,7 +216,7 @@ describe("Pod Racing Game", () => { ); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(playTx.receipt.status); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(playTx.status); logger.info('Round played successfully'); }, 600000) @@ -385,7 +386,7 @@ describe("Pod Racing Game", () => { ); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.receipt.status); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.status); logger.info('Max points allocation successful'); }, 600000) @@ -414,7 +415,7 @@ describe("Pod Racing Game", () => { ); // Transaction succeeded if we got here - status could be PROPOSED, CHECKPOINTED, PROVEN, or FINALIZED - expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.receipt.status); + expect([TxStatus.PROPOSED, TxStatus.CHECKPOINTED, TxStatus.PROVEN, TxStatus.FINALIZED]).toContain(tx.status); logger.info('Zero points allocation successful'); }, 600000) }); diff --git a/src/test/e2e/public_logging.test.ts b/src/test/e2e/public_logging.test.ts index 9778404..db8ace7 100644 --- a/src/test/e2e/public_logging.test.ts +++ b/src/test/e2e/public_logging.test.ts @@ -16,8 +16,9 @@ import { setupWallet } from "../../utils/setup_wallet.js"; import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC"; import { getTimeouts } from "../../../config/config.js"; import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { type Logger, createLogger } from "@aztec/foundation/log"; -import { type ContractInstanceWithAddress } from "@aztec/stdlib/contract"; +import { type ContractInstanceWithAddress } from "@aztec/aztec.js/contracts"; import { Fr } from "@aztec/aztec.js/fields"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; import { EmbeddedWallet } from '@aztec/wallets/embedded'; @@ -48,7 +49,7 @@ describe("Public Function Logging", () => { let salt1 = Fr.random(); player1Account = await wallet.createSchnorrAccount(secretKey1, salt1, signingKey1); await (await player1Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -58,7 +59,7 @@ describe("Public Function Logging", () => { let salt2 = Fr.random(); player2Account = await wallet.createSchnorrAccount(secretKey2, salt2, signingKey2); await (await player2Account.getDeployMethod()).send({ - from: AztecAddress.ZERO, + from: NO_FROM, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } }); @@ -70,12 +71,11 @@ describe("Public Function Logging", () => { // Deploy the contract logger.info('Deploying Pod Racing contract...'); const adminAddress = player1Account.address; - const deployResult = await PodRacingContract.deploy(wallet, adminAddress).send({ + ({ contract } = await PodRacingContract.deploy(wallet, adminAddress).send({ from: adminAddress, fee: { paymentMethod: sponsoredPaymentMethod }, wait: { timeout: getTimeouts().deployTimeout } - }); - contract = deployResult.contract; + })); logger.info(`Contract deployed at: ${contract.address.toString()}`); }, 600000) diff --git a/src/utils/deploy_account.ts b/src/utils/deploy_account.ts index 6b4ab91..70f1985 100644 --- a/src/utils/deploy_account.ts +++ b/src/utils/deploy_account.ts @@ -7,7 +7,7 @@ import { Fr } from "@aztec/aztec.js/fields"; import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin"; import { type Logger, createLogger } from "@aztec/foundation/log"; import { setupWallet } from "./setup_wallet.js"; -import { AztecAddress } from "@aztec/aztec.js/addresses"; +import { NO_FROM } from "@aztec/aztec.js/account"; import { AccountManager } from "@aztec/aztec.js/wallet"; import { EmbeddedWallet } from "@aztec/wallets/embedded"; import { createAztecNodeClient } from "@aztec/aztec.js/node"; @@ -69,13 +69,13 @@ export async function deploySchnorrAccount(wallet?: EmbeddedWallet): Promise=13.7.0" long "^5.0.0" -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +proxy-from-env@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz#a7487568adad577cfaaa7e88c49cab3ab3081aba" + integrity sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA== pump@^3.0.0: version "3.0.2" @@ -6327,11 +6289,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -6434,14 +6391,6 @@ setprototypeof@1.2.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -sha256@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/sha256/-/sha256-0.2.0.tgz#73a0b418daab7035bff86e8491e363412fc2ab05" - integrity sha512-kTWMJUaez5iiT9CcMv8jSq6kMhw3ST0uRdcIWl3D77s6AsLXNXRp3heeqqfu5+Dyfu4hwpQnMzhqHh8iNQxw0w== - dependencies: - convert-hex "~0.1.0" - convert-string "~0.1.0" - sha3@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/sha3/-/sha3-2.1.4.tgz#000fac0fe7c2feac1f48a25e7a31b52a6492cc8f" @@ -6554,7 +6503,7 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz#b069e687b1291a32f126893ed76a27a745ee2133" integrity sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw== -split2@^4.0.0, split2@^4.1.0: +split2@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== @@ -6687,11 +6636,6 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-final-newline@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" - integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== - strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -6888,6 +6832,15 @@ tsscmp@1.0.6: resolved "https://registry.yarnpkg.com/tsscmp/-/tsscmp-1.0.6.tgz#85b99583ac3589ec4bfef825b5000aa911d605eb" integrity sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA== +tsx@^4.22.4: + version "4.22.4" + resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.22.4.tgz#0ab3b7fb4ec7feeee74e5b1f26337caa71e44700" + integrity sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg== + dependencies: + esbuild "~0.28.0" + optionalDependencies: + fsevents "~2.3.3" + type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" @@ -7258,16 +7211,6 @@ ws@8.18.3: resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472" integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== -ws@^8.13.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - -xtend@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" @@ -7288,7 +7231,7 @@ yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.3.1, yargs@~17.7.0: +yargs@^17.3.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -7316,10 +7259,10 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zod@^3.23.8: - version "3.23.8" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" - integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== +zod@^4: + version "4.4.3" + resolved "https://registry.yarnpkg.com/zod/-/zod-4.4.3.tgz#b680f172885d18bbebf21a834ea25e55a1bbf356" + integrity sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ== zwitch@^2.0.0: version "2.0.4" From 6dcbda1d86fe84d9dddaf00864176ea8b83281e1 Mon Sep 17 00:00:00 2001 From: Josh Crites Date: Tue, 30 Jun 2026 12:24:15 -0400 Subject: [PATCH 3/3] CI: add aztec internal-bin to PATH so aztec compile finds nargo 5.0.0-rc.2's `aztec compile` shells out to `nargo`, which the installer places in ~/.aztec/current/internal-bin. Without it on PATH the local-network job fails with `spawn nargo ENOENT`. --- .github/workflows/local-network.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/local-network.yaml b/.github/workflows/local-network.yaml index 2314e46..def6236 100644 --- a/.github/workflows/local-network.yaml +++ b/.github/workflows/local-network.yaml @@ -49,6 +49,7 @@ jobs: run: | echo "$HOME/.aztec/current/bin" >> $GITHUB_PATH echo "$HOME/.aztec/current/node_modules/.bin" >> $GITHUB_PATH + echo "$HOME/.aztec/current/internal-bin" >> $GITHUB_PATH echo "$HOME/.aztec/bin" >> $GITHUB_PATH - name: Start local Aztec network