Skip to content
Merged
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
Copy Markdown
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
Copy Markdown
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
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
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/sandbox/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Fr } from '@aztec/foundation/fields';
import { type LogFn, createLogger } from '@aztec/foundation/log';
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
import {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli-wallet/src/utils/pxe_wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
import { type AztecNode, type PXE, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';

/*
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/bench/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type AztecNode, BatchCall, INITIAL_L2_BLOCK_NUM, type SentTx, type Wait
import { mean, stdDev, timesParallel } from '@aztec/foundation/collection';
import { randomInt } from '@aztec/foundation/crypto';
import { BenchmarkingContract } from '@aztec/noir-contracts.js/Benchmarking';
import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe';
import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
import type { MetricsType } from '@aztec/telemetry-client';
import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/composed/e2e_pxe.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { waitForPXE } from '@aztec/aztec.js';
import { pxeTestSuite } from '@aztec/pxe';
import { pxeTestSuite } from '@aztec/pxe/testing';

import { setup } from '../fixtures/utils.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_l1_with_wall_time.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Logger, PXE, Wallet } from '@aztec/aztec.js';
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
import { EthAddress } from '@aztec/foundation/eth-address';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';

import { jest } from '@jest/globals';
import { privateKeyToAccount } from 'viem/accounts';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_p2p/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
import type { AztecNodeService } from '@aztec/aztec-node';
import { type Logger, type SentTx, TxStatus } from '@aztec/aztec.js';
import type { SpamContract } from '@aztec/noir-contracts.js/Spam';
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe';
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';

import type { NodeContext } from '../fixtures/setup_p2p_test.js';
import { submitTxsTo } from '../shared/submit-transactions.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Buffer32 } from '@aztec/foundation/buffer';
import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
import { TokenContract } from '@aztec/noir-contracts.js/Token';
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';
import { getGenesisValues } from '@aztec/world-state/testing';

import { type Hex, getContract } from 'viem';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { EthAddress } from '@aztec/foundation/eth-address';
import { NewGovernanceProposerPayloadAbi } from '@aztec/l1-artifacts/NewGovernanceProposerPayloadAbi';
import { NewGovernanceProposerPayloadBytecode } from '@aztec/l1-artifacts/NewGovernanceProposerPayloadBytecode';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';

import { privateKeyToAccount } from 'viem/accounts';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_synching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import { RollupAbi } from '@aztec/l1-artifacts';
import { SchnorrHardcodedAccountContract } from '@aztec/noir-contracts.js/SchnorrHardcodedAccount';
import { SpamContract } from '@aztec/noir-contracts.js/Spam';
import { TokenContract } from '@aztec/noir-contracts.js/Token';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';
import { SequencerPublisher } from '@aztec/sequencer-client';
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
import { L2Block } from '@aztec/stdlib/block';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
import type { SentTx } from '@aztec/aztec.js';
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
import type { DateProvider } from '@aztec/foundation/timer';
import type { PXEService } from '@aztec/pxe';
import type { PXEService } from '@aztec/pxe/server';
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';

import getPort from 'get-port';
Expand Down
Loading