Skip to content

Commit

Permalink
Merge branch 'master' into saleel/bb-gates
Browse files Browse the repository at this point in the history
  • Loading branch information
saleel committed Feb 27, 2025
2 parents 384b5bb + ed32499 commit a23bd6a
Show file tree
Hide file tree
Showing 82 changed files with 1,958 additions and 550 deletions.
11 changes: 10 additions & 1 deletion .test_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ tests:
owners:
- "UKUMA5J7K" # charlie

- regex: "simple e2e_fees/private_payments"
owners:
- "U02G4KAD57Y" # phil

# Summary of all failing tests
# FAIL ./e2e_cheat_codes.test.ts
# ● e2e_cheat_codes › L1 cheatcodes › setNextBlockTimestamp
Expand Down Expand Up @@ -157,7 +161,12 @@ tests:
- "U03E5SYLY3Z" # lasse

# kind tests
- regex: "spartan/bootstrap.sh"
- regex: "spartan/bootstrap.sh test-kind"
owners:
- "UKUMA5J7K" # charlie
- "U04BM8H25NJ" # adam
- regex: "spartan/bootstrap.sh test-local"
skip: true
owners:
- "UKUMA5J7K" # charlie
- "U04BM8H25NJ" # adam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export async function fetchCode(multithreaded: boolean, wasmPath?: string) {
let url: string;
if (wasmPath) {
const suffix = multithreaded ? '-threads' : '';
url = `${wasmPath}/barretenberg${suffix}.wasm.gz`;
const filePath = wasmPath.split('/').slice(0, -1).join('/');
const fileNameWithExtensions = wasmPath.split('/').pop();
const [fileName, ...extensions] = fileNameWithExtensions!.split('.');
url = `${filePath}/${fileName}${suffix}.${extensions.join('.')}`;
} else {
url = multithreaded
? (await import(/* webpackIgnore: true */ './barretenberg-threads.js')).default
Expand Down
4 changes: 0 additions & 4 deletions boxes/boxes/react/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createPXEClient, PXE } from '@aztec/aztec.js';
import { BoxReactContractArtifact } from '../artifacts/BoxReact';
import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing/lazy';

export class PrivateEnv {
Expand All @@ -22,6 +21,3 @@ export class PrivateEnv {
}

export const deployerEnv = await PrivateEnv.create(process.env.PXE_URL || 'http://localhost:8080');

const IGNORE_FUNCTIONS = ['constructor'];
export const filteredInterface = BoxReactContractArtifact.functions.filter(f => !IGNORE_FUNCTIONS.includes(f.name));
9 changes: 3 additions & 6 deletions boxes/boxes/react/src/hooks/useContract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState } from 'react';
import { deployerEnv } from '../config';

import { Contract, Fr } from '@aztec/aztec.js';
import { BoxReactContract } from '../../artifacts/BoxReact';
import { toast } from 'react-toastify';

