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
5 changes: 0 additions & 5 deletions boxes/boxes/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
"dependencies": {
"@aztec/accounts": "latest",
"@aztec/aztec.js": "latest",
"@aztec/bb-prover": "latest",
"@aztec/key-store": "latest",
"@aztec/kv-store": "latest",
"@aztec/protocol-contracts": "latest",
"@aztec/pxe": "latest",
"@aztec/simulator": "latest",
"@aztec/stdlib": "latest",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
49 changes: 8 additions & 41 deletions boxes/boxes/vite/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import { getSchnorrAccount } from "@aztec/accounts/schnorr/lazy";
import {
AccountWalletWithSecretKey,
createAztecNodeClient,
createLogger,
} from "@aztec/aztec.js";
import { BBWASMLazyPrivateKernelProver } from "@aztec/bb-prover/wasm/lazy";
import { KeyStore } from "@aztec/key-store";
import { createStore } from "@aztec/kv-store/indexeddb";
import { L2TipsStore } from "@aztec/kv-store/stores";
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 { LazyProtocolContractsProvider } from "@aztec/protocol-contracts/providers/lazy";
import {
PXEServiceConfig,
getPXEServiceConfig,
PXEService,
createPXEService,
} from "@aztec/pxe/client/lazy";

export class PrivateEnv {
pxe: PXEService;
Expand All @@ -24,44 +20,15 @@ export class PrivateEnv {
async init() {
const nodeURL = process.env.AZTEC_NODE_URL ?? "http://localhost:8080";

const aztecNode = await createAztecNodeClient(nodeURL);
const config = getPXEServiceConfig();
config.dataDirectory = "pxe";
const aztecNode = await createAztecNodeClient(nodeURL);
const simulationProvider = new WASMSimulator();
const proofCreator = new BBWASMLazyPrivateKernelProver(
simulationProvider,
16,
);
const l1Contracts = await aztecNode.getL1ContractAddresses();
const configWithContracts = {
...config,
l1Contracts,
} as PXEServiceConfig;

const store = await createStore(
"pxe_data",
configWithContracts,
createLogger("pxe:data:idb"),
);

const keyStore = new KeyStore(store);

const db = await KVPxeDatabase.create(store);
const tips = new L2TipsStore(store, "pxe");

const protocolContractsProvider = new LazyProtocolContractsProvider();

this.pxe = new PXEService(
keyStore,
aztecNode,
db,
tips,
proofCreator,
simulationProvider,
protocolContractsProvider,
config,
);
await this.pxe.init();
this.pxe = await createPXEService(aztecNode, configWithContracts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow this seems quite sane

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note the pxe = pxe_service strange assignment here though, as mentioned offline

const [accountData] = await getInitialTestAccounts();
const account = await getSchnorrAccount(
this.pxe,
Expand Down
35 changes: 0 additions & 35 deletions boxes/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,6 @@ __metadata:
languageName: node
linkType: soft

"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=aztec-app%40workspace%3A."
languageName: node
linkType: soft

"@aztec/key-store@link:../yarn-project/key-store::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=aztec-app%40workspace%3A."
languageName: node
linkType: soft

"@aztec/kv-store@link:../yarn-project/kv-store::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=aztec-app%40workspace%3A."
languageName: node
linkType: soft

"@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=aztec-app%40workspace%3A."
languageName: node
linkType: soft

"@aztec/pxe@link:../yarn-project/pxe::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=aztec-app%40workspace%3A."
Expand Down Expand Up @@ -106,12 +82,6 @@ __metadata:
languageName: unknown
linkType: soft

"@aztec/simulator@link:../yarn-project/simulator::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=aztec-app%40workspace%3A."
languageName: node
linkType: soft

"@aztec/stdlib@link:../yarn-project/stdlib::locator=aztec-app%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/stdlib@link:../yarn-project/stdlib::locator=aztec-app%40workspace%3A."
Expand Down Expand Up @@ -144,12 +114,7 @@ __metadata:
dependencies:
"@aztec/accounts": "npm:latest"
"@aztec/aztec.js": "npm:latest"
"@aztec/bb-prover": "npm:latest"
"@aztec/key-store": "npm:latest"
"@aztec/kv-store": "npm:latest"
"@aztec/protocol-contracts": "npm:latest"
"@aztec/pxe": "npm:latest"
"@aztec/simulator": "npm:latest"
"@aztec/stdlib": "npm:latest"
"@eslint/js": "npm:^9.13.0"
"@types/react": "npm:^18.3.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ unconstrained fn transfer_in_private_failure_on_behalf_of_self_non_zero_nonce()
);
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_in_private_failure_on_behalf_of_other_without_approval() {
// Setup with account contracts. Slower since we actually deploy them, but needed for authwits.
// The authwit check is in the beginning so we don't need to waste time on minting the NFT and transferring
Expand All @@ -122,7 +122,7 @@ unconstrained fn transfer_in_private_failure_on_behalf_of_other_without_approval
);
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_in_private_failure_on_behalf_of_other_wrong_caller() {
// Setup with account contracts. Slower since we actually deploy them, but needed for authwits.
// The authwit check is in the beginning so we don't need to waste time on minting the NFT and transferring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_self_non_zero_nonce() {
);
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_to_public_failure_on_behalf_of_other_invalid_designated_caller() {
let (env, nft_contract_address, sender, recipient, token_id) =
utils::setup_mint_and_transfer_to_private(/* with_account_contracts */ true);
Expand All @@ -93,7 +93,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_other_invalid_designate
transfer_to_public_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_to_public_failure_on_behalf_of_other_no_approval() {
let (env, nft_contract_address, sender, recipient, token_id) =
utils::setup_mint_and_transfer_to_private(/* with_account_contracts */ true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ unconstrained fn burn_private_failure_on_behalf_of_other_more_than_balance() {
burn_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn burn_private_failure_on_behalf_of_other_without_approval() {
let (env, token_contract_address, owner, recipient, mint_amount) =
utils::setup_and_mint_to_public(/* with_account_contracts */ true);
Expand All @@ -91,7 +91,7 @@ unconstrained fn burn_private_failure_on_behalf_of_other_without_approval() {
burn_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn burn_private_failure_on_behalf_of_other_wrong_designated_caller() {
let (env, token_contract_address, owner, recipient, mint_amount) =
utils::setup_and_mint_to_public(/* with_account_contracts */ true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ unconstrained fn transfer_private_failure_on_behalf_of_more_than_balance() {
transfer_private_from_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_private_failure_on_behalf_of_other_without_approval() {
// Setup with account contracts. Slower since we actually deploy them, but needed for authwits.
let (env, token_contract_address, owner, recipient, _) =
Expand All @@ -82,7 +82,7 @@ unconstrained fn transfer_private_failure_on_behalf_of_other_without_approval()
transfer_private_from_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_private_failure_on_behalf_of_other_wrong_caller() {
// Setup with account contracts. Slower since we actually deploy them, but needed for authwits.
let (env, token_contract_address, owner, recipient, _) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_other_more_than_balance
transfer_to_public_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_to_public_failure_on_behalf_of_other_invalid_designated_caller() {
let (env, token_contract_address, owner, recipient, mint_amount) =
utils::setup_and_mint_to_private(/* with_account_contracts */ true);
Expand All @@ -120,7 +120,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_other_invalid_designate
transfer_to_public_call_interface.call(&mut env.private());
}

#[test(should_fail_with = "Authorization not found for message hash")]
#[test(should_fail_with = "Unknown auth witness for message hash")]
unconstrained fn transfer_to_public_failure_on_behalf_of_other_no_approval() {
let (env, token_contract_address, owner, recipient, mint_amount) =
utils::setup_and_mint_to_private(/* with_account_contracts */ true);
Expand Down
4 changes: 0 additions & 4 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
"dependencies": {
"@aztec/accounts": "link:../yarn-project/accounts",
"@aztec/aztec.js": "link:../yarn-project/aztec.js",
"@aztec/bb-prover": "link:../yarn-project/bb-prover",
"@aztec/foundation": "link:../yarn-project/foundation",
"@aztec/key-store": "link:../yarn-project/key-store",
"@aztec/kv-store": "link:../yarn-project/kv-store",
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts",
"@aztec/pxe": "link:../yarn-project/pxe",
"@aztec/simulator": "link:../yarn-project/simulator",
"@aztec/stdlib": "link:../yarn-project/stdlib",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
Expand Down
48 changes: 8 additions & 40 deletions playground/src/aztecEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
import { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
import { Contract } from '@aztec/aztec.js/contracts';
import { type PXE } from '@aztec/aztec.js/interfaces/pxe';
import { PXEService } from '@aztec/pxe/service';
import { type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/config';
import { KVPxeDatabase } from '@aztec/pxe/database';
import { KeyStore } from '@aztec/key-store';
import { L2TipsStore } from '@aztec/kv-store/stores';
import { createPXEService, type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/client/lazy';
import { createStore } from '@aztec/kv-store/indexeddb';
import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/wasm/lazy';
import { WASMSimulator } from '@aztec/simulator/client';
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';

const logLevel = ['silent', 'fatal', 'error', 'warn', 'info', 'verbose', 'debug', 'trace'] as const;

Expand Down Expand Up @@ -151,44 +144,19 @@ export class AztecEnv {
const config = getPXEServiceConfig();
config.dataDirectory = 'pxe';
config.proverEnabled = true;

const simulationProvider = new WASMSimulator();
const proofCreator = new BBWASMLazyPrivateKernelProver(
simulationProvider,
16,
WebLogger.getInstance().createLogger('bb:wasm:lazy'),
);
const l1Contracts = await aztecNode.getL1ContractAddresses();
const configWithContracts = {
...config,
l1Contracts,
} as PXEServiceConfig;

const store = await createStore(
'pxe_data',
configWithContracts,
WebLogger.getInstance().createLogger('pxe:data:indexeddb'),
);

const keyStore = new KeyStore(store);

const db = await KVPxeDatabase.create(store);
const tips = new L2TipsStore(store, 'pxe');

const protocolContractsProvider = new LazyProtocolContractsProvider();

const pxe = new PXEService(
keyStore,
aztecNode,
db,
tips,
proofCreator,
simulationProvider,
protocolContractsProvider,
config,
WebLogger.getInstance().createLogger('pxe:service'),
);
await pxe.init();
const pxe = await createPXEService(aztecNode, configWithContracts, {
loggers: {
store: WebLogger.getInstance().createLogger('pxe:data:indexeddb'),
pxe: WebLogger.getInstance().createLogger('pxe:service'),
prover: WebLogger.getInstance().createLogger('bb:wasm:lazy'),
}
});
return pxe;
}
}
28 changes: 0 additions & 28 deletions playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,12 @@ __metadata:
languageName: node
linkType: soft

"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/foundation@link:../yarn-project/foundation::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/foundation@link:../yarn-project/foundation::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/key-store@link:../yarn-project/key-store::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/kv-store@link:../yarn-project/kv-store::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=%40aztec%2Fplayground%40workspace%3A."
Expand All @@ -47,13 +35,9 @@ __metadata:
dependencies:
"@aztec/accounts": "link:../yarn-project/accounts"
"@aztec/aztec.js": "link:../yarn-project/aztec.js"
"@aztec/bb-prover": "link:../yarn-project/bb-prover"
"@aztec/foundation": "link:../yarn-project/foundation"
"@aztec/key-store": "link:../yarn-project/key-store"
"@aztec/kv-store": "link:../yarn-project/kv-store"
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts"
"@aztec/pxe": "link:../yarn-project/pxe"
"@aztec/simulator": "link:../yarn-project/simulator"
"@aztec/stdlib": "link:../yarn-project/stdlib"
"@emotion/react": "npm:^11.14.0"
"@emotion/styled": "npm:^11.14.0"
Expand Down Expand Up @@ -88,24 +72,12 @@ __metadata:
languageName: unknown
linkType: soft

"@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/pxe@link:../yarn-project/pxe::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/simulator@link:../yarn-project/simulator::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=%40aztec%2Fplayground%40workspace%3A."
languageName: node
linkType: soft

"@aztec/stdlib@link:../yarn-project/stdlib::locator=%40aztec%2Fplayground%40workspace%3A.":
version: 0.0.0-use.local
resolution: "@aztec/stdlib@link:../yarn-project/stdlib::locator=%40aztec%2Fplayground%40workspace%3A."
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_pxe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
type PXEServiceConfig,
allPxeConfigMappings,
createPXEService,
} from '@aztec/pxe';
} from '@aztec/pxe/server';
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
import { L2BasicContractsMap, Network } from '@aztec/stdlib/network';
import { makeTracedFetch } from '@aztec/telemetry-client';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AccountManager, Fr } from '@aztec/aztec.js';
import type { ConfigMappingsType } from '@aztec/foundation/config';
import type { LogFn } from '@aztec/foundation/log';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';

import chalk from 'chalk';
import type { Command } from 'commander';
Expand Down
Loading