Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/local-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
env:
AZTEC_ENV: local-network
AZTEC_VERSION: 3.0.0-devnet.6-patch.1
AZTEC_VERSION: 4.0.0-nightly.20260204

steps:
- name: Checkout repository
Expand All @@ -29,21 +29,20 @@ jobs:
node-version: "22"
cache: "yarn"

- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Aztec CLI
run: |
curl -s https://install.aztec.network > tmp.sh
INSTALL_URL="https://install.aztec.network/${{ env.AZTEC_VERSION }}/"
curl -sL $INSTALL_URL > tmp.sh
VERSION=${{ env.AZTEC_VERSION }} bash tmp.sh <<< yes "yes"

- name: Update path
run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH

# This is a temporary hack to fix a problem with v3 releases.
- name: Manually tag the aztec version as `latest`
run: |
docker tag aztecprotocol/aztec:${{ env.AZTEC_VERSION }} aztecprotocol/aztec:latest
echo "$HOME/.aztec/current/bin" >> $GITHUB_PATH
echo "$HOME/.aztec/current/node_modules/.bin" >> $GITHUB_PATH
echo "$HOME/.aztec/bin" >> $GITHUB_PATH

- name: Start local Aztec network
run: aztec start --local-network &
Expand Down
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = [ "" ]
compiler_version = ">=0.18.0"