export function useContract() {
Expand All @@ -16,11 +15,9 @@ export function useContract() {
const wallet = await deployerEnv.getWallet();
const salt = Fr.random();

const tx = await BoxReactContract.deploy(
wallet,
Fr.random(),
wallet.getCompleteAddress().address,
).send({
const { BoxReactContract } = await import('../../artifacts/BoxReact');

const tx = await BoxReactContract.deploy(wallet, Fr.random(), wallet.getCompleteAddress().address).send({
contractAddressSalt: salt,
});
const contract = await toast.promise(tx.deployed(), {
Expand Down
5 changes: 4 additions & 1 deletion boxes/boxes/react/src/pages/contract.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { useState } from 'react';
import { Contract } from '@aztec/aztec.js';
import { useNumber } from '../hooks/useNumber';
import { filteredInterface } from '../config';

const IGNORE_FUNCTIONS = ['constructor', 'process_log', 'sync_notes'];

export function ContractComponent({ contract }: { contract: Contract }) {
const [showInput, setShowInput] = useState(true);
const { wait, getNumber, setNumber } = useNumber({ contract });

const filteredInterface = contract.artifact.functions.filter(f => !IGNORE_FUNCTIONS.includes(f.name));

return (
<div>
<h1>Your Contract</h1>
Expand Down
2 changes: 1 addition & 1 deletion boxes/boxes/vite/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
testMatch: "**.spec.ts",
fullyParallel: true,
retries: 3,
workers: process.env.CI ? 1 : 3,
workers: 1,
reporter: "list",
use: {
baseURL: "http://127.0.0.1:5173",
Expand Down
14 changes: 4 additions & 10 deletions boxes/boxes/vite/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { PXEServiceConfig, getPXEServiceConfig } from "@aztec/pxe/config";
import { KVPxeDatabase } from "@aztec/pxe/database";
import { PXEService } from "@aztec/pxe/service";
import { WASMSimulator } from "@aztec/simulator/client";
import { BoxReactContractArtifact } from "../artifacts/BoxReact";
import { LazyProtocolContractsProvider } from "@aztec/protocol-contracts/providers/lazy";

export class PrivateEnv {
Expand All @@ -31,7 +30,7 @@ export class PrivateEnv {
const simulationProvider = new WASMSimulator();
const proofCreator = new BBWASMLazyPrivateKernelProver(
simulationProvider,
16
16,
);
const l1Contracts = await aztecNode.getL1ContractAddresses();
const configWithContracts = {
Expand All @@ -42,7 +41,7 @@ export class PrivateEnv {
const store = await createStore(
"pxe_data",
configWithContracts,
createLogger("pxe:data:idb")
createLogger("pxe:data:idb"),
);

const keyStore = new KeyStore(store);
Expand All @@ -60,15 +59,15 @@ export class PrivateEnv {
proofCreator,
simulationProvider,
protocolContractsProvider,
config
config,
);
await this.pxe.init();
const [accountData] = await getInitialTestAccounts();
const account = await getSchnorrAccount(
this.pxe,
accountData.secret,
accountData.signingKey,
accountData.salt
accountData.salt,
);
await account.register();
this.wallet = await account.getWallet();
Expand All @@ -80,8 +79,3 @@ export class PrivateEnv {
}

export const deployerEnv = new PrivateEnv();

const IGNORE_FUNCTIONS = ["constructor", "process_log", "sync_notes"];
export const filteredInterface = BoxReactContractArtifact.functions.filter(
(f) => !IGNORE_FUNCTIONS.includes(f.name)
);
3 changes: 2 additions & 1 deletion boxes/boxes/vite/src/hooks/useContract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState } from "react";
import { deployerEnv } from "../config";

import { Contract, Fr } from "@aztec/aztec.js";
import { BoxReactContract } from "../../artifacts/BoxReact";
import { toast } from "react-toastify";

export function useContract() {
Expand All @@ -17,6 +16,8 @@ export function useContract() {
const wallet = await deployerEnv.getWallet();
const salt = Fr.random();

const { BoxReactContract } = await import("../../artifacts/BoxReact");

const tx = await BoxReactContract.deploy(
wallet,
Fr.random(),
Expand Down
30 changes: 22 additions & 8 deletions boxes/boxes/vite/src/pages/contract.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { useState } from 'react';
import { Contract } from '@aztec/aztec.js';
import { useNumber } from '../hooks/useNumber';
import { filteredInterface } from '../config';
import { useState } from "react";
import { Contract } from "@aztec/aztec.js";
import { useNumber } from "../hooks/useNumber";

const IGNORE_FUNCTIONS = ["constructor", "process_log", "sync_notes"];

export function ContractComponent({ contract }: { contract: Contract }) {
const [showInput, setShowInput] = useState(true);
const { wait, getNumber, setNumber } = useNumber({ contract });

const filteredInterface = contract.artifact.functions.filter(
(f) => !IGNORE_FUNCTIONS.includes(f.name),
);

return (
<div>
<h1>Your Contract</h1>
Expand All @@ -15,7 +20,7 @@ export function ContractComponent({ contract }: { contract: Contract }) {
<select name="viewFunctions" id="viewFunctions">
{filteredInterface.map(
(fn, index) =>
fn.functionType === 'unconstrained' && (
fn.functionType === "unconstrained" && (
<option key={index} value={index}>
{fn.name}
</option>
Expand All @@ -29,17 +34,26 @@ export function ContractComponent({ contract }: { contract: Contract }) {

<form onSubmit={setNumber}>
<label htmlFor="functions">Functions:</label>
<select name="functions" id="functions" onChange={() => setShowInput(true)}>
<select
name="functions"
id="functions"
onChange={() => setShowInput(true)}
>
{filteredInterface.map(
(fn, index) =>
fn.functionType !== 'unconstrained' && (
fn.functionType !== "unconstrained" && (
<option key={index} value={index}>
{fn.name}
</option>
),
)}
</select>
<input type="number" name="numberToSet" id="numberToSet" hidden={!showInput} />
<input
type="number"
name="numberToSet"
id="numberToSet"
hidden={!showInput}
/>
<button type="submit" disabled={wait}>
Write
</button>
Expand Down
2 changes: 1 addition & 1 deletion boxes/boxes/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => {

// https://vite.dev/config/
export default defineConfig({
logLevel: "error",
//logLevel: "error",
server: {
// Headers needed for bb WASM to work in multithreaded mode
headers: {
Expand Down
2 changes: 1 addition & 1 deletion ci3/run_test_cmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Command: $cmd
Commit: https://github.com/AztecProtocol/aztec-packages/commit/$COMMIT_HASH
Env: REF_NAME=$REF_NAME CURRENT_VERSION=$CURRENT_VERSION CI_FULL=$CI_FULL
Date: $(date)
Sys: ARCH=$(arch) CPUS=$(nproc) HOSTNAME=$(hostname)
Sys: ARCH=$(arch) CPUS=$(nproc) MEM=$(free -h | awk '/^Mem:/{print $2}') HOSTNAME=$(hostname)
EOF
# Remove the tmp fail on exit.
Expand Down
10 changes: 5 additions & 5 deletions l1-contracts/src/governance/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ contract Governance is IGovernance {

configuration = DataStructures.Configuration({
proposeConfig: DataStructures.ProposeConfiguration({
lockDelay: Timestamp.wrap(3600),
lockDelay: Timestamp.wrap(60),
lockAmount: 1000e18
}),
votingDelay: Timestamp.wrap(3600),
votingDuration: Timestamp.wrap(3600),
executionDelay: Timestamp.wrap(3600),
gracePeriod: Timestamp.wrap(3600),
votingDelay: Timestamp.wrap(60),
votingDuration: Timestamp.wrap(60),
executionDelay: Timestamp.wrap(60),
gracePeriod: Timestamp.wrap(60),
quorum: 0.1e18,
voteDifferential: 0.04e18,
minimumVotes: 1000e18
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/src/governance/libraries/ConfigurationLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ library ConfigurationLib {

uint256 internal constant VOTES_LOWER = 1;

Timestamp internal constant TIME_LOWER = Timestamp.wrap(3600);
Timestamp internal constant TIME_LOWER = Timestamp.wrap(60);
Timestamp internal constant TIME_UPPER = Timestamp.wrap(30 * 24 * 3600);

function withdrawalDelay(DataStructures.Configuration storage _self)
Expand Down
1 change: 1 addition & 0 deletions l1-contracts/src/governance/libraries/DataStructures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ library DataStructures {
uint256 nea;
}

// @notice if this changes, please update the enum in governance.ts
enum ProposalState {
Pending,
Active,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ contract FinaliseWithdrawTest is GovernanceBase {
uint256 withdrawalCount = governance.withdrawalCount();
for (uint256 i = 0; i < withdrawalCount; i++) {
DataStructures.Withdrawal memory withdrawal = governance.getWithdrawal(i);
if (Timestamp.unwrap(withdrawal.unlocksAt) <= block.timestamp) {
continue;
}
assertGt(withdrawal.unlocksAt, block.timestamp);

uint256 time =
Expand Down
7 changes: 4 additions & 3 deletions noir-projects/aztec-nr/aztec/src/macros/dispatch/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ pub comptime fn generate_public_dispatch(m: Module) -> Quoted {
}
};

let mut parameter_index = 0;
let parameter_index = &mut 0;
let reads = parameters.map(|param: (Quoted, Type)| {
let param_name = f"arg{parameter_index}".quoted_contents();
let parameter_index_value = *parameter_index;
let param_name = f"arg{parameter_index_value}".quoted_contents();
let param_type = param.1;
let read = quote {
let $param_name: $param_type = reader.read_struct(dep::aztec::protocol_types::traits::Deserialize::deserialize);
};
parameter_index += 1;
*parameter_index += 1;
quote { $read }
});
let read = reads.join(quote { });
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/precommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ if [[ -n "$staged_nr_files" ]]; then
echo "$staged_nr_files" | xargs -I {} git add "$repo_root/{}"
fi

# We just don't say anything if there are no staged nr files, because no one cares.
# We just don't say anything if there are no staged nr files, because no one cares.
6 changes: 4 additions & 2 deletions playground/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
VITE_AZTEC_NODE_URL=http://localhost:8080
VITE_LOG_LEVEL=debug
AZTEC_NODE_URL=http://localhost:8080
LOG_LEVEL=verbose
# Uncomment to provide a custom barretenberg.wasm file
#BB_WASM_PATH='/assets/barretenberg.wasm.gz'
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typescript": "~5.7.3",
"typescript-eslint": "^8.11.0",
"vite": "^6.0.11",
"vite-plugin-node-polyfills": "^0.23.0"
"vite-plugin-node-polyfills": "^0.23.0",
"vite-plugin-static-copy": "^2.2.0"
}
}
8 changes: 0 additions & 8 deletions playground/src/aztecEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ import { L2TipsStore } from "@aztec/kv-store/stores";
import { createStore } from "@aztec/kv-store/indexeddb";
import { BBWASMLazyPrivateKernelProver } from "@aztec/bb-prover/wasm/lazy";
import { WASMSimulator } from "@aztec/simulator/client";
import { debug } from "debug";
import { createContext } from "react";
import { NetworkDB, WalletDB } from "./utils/storage";
import { type ContractFunctionInteractionTx } from "./utils/txs";
import { type Logger, createLogger } from "@aztec/aztec.js/log";
import { LazyProtocolContractsProvider } from "@aztec/protocol-contracts/providers/lazy";

process.env = Object.keys(import.meta.env).reduce((acc, key) => {
acc[key.replace("VITE_", "")] = import.meta.env[key];
return acc;
}, {});

debug.enable("*");

const logLevel = [
"silent",
"fatal",
Expand Down
Loading

0 comments on commit a23bd6a

Please sign in to comment.