Skip to content

Commit a69f416

Browse files
authored
1 parent 2babc50 commit a69f416

File tree

90 files changed

+2096
-2155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2096
-2155
lines changed

boxes/boxes/vite/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
"dependencies": {
1919
"@aztec/accounts": "latest",
2020
"@aztec/aztec.js": "latest",
21-
"@aztec/bb-prover": "latest",
22-
"@aztec/key-store": "latest",
23-
"@aztec/kv-store": "latest",
24-
"@aztec/protocol-contracts": "latest",
2521
"@aztec/pxe": "latest",
26-
"@aztec/simulator": "latest",
2722
"@aztec/stdlib": "latest",
2823
"react": "^18.3.1",
2924
"react-dom": "^18.3.1",

boxes/boxes/vite/src/config.ts

+8-41
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ import { getSchnorrAccount } from "@aztec/accounts/schnorr/lazy";
33
import {
44
AccountWalletWithSecretKey,
55
createAztecNodeClient,
6-
createLogger,
76
} from "@aztec/aztec.js";
8-
import { BBWASMLazyPrivateKernelProver } from "@aztec/bb-prover/wasm/lazy";
9-
import { KeyStore } from "@aztec/key-store";
10-
import { createStore } from "@aztec/kv-store/indexeddb";
11-
import { L2TipsStore } from "@aztec/kv-store/stores";
12-
import { PXEServiceConfig, getPXEServiceConfig } from "@aztec/pxe/config";
13-
import { KVPxeDatabase } from "@aztec/pxe/database";
14-
import { PXEService } from "@aztec/pxe/service";
15-
import { WASMSimulator } from "@aztec/simulator/client";
16-
import { LazyProtocolContractsProvider } from "@aztec/protocol-contracts/providers/lazy";
7+
import {
8+
PXEServiceConfig,
9+
getPXEServiceConfig,
10+
PXEService,
11+
createPXEService,
12+
} from "@aztec/pxe/client/lazy";
1713

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

23+
const aztecNode = await createAztecNodeClient(nodeURL);
2724
const config = getPXEServiceConfig();
2825
config.dataDirectory = "pxe";
29-
const aztecNode = await createAztecNodeClient(nodeURL);
30-
const simulationProvider = new WASMSimulator();
31-
const proofCreator = new BBWASMLazyPrivateKernelProver(
32-
simulationProvider,
33-
16,
34-
);
3526
const l1Contracts = await aztecNode.getL1ContractAddresses();
3627
const configWithContracts = {
3728
...config,
3829
l1Contracts,
3930
} as PXEServiceConfig;
40-
41-
const store = await createStore(
42-
"pxe_data",
43-
configWithContracts,
44-
createLogger("pxe:data:idb"),
45-
);
46-
47-
const keyStore = new KeyStore(store);
48-
49-
const db = await KVPxeDatabase.create(store);
50-
const tips = new L2TipsStore(store, "pxe");
51-
52-
const protocolContractsProvider = new LazyProtocolContractsProvider();
53-
54-
this.pxe = new PXEService(
55-
keyStore,
56-
aztecNode,
57-
db,
58-
tips,
59-
proofCreator,
60-
simulationProvider,
61-
protocolContractsProvider,
62-
config,
63-
);
64-
await this.pxe.init();
31+
this.pxe = await createPXEService(aztecNode, configWithContracts);
6532
const [accountData] = await getInitialTestAccounts();
6633
const account = await getSchnorrAccount(
6734
this.pxe,

boxes/yarn.lock

-35
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,6 @@ __metadata:
2727
languageName: node
2828
linkType: soft
2929

30-
"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=aztec-app%40workspace%3A.":
31-
version: 0.0.0-use.local
32-
resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=aztec-app%40workspace%3A."
33-
languageName: node
34-
linkType: soft
35-
36-
"@aztec/key-store@link:../yarn-project/key-store::locator=aztec-app%40workspace%3A.":
37-
version: 0.0.0-use.local
38-
resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=aztec-app%40workspace%3A."
39-
languageName: node
40-
linkType: soft
41-
42-
"@aztec/kv-store@link:../yarn-project/kv-store::locator=aztec-app%40workspace%3A.":
43-
version: 0.0.0-use.local
44-
resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=aztec-app%40workspace%3A."
45-
languageName: node
46-
linkType: soft
47-
48-
"@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=aztec-app%40workspace%3A.":
49-
version: 0.0.0-use.local
50-
resolution: "@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=aztec-app%40workspace%3A."
51-
languageName: node
52-
linkType: soft
53-
5430
"@aztec/pxe@link:../yarn-project/pxe::locator=aztec-app%40workspace%3A.":
5531
version: 0.0.0-use.local
5632
resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=aztec-app%40workspace%3A."
@@ -106,12 +82,6 @@ __metadata:
10682
languageName: unknown
10783
linkType: soft
10884

109-
"@aztec/simulator@link:../yarn-project/simulator::locator=aztec-app%40workspace%3A.":
110-
version: 0.0.0-use.local
111-
resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=aztec-app%40workspace%3A."
112-
languageName: node
113-
linkType: soft
114-
11585
"@aztec/stdlib@link:../yarn-project/stdlib::locator=aztec-app%40workspace%3A.":
11686
version: 0.0.0-use.local
11787
resolution: "@aztec/stdlib@link:../yarn-project/stdlib::locator=aztec-app%40workspace%3A."
@@ -144,12 +114,7 @@ __metadata:
144114
dependencies:
145115
"@aztec/accounts": "npm:latest"
146116
"@aztec/aztec.js": "npm:latest"
147-
"@aztec/bb-prover": "npm:latest"
148-
"@aztec/key-store": "npm:latest"
149-
"@aztec/kv-store": "npm:latest"
150-
"@aztec/protocol-contracts": "npm:latest"
151117
"@aztec/pxe": "npm:latest"
152-
"@aztec/simulator": "npm:latest"
153118
"@aztec/stdlib": "npm:latest"
154119
"@eslint/js": "npm:^9.13.0"
155120
"@types/react": "npm:^18.3.12"

noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_in_private.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ unconstrained fn transfer_in_private_failure_on_behalf_of_self_non_zero_nonce()
103103
);
104104
}
105105

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

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

noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_to_public.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_self_non_zero_nonce() {
7575
);
7676
}
7777

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

96-
#[test(should_fail_with = "Authorization not found for message hash")]
96+
#[test(should_fail_with = "Unknown auth witness for message hash")]
9797
unconstrained fn transfer_to_public_failure_on_behalf_of_other_no_approval() {
9898
let (env, nft_contract_address, sender, recipient, token_id) =
9999
utils::setup_mint_and_transfer_to_private(/* with_account_contracts */ true);

noir-projects/noir-contracts/contracts/token_contract/src/test/burn_private.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ unconstrained fn burn_private_failure_on_behalf_of_other_more_than_balance() {
7777
burn_call_interface.call(&mut env.private());
7878
}
7979

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

94-
#[test(should_fail_with = "Authorization not found for message hash")]
94+
#[test(should_fail_with = "Unknown auth witness for message hash")]
9595
unconstrained fn burn_private_failure_on_behalf_of_other_wrong_designated_caller() {
9696
let (env, token_contract_address, owner, recipient, mint_amount) =
9797
utils::setup_and_mint_to_public(/* with_account_contracts */ true);

noir-projects/noir-contracts/contracts/token_contract/src/test/transfer_in_private.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ unconstrained fn transfer_private_failure_on_behalf_of_more_than_balance() {
6767
transfer_private_from_call_interface.call(&mut env.private());
6868
}
6969

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

85-
#[test(should_fail_with = "Authorization not found for message hash")]
85+
#[test(should_fail_with = "Unknown auth witness for message hash")]
8686
unconstrained fn transfer_private_failure_on_behalf_of_other_wrong_caller() {
8787
// Setup with account contracts. Slower since we actually deploy them, but needed for authwits.
8888
let (env, token_contract_address, owner, recipient, _) =

noir-projects/noir-contracts/contracts/token_contract/src/test/transfer_to_public.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ unconstrained fn transfer_to_public_failure_on_behalf_of_other_more_than_balance
9797
transfer_to_public_call_interface.call(&mut env.private());
9898
}
9999

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

123-
#[test(should_fail_with = "Authorization not found for message hash")]
123+
#[test(should_fail_with = "Unknown auth witness for message hash")]
124124
unconstrained fn transfer_to_public_failure_on_behalf_of_other_no_approval() {
125125
let (env, token_contract_address, owner, recipient, mint_amount) =
126126
utils::setup_and_mint_to_private(/* with_account_contracts */ true);

playground/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
"dependencies": {
1919
"@aztec/accounts": "link:../yarn-project/accounts",
2020
"@aztec/aztec.js": "link:../yarn-project/aztec.js",
21-
"@aztec/bb-prover": "link:../yarn-project/bb-prover",
2221
"@aztec/foundation": "link:../yarn-project/foundation",
23-
"@aztec/key-store": "link:../yarn-project/key-store",
2422
"@aztec/kv-store": "link:../yarn-project/kv-store",
25-
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts",
2623
"@aztec/pxe": "link:../yarn-project/pxe",
27-
"@aztec/simulator": "link:../yarn-project/simulator",
2824
"@aztec/stdlib": "link:../yarn-project/stdlib",
2925
"@emotion/react": "^11.14.0",
3026
"@emotion/styled": "^11.14.0",

playground/src/aztecEnv.ts

+8-40
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
44
import { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
55
import { Contract } from '@aztec/aztec.js/contracts';
66
import { type PXE } from '@aztec/aztec.js/interfaces/pxe';
7-
import { PXEService } from '@aztec/pxe/service';
8-
import { type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/config';
9-
import { KVPxeDatabase } from '@aztec/pxe/database';
10-
import { KeyStore } from '@aztec/key-store';
11-
import { L2TipsStore } from '@aztec/kv-store/stores';
7+
import { createPXEService, type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/client/lazy';
128
import { createStore } from '@aztec/kv-store/indexeddb';
13-
import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/wasm/lazy';
14-
import { WASMSimulator } from '@aztec/simulator/client';
159
import { createContext } from 'react';
1610
import { NetworkDB, WalletDB } from './utils/storage';
1711
import { type ContractFunctionInteractionTx } from './utils/txs';
1812
import { type Logger, createLogger } from '@aztec/aztec.js/log';
19-
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
2013

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

@@ -151,44 +144,19 @@ export class AztecEnv {
151144
const config = getPXEServiceConfig();
152145
config.dataDirectory = 'pxe';
153146
config.proverEnabled = true;
154-
155-
const simulationProvider = new WASMSimulator();
156-
const proofCreator = new BBWASMLazyPrivateKernelProver(
157-
simulationProvider,
158-
16,
159-
WebLogger.getInstance().createLogger('bb:wasm:lazy'),
160-
);
161147
const l1Contracts = await aztecNode.getL1ContractAddresses();
162148
const configWithContracts = {
163149
...config,
164150
l1Contracts,
165151
} as PXEServiceConfig;
166152

167-
const store = await createStore(
168-
'pxe_data',
169-
configWithContracts,
170-
WebLogger.getInstance().createLogger('pxe:data:indexeddb'),
171-
);
172-
173-
const keyStore = new KeyStore(store);
174-
175-
const db = await KVPxeDatabase.create(store);
176-
const tips = new L2TipsStore(store, 'pxe');
177-
178-
const protocolContractsProvider = new LazyProtocolContractsProvider();
179-
180-
const pxe = new PXEService(
181-
keyStore,
182-
aztecNode,
183-
db,
184-
tips,
185-
proofCreator,
186-
simulationProvider,
187-
protocolContractsProvider,
188-
config,
189-
WebLogger.getInstance().createLogger('pxe:service'),
190-
);
191-
await pxe.init();
153+
const pxe = await createPXEService(aztecNode, configWithContracts, {
154+
loggers: {
155+
store: WebLogger.getInstance().createLogger('pxe:data:indexeddb'),
156+
pxe: WebLogger.getInstance().createLogger('pxe:service'),
157+
prover: WebLogger.getInstance().createLogger('bb:wasm:lazy'),
158+
}
159+
});
192160
return pxe;
193161
}
194162
}

playground/yarn.lock

-28
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,12 @@ __metadata:
1717
languageName: node
1818
linkType: soft
1919

20-
"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=%40aztec%2Fplayground%40workspace%3A.":
21-
version: 0.0.0-use.local
22-
resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=%40aztec%2Fplayground%40workspace%3A."
23-
languageName: node
24-
linkType: soft
25-
2620
"@aztec/foundation@link:../yarn-project/foundation::locator=%40aztec%2Fplayground%40workspace%3A.":
2721
version: 0.0.0-use.local
2822
resolution: "@aztec/foundation@link:../yarn-project/foundation::locator=%40aztec%2Fplayground%40workspace%3A."
2923
languageName: node
3024
linkType: soft
3125

32-
"@aztec/key-store@link:../yarn-project/key-store::locator=%40aztec%2Fplayground%40workspace%3A.":
33-
version: 0.0.0-use.local
34-
resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=%40aztec%2Fplayground%40workspace%3A."
35-
languageName: node
36-
linkType: soft
37-
3826
"@aztec/kv-store@link:../yarn-project/kv-store::locator=%40aztec%2Fplayground%40workspace%3A.":
3927
version: 0.0.0-use.local
4028
resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=%40aztec%2Fplayground%40workspace%3A."
@@ -47,13 +35,9 @@ __metadata:
4735
dependencies:
4836
"@aztec/accounts": "link:../yarn-project/accounts"
4937
"@aztec/aztec.js": "link:../yarn-project/aztec.js"
50-
"@aztec/bb-prover": "link:../yarn-project/bb-prover"
5138
"@aztec/foundation": "link:../yarn-project/foundation"
52-
"@aztec/key-store": "link:../yarn-project/key-store"
5339
"@aztec/kv-store": "link:../yarn-project/kv-store"
54-
"@aztec/protocol-contracts": "link:../yarn-project/protocol-contracts"
5540
"@aztec/pxe": "link:../yarn-project/pxe"
56-
"@aztec/simulator": "link:../yarn-project/simulator"
5741
"@aztec/stdlib": "link:../yarn-project/stdlib"
5842
"@emotion/react": "npm:^11.14.0"
5943
"@emotion/styled": "npm:^11.14.0"
@@ -88,24 +72,12 @@ __metadata:
8872
languageName: unknown
8973
linkType: soft
9074

91-
"@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=%40aztec%2Fplayground%40workspace%3A.":
92-
version: 0.0.0-use.local
93-
resolution: "@aztec/protocol-contracts@link:../yarn-project/protocol-contracts::locator=%40aztec%2Fplayground%40workspace%3A."
94-
languageName: node
95-
linkType: soft
96-
9775
"@aztec/pxe@link:../yarn-project/pxe::locator=%40aztec%2Fplayground%40workspace%3A.":
9876
version: 0.0.0-use.local
9977
resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=%40aztec%2Fplayground%40workspace%3A."
10078
languageName: node
10179
linkType: soft
10280

103-
"@aztec/simulator@link:../yarn-project/simulator::locator=%40aztec%2Fplayground%40workspace%3A.":
104-
version: 0.0.0-use.local
105-
resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=%40aztec%2Fplayground%40workspace%3A."
106-
languageName: node
107-
linkType: soft
108-
10981
"@aztec/stdlib@link:../yarn-project/stdlib::locator=%40aztec%2Fplayground%40workspace%3A.":
11082
version: 0.0.0-use.local
11183
resolution: "@aztec/stdlib@link:../yarn-project/stdlib::locator=%40aztec%2Fplayground%40workspace%3A."

yarn-project/aztec/src/cli/cmds/start_pxe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
type PXEServiceConfig,
1616
allPxeConfigMappings,
1717
createPXEService,
18-
} from '@aztec/pxe';
18+
} from '@aztec/pxe/server';
1919
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
2020
import { L2BasicContractsMap, Network } from '@aztec/stdlib/network';
2121
import { makeTracedFetch } from '@aztec/telemetry-client';

yarn-project/aztec/src/cli/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AccountManager, Fr } from '@aztec/aztec.js';
22
import type { ConfigMappingsType } from '@aztec/foundation/config';
33
import type { LogFn } from '@aztec/foundation/log';
4-
import type { PXEService } from '@aztec/pxe';
4+
import type { PXEService } from '@aztec/pxe/server';
55

66
import chalk from 'chalk';
77
import type { Command } from 'commander';

0 commit comments

Comments
 (0)