[dependencies]
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v3.0.0-devnet.6-patch.1", directory = "aztec" }
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v4.0.0-nightly.20260204", directory = "aztec" }
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"update-readme-version": "node ./.github/scripts/update-readme-version.js"
},
"dependencies": {
"@aztec/accounts": "3.0.0-devnet.6-patch.1",
"@aztec/aztec.js": "3.0.0-devnet.6-patch.1",
"@aztec/noir-contracts.js": "3.0.0-devnet.6-patch.1",
"@aztec/protocol-contracts": "3.0.0-devnet.6-patch.1",
"@aztec/pxe": "3.0.0-devnet.6-patch.1",
"@aztec/stdlib": "3.0.0-devnet.6-patch.1",
"@aztec/test-wallet": "3.0.0-devnet.6-patch.1",
"@aztec/accounts": "4.0.0-nightly.20260204",
"@aztec/aztec.js": "4.0.0-nightly.20260204",
"@aztec/noir-contracts.js": "4.0.0-nightly.20260204",
"@aztec/protocol-contracts": "4.0.0-nightly.20260204",
"@aztec/pxe": "4.0.0-nightly.20260204",
"@aztec/stdlib": "4.0.0-nightly.20260204",
"@aztec/test-wallet": "4.0.0-nightly.20260204",
"dotenv": "^17.2.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy_account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Logger, createLogger } from "@aztec/aztec.js/log";
import { type Logger, createLogger } from "@aztec/foundation/log";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";

export async function deployAccount() {
Expand Down
20 changes: 9 additions & 11 deletions scripts/deploy_contract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PodRacingContract } from "../src/artifacts/PodRacing.js"
import { Logger, createLogger } from "@aztec/aztec.js/log";
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee/testing";
import { type Logger, createLogger } from "@aztec/foundation/log";
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee";
import { setupWallet } from "../src/utils/setup_wallet.js";
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";
import { getTimeouts } from "../config/config.js";

Expand All @@ -26,7 +26,7 @@ async function main() {
logger.info(`💰 Sponsored FPC instance obtained at: ${sponsoredFPC.address}`);

logger.info('📝 Registering sponsored FPC contract with wallet...');
await wallet.registerContract(sponsoredFPC, SponsoredFPCContract.artifact);
await wallet.registerContract(sponsoredFPC, SponsoredFPCContractArtifact);
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
logger.info('✅ Sponsored fee payment method configured');

Expand All @@ -40,14 +40,13 @@ async function main() {
logger.info('🏎️ Starting pod racing contract deployment...');
logger.info(`📋 Admin address for pod racing contract: ${address}`);

const deployMethod = PodRacingContract.deploy(wallet, address).send({
logger.info('⏳ Waiting for deployment transaction to be mined...');
const { contract: podRacingContract, instance } = await PodRacingContract.deploy(wallet, address).send({
from: address,
fee: { paymentMethod: sponsoredPaymentMethod }
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: timeouts.deployTimeout, returnReceipt: true }
});

logger.info('⏳ Waiting for deployment transaction to be mined...');
const podRacingContract = await deployMethod.deployed({ timeout: timeouts.deployTimeout });

logger.info(`🎉 Pod Racing Contract deployed successfully!`);
logger.info(`📍 Contract address: ${podRacingContract.address}`);
logger.info(`👤 Admin address: ${address}`);
Expand All @@ -56,8 +55,7 @@ async function main() {
logger.info('🔍 Verifying contract deployment...');
logger.info('✅ Contract deployed and ready for game creation');

// Get contract instance for instantiation data
const instance = await deployMethod.getInstance();
// Log contract instantiation data
if (instance) {
logger.info('📦 Contract instantiation data:');
logger.info(`Salt: ${instance.salt}`);
Expand Down
81 changes: 46 additions & 35 deletions scripts/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import { FeeJuiceContract } from "@aztec/noir-contracts.js/FeeJuice";
import { FPCContract } from "@aztec/noir-contracts.js/FPC";
import { PodRacingContract } from "../src/artifacts/PodRacing.js"
import { TokenContract } from "@aztec/noir-contracts.js/Token";
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee/testing'
import { SponsoredFeePaymentMethod, FeeJuicePaymentMethodWithClaim, PrivateFeePaymentMethod, PublicFeePaymentMethod } from '@aztec/aztec.js/fee';
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { createEthereumChain } from '@aztec/ethereum/chain';
import { createExtendedL1Client } from '@aztec/ethereum/client';
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";
import { setupWallet } from "../src/utils/setup_wallet.js";
import { Logger, createLogger } from '@aztec/aztec.js/log';
import { FeeJuicePaymentMethodWithClaim, PrivateFeePaymentMethod, PublicFeePaymentMethod } from '@aztec/aztec.js/fee';
import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
import { type Logger, createLogger } from '@aztec/foundation/log';
import { Fr } from '@aztec/aztec.js/fields';
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/SponsoredFPC';
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
import { createAztecNodeClient } from '@aztec/aztec.js/node';
import { AztecAddress } from '@aztec/stdlib/aztec-address';
import { getAztecNodeUrl } from '../config/config.js';
import { AztecAddress } from '@aztec/aztec.js/addresses';
import { getAztecNodeUrl, getTimeouts } from '../config/config.js';
import { GasSettings } from '@aztec/stdlib/gas';

const MNEMONIC = 'test test test test test test test test test test test junk';
Expand Down Expand Up @@ -66,23 +66,27 @@ async function main() {

// set up sponsored fee payments
const sponsoredFPC = await getSponsoredFPCInstance();
await wallet.registerContract(sponsoredFPC, SponsoredFPCContract.artifact);
await wallet.registerContract(sponsoredFPC, SponsoredFPCContractArtifact);
const paymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
const timeouts = getTimeouts();

// Two arbitrary txs to make the L1 message available on L2
const podRacingContract = await PodRacingContract.deploy(wallet, account1.address).send({
from: account1.address,
fee: { paymentMethod }
}).deployed();
fee: { paymentMethod },
wait: { timeout: timeouts.deployTimeout }
});
const bananaCoin = await TokenContract.deploy(wallet, account1.address, "bananaCoin", "BNC", 18).send({
from: account1.address,
fee: { paymentMethod }
}).deployed()
fee: { paymentMethod },
wait: { timeout: timeouts.deployTimeout }
});

// Claim Fee Juice & Pay Fees yourself

const claimAndPay = new FeeJuicePaymentMethodWithClaim(account2.address, claim)
await (await account2.getDeployMethod()).send({ from: AztecAddress.ZERO, fee: { paymentMethod: claimAndPay } }).wait()
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 } });
logger.info(`New account at ${account2.address} deployed using claimed funds for fees.`)

// Pay fees yourself
Expand All @@ -91,7 +95,8 @@ async function main() {
const gameId = Fr.random();
await podRacingContract.methods.create_game(gameId).send({
from: account2.address,
}).wait()
wait: { timeout: timeouts.txTimeout }
});
logger.info(`Game created from new account, paying fees via newWallet.`)

