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
12 changes: 3 additions & 9 deletions boxes/boxes/react/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
import { AztecAddress, createAztecNodeClient, Wallet } from '@aztec/aztec.js';
import { getPXEServiceConfig } from '@aztec/pxe/client/lazy';
import { TestWallet } from '@aztec/test-wallet/lazy';
import { getPXEServiceConfig, createPXEService } from '@aztec/pxe/client/lazy';
import { getInitialTestAccountsData } from '@aztec/accounts/testing';

export class PrivateEnv {
private wallet!: Wallet;
Expand All @@ -16,13 +16,7 @@ export class PrivateEnv {
const config = getPXEServiceConfig();
config.dataDirectory = 'pxe';
config.proverEnabled = false;
const l1Contracts = await aztecNode.getL1ContractAddresses();
const configWithContracts = {
...config,
l1Contracts,
};
const pxe = await createPXEService(aztecNode, configWithContracts);
const wallet = new TestWallet(pxe, aztecNode);
const wallet = await TestWallet.create(aztecNode, config);

const [accountData] = await getInitialTestAccountsData();
if (!accountData) {
Expand Down
23 changes: 9 additions & 14 deletions boxes/boxes/vanilla/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import fs from 'fs';
import path from 'path';
import {
AztecAddress,
createAztecNodeClient,
Expand All @@ -11,12 +9,14 @@ import {
type Wallet,
} from '@aztec/aztec.js';
import { type AztecNode } from '@aztec/aztec.js/interfaces';
import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
import { SPONSORED_FPC_SALT } from '@aztec/constants';
import { createStore } from '@aztec/kv-store/lmdb';
import { getDefaultInitializer } from '@aztec/stdlib/abi';
import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/SponsoredFPC';
import { SPONSORED_FPC_SALT } from '@aztec/constants';
import { TestWallet } from '@aztec/test-wallet';
import { getPXEServiceConfig } from '@aztec/pxe/server';
import { getDefaultInitializer } from '@aztec/stdlib/abi';
import { TestWallet } from '@aztec/test-wallet/server';
import fs from 'fs';
import path from 'path';
// @ts-ignore
import { PrivateVotingContract } from '../artifacts/PrivateVoting.ts';

Expand All @@ -26,7 +26,7 @@ const WRITE_ENV_FILE = process.env.WRITE_ENV_FILE === 'false' ? false : true;

const PXE_STORE_DIR = path.join(import.meta.dirname, '.store');

async function setupPXE(aztecNode: AztecNode) {
async function setupWallet(aztecNode: AztecNode) {
fs.rmSync(PXE_STORE_DIR, { recursive: true, force: true });

const store = await createStore('pxe', {
Expand All @@ -37,15 +37,11 @@ async function setupPXE(aztecNode: AztecNode) {
const config = getPXEServiceConfig();
config.dataDirectory = 'pxe';
config.proverEnabled = PROVER_ENABLED;
const configWithContracts = {
...config,
};

const pxe = await createPXEService(aztecNode, configWithContracts, {
return await TestWallet.create(aztecNode, config, {
store,
useLogSuffix: true,
});
return pxe;
}

async function getSponsoredPFCContract() {
Expand Down Expand Up @@ -158,8 +154,7 @@ async function writeEnvFile(deploymentInfo) {

async function createAccountAndDeployContract() {
const aztecNode = createAztecNodeClient(AZTEC_NODE_URL);
const pxe = await setupPXE(aztecNode);
const wallet = new TestWallet(pxe, aztecNode);
const wallet = await setupWallet(aztecNode);

// Register the SponsoredFPC contract (for sponsored fee payments)
await wallet.registerContract(
Expand Down
16 changes: 4 additions & 12 deletions boxes/boxes/vite/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { getInitialTestAccountsData } from "@aztec/accounts/testing";
import { AztecAddress, createAztecNodeClient, Wallet } from "@aztec/aztec.js";
import { TestWallet } from "@aztec/test-wallet/lazy";
import {
PXEServiceConfig,
getPXEServiceConfig,
createPXEService,
getPXEServiceConfig
} from "@aztec/pxe/client/lazy";
import { getInitialTestAccountsData } from "@aztec/accounts/testing";
import { TestWallet } from "@aztec/test-wallet/lazy";

export class PrivateEnv {
private wallet!: Wallet;
Expand All @@ -20,13 +18,7 @@ export class PrivateEnv {
const config = getPXEServiceConfig();
config.dataDirectory = "pxe";
config.proverEnabled = false;
const l1Contracts = await aztecNode.getL1ContractAddresses();
const configWithContracts = {
...config,
l1Contracts,
} as PXEServiceConfig;
const pxe = await createPXEService(aztecNode, configWithContracts);
const wallet = new TestWallet(pxe, aztecNode);
const wallet = await TestWallet.create(aztecNode, config);

const [accountData] = await getInitialTestAccountsData();
if (!accountData) {
Expand Down
38 changes: 4 additions & 34 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
name: aztec-devnet
services:
pxe:
image: aztecprotocol/aztec${AZTEC_DOCKER_TAG:-@sha256:03feac60e91f1aabf678cecbcd13271dda229120ec6007f2c1bac718ff550c70}
# need to run bb for proofs and bb is only built for x86
platform: linux/amd64
environment:
LOG_LEVEL: ${LOG_LEVEL:-info}
L1_CHAIN_ID: 31337
VERSION: 1
PXE_PROVER_ENABLED: ${PXE_PROVER_ENABLED:-1}
PXE_DATA_DIRECTORY: /var/lib/aztec/pxe
NODE_NO_WARNINGS: 1
AZTEC_PORT: 8080
MNEMONIC: "test test test test test test test test test test test junk"
entrypoint: >
sh -c '
export AZTEC_NODE_URL=$$(cat /var/run/secrets/aztec-node-url);
while ! curl --head --silent $AZTEC_NODE_URL > /dev/null; do echo "Node $$AZTEC_NODE_URL not up. Retrying after 1s"; sleep 1; done;
node /usr/src/yarn-project/aztec/dest/bin/index.js start --pxe
'
secrets:
- aztec-node-url
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- aztec:/var/lib/aztec
ports:
- 8080:8080/tcp
profiles:
- pxe

node:
image: aztecprotocol/aztec${AZTEC_DOCKER_TAG:-@sha256:03feac60e91f1aabf678cecbcd13271dda229120ec6007f2c1bac718ff550c70}
Expand All @@ -54,7 +25,7 @@ services:
P2P_QUERY_FOR_IP: true
P2P_ENABLED: true
PEER_ID_PRIVATE_KEY:
AZTEC_PORT: 8999
AZTEC_PORT: 8080
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-http://otel-collector:4318/v1/metrics}
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:-http://otel-collector:4318/v1/traces}
secrets:
Expand Down Expand Up @@ -90,17 +61,16 @@ services:
profiles:
- node
ports:
# the RPC endpoint - expose it on a different port to avoid conflicting with PXE
- 8999:8999/tcp
- 8080:8080/tcp
- 9000:9000/tcp
- 9001:9001/udp

cli:
image: aztecprotocol/aztec${AZTEC_DOCKER_TAG:-@sha256:03feac60e91f1aabf678cecbcd13271dda229120ec6007f2c1bac718ff550c70}
# run the same image as pxe
# run the same image as node
platform: linux/amd64
environment:
PXE_URL: http://pxe:8080
AZTEC_NODE_URL: http://node:8080
NODE_NO_WARNINGS: 1
SECRET_KEY:
ETHEREUM_HOSTS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ console.log('Chain ID:', nodeInfo.l1ChainId);
Now that we have a PXE running, we can create a Wallet:

```typescript
import { createAztecNodeClient } from '@aztec/aztec.js';
import { TestWallet } from '@aztec/test-wallet';

const wallet = new TestWallet(pxe);
const node = createAztecNodeClient('http://localhost:8080');
const wallet = await TestWallet.create(node);
```

### Get test accounts
Expand Down
Loading
Loading