// Private Fee Payments via FPC
Expand All @@ -102,54 +107,59 @@ async function main() {
// This uses bananaCoin as the fee paying asset that will be exchanged for fee juice
const fpc = await FPCContract.deploy(wallet, bananaCoin.address, account1.address).send({
from: account1.address,
fee: { paymentMethod }
}).deployed()
fee: { paymentMethod },
wait: { timeout: timeouts.deployTimeout }
});
const fpcClaim = await feeJuicePortalManager.bridgeTokensPublic(fpc.address, FEE_FUNDING_FOR_TESTER_ACCOUNT, true);
// 2 public txs to make the bridged fee juice available
// Mint some bananaCoin and send to the newWallet to pay fees privately
await bananaCoin.methods.mint_to_private(account2.address, FEE_FUNDING_FOR_TESTER_ACCOUNT).send({
from: account1.address,
fee: { paymentMethod }
}).wait()
fee: { paymentMethod },
wait: { timeout: timeouts.txTimeout }
});
// mint some public bananaCoin to the newWallet to pay fees publicly
await bananaCoin.methods.mint_to_public(account2.address, FEE_FUNDING_FOR_TESTER_ACCOUNT).send({
from: account1.address,
fee: { paymentMethod }
}).wait()
fee: { paymentMethod },
wait: { timeout: timeouts.txTimeout }
});
const bananaBalance = await bananaCoin.methods.balance_of_private(account2.address).simulate({
from: account2.address
})
});

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 wallet.registerContract(feeJuiceInstance.instance, FeeJuiceContract.artifact);
const feeJuice = await FeeJuiceContract.at(feeJuiceInstance.address, wallet);

await feeJuice.methods.claim(fpc.address, fpcClaim.claimAmount, fpcClaim.claimSecret, fpcClaim.messageLeafIndex).send({ from: account2.address }).wait()
await feeJuice.methods.claim(fpc.address, fpcClaim.claimAmount, fpcClaim.claimSecret, fpcClaim.messageLeafIndex).send({ from: account2.address, wait: { timeout: timeouts.txTimeout } });

logger.info(`Fpc fee juice balance ${await feeJuice.methods.balance_of_public(fpc.address).simulate({
from: account2.address
})}`)
})}`);

const maxFeesPerGas = (await node.getCurrentBaseFees()).mul(1.5);
const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1.5);
const gasSettings = GasSettings.default({ maxFeesPerGas });

const privateFee = new PrivateFeePaymentMethod(fpc.address, account2.address, wallet, gasSettings)
const privateFee = new PrivateFeePaymentMethod(fpc.address, account2.address, wallet, gasSettings);
await bananaCoin.methods.transfer_in_private(account2.address, account1.address, 10, 0).send({
from: account2.address,
fee: { paymentMethod: privateFee }
}).wait()
fee: { paymentMethod: privateFee },
wait: { timeout: timeouts.txTimeout }
});

logger.info(`Transfer paid with fees via the FPC, privately.`)

// Public Fee Payments via FPC

const publicFee = new PublicFeePaymentMethod(fpc.address, account2.address, wallet, gasSettings)
const publicFee = new PublicFeePaymentMethod(fpc.address, account2.address, wallet, gasSettings);
await bananaCoin.methods.transfer_in_private(account2.address, account1.address, 10, 0).send({
from: account2.address,
fee: { paymentMethod: publicFee }
}).wait()
fee: { paymentMethod: publicFee },
wait: { timeout: timeouts.txTimeout }
});
logger.info(`Transfer paid with fees via the FPC, publicly.`)

// Sponsored Fee Payment
Expand All @@ -158,8 +168,9 @@ async function main() {
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
await bananaCoin.methods.transfer_in_private(account2.address, account1.address, 10, 0).send({
from: account2.address,
fee: { paymentMethod: sponsoredPaymentMethod }
}).wait()
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: timeouts.txTimeout }
});
logger.info(`Transfer paid with fees from Sponsored FPC.`)
}

Expand Down
16 changes: 8 additions & 8 deletions scripts/interaction_existing_contract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Logger, createLogger } from "@aztec/aztec.js/log";
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee/testing";
import { type Logger, createLogger } from "@aztec/foundation/log";
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee";
import { Fr } from "@aztec/aztec.js/fields";
import { AztecAddress } from "@aztec/stdlib/aztec-address";
import { AztecAddress } from "@aztec/aztec.js/addresses";
import { PodRacingContract } from "../src/artifacts/PodRacing.js";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC";
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";
Expand All @@ -21,7 +21,7 @@ async function main() {

// Setup sponsored fee payment
const sponsoredFPC = await getSponsoredFPCInstance();
await wallet.registerContract(sponsoredFPC, SponsoredFPCContract.artifact);
await wallet.registerContract(sponsoredFPC, SponsoredFPCContractArtifact);
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);

// Get account from environment variables
Expand Down Expand Up @@ -91,9 +91,9 @@ async function main() {
await podRacingContract.methods.create_game(gameId)
.send({
from: address,
fee: { paymentMethod: sponsoredPaymentMethod }
})
.wait({ timeout: timeouts.txTimeout });
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: timeouts.txTimeout }
});
logger.info("Game created successfully!");

logger.info(`Game ${gameId} is now waiting for a second player to join.`);
Expand Down
Loading
Loading