@aztec/end-to-end 3.0.0-nightly.20250918 → 3.0.0-nightly.20250920
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/client_flows_benchmark.js +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +3 -3
- package/dest/e2e_fees/fees_test.js +2 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +3 -1
- package/dest/e2e_p2p/shared.js +2 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts +3 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +3 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -9
- package/dest/fixtures/utils.js +6 -6
- package/dest/shared/cross_chain_test_harness.js +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +3 -2
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +7 -18
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +21 -17
- package/package.json +37 -37
- package/src/bench/client_flows/client_flows_benchmark.ts +2 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +5 -2
- package/src/e2e_fees/fees_test.ts +2 -2
- package/src/e2e_nested_contract/nested_contract_test.ts +4 -2
- package/src/e2e_p2p/shared.ts +2 -2
- package/src/e2e_token_contract/token_contract_test.ts +3 -2
- package/src/fixtures/e2e_prover_test.ts +1 -1
- package/src/fixtures/snapshot_manager.ts +9 -10
- package/src/fixtures/utils.ts +6 -6
- package/src/shared/cross_chain_test_harness.ts +1 -1
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +17 -15
- package/src/spartan/setup_test_wallets.ts +25 -14
|
@@ -154,7 +154,7 @@ export class ClientFlowsBenchmark {
|
|
|
154
154
|
this.pxe = pxe;
|
|
155
155
|
this.adminWallet = wallet;
|
|
156
156
|
this.aztecNode = aztecNode;
|
|
157
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
157
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
158
158
|
this.adminAddress = adminAddress;
|
|
159
159
|
this.sequencerAddress = sequencerAddress;
|
|
160
160
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
@@ -172,7 +172,7 @@ export class ClientFlowsBenchmark {
|
|
|
172
172
|
prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied')
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
this.userWallet = new TestWallet(this.userPXE);
|
|
175
|
+
this.userWallet = new TestWallet(this.userPXE, this.aztecNode);
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
async applySetupFeeJuiceSnapshot() {
|
|
@@ -120,7 +120,7 @@ export class BlacklistTokenContractTest {
|
|
|
120
120
|
await this.snapshotManager.teardown();
|
|
121
121
|
}
|
|
122
122
|
async addPendingShieldNoteToPXE(contract, recipient, amount, secretHash, txHash) {
|
|
123
|
-
const txEffects = await this.
|
|
123
|
+
const txEffects = await this.aztecNode.getTxEffect(txHash);
|
|
124
124
|
await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash, txEffects.data.noteHashes, txEffects.data.nullifiers[0], recipient).simulate({
|
|
125
125
|
from: recipient
|
|
126
126
|
});
|
|
@@ -45,7 +45,7 @@ export class CrossChainMessagingTest {
|
|
|
45
45
|
this.aztecNode = this.ctx.aztecNode;
|
|
46
46
|
this.pxe = this.ctx.pxe;
|
|
47
47
|
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
48
|
-
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
48
|
+
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe, this.aztecNode);
|
|
49
49
|
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
50
50
|
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,EAAE,EACF,KAAK,MAAM,EAEX,KAAK,MAAM,EAKZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA4B,KAAK,wBAAwB,EAA0B,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,KAAK,OAAO,EAAqC,MAAM,sBAAsB,CAAC;AAIrH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AAErE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,KAA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;IAKzB,0FAA0F;IAC7E,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAY/C,sDAAsD;IACzC,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK;IAShE,iEAAiE;IACpD,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,SAAK;IAUjE,kFAAkF;IACrE,wCAAwC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAUlF,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU;IAoB7F,sDAAsD;IACzC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAU;IAYhE,0GAA0G;IAC7F,cAAc;;;;IAc3B,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;IAW9E,oBAAoB,CACzB,UAAU,EAAE,eAAe,EAAE,EAC7B,WAAW,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAc;;;;CAiD/D"}
|
|
@@ -136,10 +136,10 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
136
136
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
137
137
|
const suffix = (this.proverNodes.length + 1).toString();
|
|
138
138
|
const proverNode = await withLogNameSuffix(suffix, ()=>createAndSyncProverNode(proverNodePrivateKey, {
|
|
139
|
-
...this.context.config
|
|
140
|
-
proverId: EthAddress.fromNumber(parseInt(suffix, 10))
|
|
139
|
+
...this.context.config
|
|
141
140
|
}, {
|
|
142
|
-
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex'))
|
|
141
|
+
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
|
|
142
|
+
proverId: EthAddress.fromNumber(parseInt(suffix, 10))
|
|
143
143
|
}, this.context.aztecNode, undefined, {
|
|
144
144
|
dateProvider: this.context.dateProvider
|
|
145
145
|
}));
|
|
@@ -143,7 +143,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
143
143
|
this.gasSettings = GasSettings.default({
|
|
144
144
|
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
145
145
|
});
|
|
146
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
146
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
147
147
|
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
148
148
|
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
149
149
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -230,7 +230,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
230
230
|
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
231
231
|
};
|
|
232
232
|
this.getProverFee = async (blockNumber)=>{
|
|
233
|
-
const block = await this.
|
|
233
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
234
234
|
// @todo @lherskind As we deal with #13601
|
|
235
235
|
// Right now the value is from `FeeLib.sol`
|
|
236
236
|
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
2
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
4
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
@@ -9,6 +9,7 @@ export declare class NestedContractTest {
|
|
|
9
9
|
wallet: Wallet;
|
|
10
10
|
defaultAccountAddress: AztecAddress;
|
|
11
11
|
pxe: PXE;
|
|
12
|
+
aztecNode: AztecNode;
|
|
12
13
|
parentContract: ParentContract;
|
|
13
14
|
childContract: ChildContract;
|
|
14
15
|
constructor(testName: string, numberOfAccounts?: number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAIzC,qBAAa,kBAAkB;IAa3B,OAAO,CAAC,gBAAgB;IAZ1B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAChB,qBAAqB,EAAG,YAAY,CAAC;IACrC,GAAG,EAAG,GAAG,CAAC;IACV,SAAS,EAAG,SAAS,CAAC;IAEtB,cAAc,EAAG,cAAc,CAAC;IAChC,aAAa,EAAG,aAAa,CAAC;gBAG5B,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI;IAM9B;;;;OAIG;IACG,kBAAkB;IAuBlB,KAAK;IAIL,QAAQ;IAId,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,oBAAoB;CAkB3B"}
|
|
@@ -10,6 +10,7 @@ export class NestedContractTest {
|
|
|
10
10
|
wallet;
|
|
11
11
|
defaultAccountAddress;
|
|
12
12
|
pxe;
|
|
13
|
+
aztecNode;
|
|
13
14
|
parentContract;
|
|
14
15
|
childContract;
|
|
15
16
|
constructor(testName, numberOfAccounts = 1){
|
|
@@ -23,10 +24,11 @@ export class NestedContractTest {
|
|
|
23
24
|
* 1. Add 3 accounts.
|
|
24
25
|
* 2. Publicly deploy accounts
|
|
25
26
|
*/ async applyBaseSnapshots() {
|
|
26
|
-
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), ({ deployedAccounts }, { pxe, wallet })=>{
|
|
27
|
+
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), ({ deployedAccounts }, { pxe, wallet, aztecNode })=>{
|
|
27
28
|
this.wallet = wallet;
|
|
28
29
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
29
30
|
this.pxe = pxe;
|
|
31
|
+
this.aztecNode = aztecNode;
|
|
30
32
|
return Promise.resolve();
|
|
31
33
|
});
|
|
32
34
|
await this.snapshotManager.snapshot('public_deploy', async ()=>{}, async ()=>{
|
package/dest/e2e_p2p/shared.js
CHANGED
|
@@ -33,7 +33,7 @@ export const createPXEServiceAndSubmitTransactions = async (logger, node, numTxs
|
|
|
33
33
|
const pxeService = await createPXEService(node, rpcConfig, {
|
|
34
34
|
useLogSuffix: true
|
|
35
35
|
});
|
|
36
|
-
const wallet = new TestWallet(pxeService);
|
|
36
|
+
const wallet = new TestWallet(pxeService, node);
|
|
37
37
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
38
38
|
const txs = await submitTxsTo(wallet, fundedAccountManager.getAddress(), numTxs, logger);
|
|
39
39
|
return {
|
|
@@ -48,7 +48,7 @@ export async function createPXEServiceAndPrepareTransactions(logger, node, numTx
|
|
|
48
48
|
const pxe = await createPXEService(node, rpcConfig, {
|
|
49
49
|
useLogSuffix: true
|
|
50
50
|
});
|
|
51
|
-
const wallet = new TestWallet(pxe);
|
|
51
|
+
const wallet = new TestWallet(pxe, node);
|
|
52
52
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
53
53
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
54
54
|
salt: Fr.random()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
5
6
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
6
7
|
export declare class TokenContractTest {
|
|
@@ -13,7 +14,7 @@ export declare class TokenContractTest {
|
|
|
13
14
|
tokenSim: TokenSimulator;
|
|
14
15
|
node: AztecNode;
|
|
15
16
|
badAccount: InvalidAccountContract;
|
|
16
|
-
wallet:
|
|
17
|
+
wallet: TestWallet;
|
|
17
18
|
adminAddress: AztecAddress;
|
|
18
19
|
account1Address: AztecAddress;
|
|
19
20
|
account2Address: AztecAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KA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ElE,QAAQ;IAIR,iBAAiB;CAqCxB"}
|
|
@@ -153,7 +153,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
153
153
|
}, undefined, true);
|
|
154
154
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
155
155
|
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
156
|
-
const provenWallet = new TestWallet(result.pxe);
|
|
156
|
+
const provenWallet = new TestWallet(result.pxe, this.aztecNode);
|
|
157
157
|
for(let i = 0; i < 2; i++){
|
|
158
158
|
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
159
159
|
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { type AztecAddress, type AztecNode, type Logger, type
|
|
3
|
+
import { type AztecAddress, type AztecNode, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
4
4
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
5
5
|
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
6
6
|
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
@@ -87,8 +87,8 @@ export declare const deployAccounts: (numberOfAccounts: number, logger: Logger)
|
|
|
87
87
|
* @param sender - Wallet to send the deployment tx.
|
|
88
88
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
89
89
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
90
|
-
* @param
|
|
90
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
91
91
|
*/
|
|
92
|
-
export declare function publicDeployAccounts(wallet: Wallet, accountsToDeploy: AztecAddress[], waitUntilProven?: boolean,
|
|
92
|
+
export declare function publicDeployAccounts(wallet: Wallet, accountsToDeploy: AztecAddress[], waitUntilProven?: boolean, node?: AztecNode): Promise<void>;
|
|
93
93
|
export {};
|
|
94
94
|
//# sourceMappingURL=snapshot_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA2B,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAId,KAAK,MAAM,EACX,KAAK,
|
|
1
|
+
{"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA2B,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAId,KAAK,MAAM,EACX,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAIjC,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAyC,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,UAAU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IACU,KAAK;IA0BlB;;OAEG;IACU,QAAQ;CAKtB;AAuVD;;;GAGG;AACH,eAAO,MAAM,cAAc,GACxB,kBAAkB,MAAM,EAAE,QAAQ,MAAM,MAClC,mCAAmC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,qBAAqB,EAAE,kBAAkB,EAAE,CAAA;CAAE;;EAsB5G,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,YAAY,EAAE,EAChC,eAAe,UAAQ,EACvB,IAAI,CAAC,EAAE,SAAS,iBAwBjB"}
|
|
@@ -331,8 +331,8 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
331
331
|
// Only enable proving if specifically requested.
|
|
332
332
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
333
333
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
334
|
-
const wallet = new TestWallet(pxe);
|
|
335
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
334
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
335
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
336
336
|
if (statePath) {
|
|
337
337
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
338
338
|
writeFileSync(`${statePath}/accounts.json`, JSON.stringify(initialFundedAccounts, resolver));
|
|
@@ -430,8 +430,8 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
430
430
|
const pxeConfig = getPXEServiceConfig();
|
|
431
431
|
pxeConfig.dataDirectory = statePath;
|
|
432
432
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
433
|
-
const wallet = new TestWallet(pxe);
|
|
434
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
433
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
434
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
435
435
|
return {
|
|
436
436
|
aztecNodeConfig,
|
|
437
437
|
anvil,
|
|
@@ -481,8 +481,8 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
481
481
|
* @param sender - Wallet to send the deployment tx.
|
|
482
482
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
483
483
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
484
|
-
* @param
|
|
485
|
-
*/ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false,
|
|
484
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
485
|
+
*/ export async function publicDeployAccounts(wallet, accountsToDeploy, waitUntilProven = false, node) {
|
|
486
486
|
const instances = (await Promise.all(accountsToDeploy.map((account)=>wallet.getContractMetadata(account)))).map((metadata)=>metadata.contractInstance);
|
|
487
487
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
488
488
|
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
@@ -497,10 +497,10 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
497
497
|
from: accountsToDeploy[0]
|
|
498
498
|
}).wait();
|
|
499
499
|
if (waitUntilProven) {
|
|
500
|
-
if (!
|
|
501
|
-
throw new Error('Need to provide
|
|
500
|
+
if (!node) {
|
|
501
|
+
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
502
502
|
} else {
|
|
503
|
-
await waitForProven(
|
|
503
|
+
await waitForProven(node, txReceipt);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -137,7 +137,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
137
137
|
await waitForPXE(pxeClient, logger);
|
|
138
138
|
logger.verbose('JSON RPC client connected to PXE');
|
|
139
139
|
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
140
|
-
const { l1ContractAddresses, rollupVersion } = await
|
|
140
|
+
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
141
141
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
142
142
|
const deployL1ContractsValues = {
|
|
143
143
|
l1ContractAddresses,
|
|
@@ -145,11 +145,11 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
145
145
|
rollupVersion
|
|
146
146
|
};
|
|
147
147
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
148
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
148
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient, aztecNode);
|
|
149
149
|
const teardown = ()=>Promise.resolve();
|
|
150
150
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
151
151
|
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
152
|
-
const wallet = new TestWallet(pxeClient);
|
|
152
|
+
const wallet = new TestWallet(pxeClient, aztecNode);
|
|
153
153
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
154
154
|
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
155
155
|
// Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
|
|
@@ -410,7 +410,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
410
410
|
}
|
|
411
411
|
logger.verbose('Creating a pxe...');
|
|
412
412
|
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
413
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
413
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe, aztecNode);
|
|
414
414
|
if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
|
|
415
415
|
// We need to advance such that the committee is set up.
|
|
416
416
|
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1), {
|
|
@@ -419,12 +419,12 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
419
419
|
await cheatCodes.rollup.setupEpoch();
|
|
420
420
|
await cheatCodes.rollup.debugRollup();
|
|
421
421
|
}
|
|
422
|
-
const wallet = new TestWallet(pxe);
|
|
422
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
423
423
|
let accounts = [];
|
|
424
424
|
// Below we continue with what we described in the long comment on line 571.
|
|
425
425
|
if (numberOfAccounts === 0) {
|
|
426
426
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
427
|
-
while(await
|
|
427
|
+
while(await aztecNode.getBlockNumber() === 0){
|
|
428
428
|
await sleep(2000);
|
|
429
429
|
}
|
|
430
430
|
} else {
|
|
@@ -88,7 +88,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
88
88
|
ownerAddress;
|
|
89
89
|
static async new(aztecNode, pxeService, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
|
|
90
90
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
91
|
-
const l1ContractAddresses = (await
|
|
91
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
92
92
|
// Deploy and initialize all required contracts
|
|
93
93
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
94
94
|
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, ownerAddress, underlyingERC20Address);
|
|
@@ -9,7 +9,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
9
9
|
async createReal() {
|
|
10
10
|
const { aztecNode, aztecNodeAdmin, pxeService, l1Client, wallet, logger } = this.config;
|
|
11
11
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
12
|
-
const l1ContractAddresses = (await
|
|
12
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
13
13
|
const feeJuiceAddress = l1ContractAddresses.feeJuiceAddress;
|
|
14
14
|
const feeJuicePortalAddress = l1ContractAddresses.feeJuicePortalAddress;
|
|
15
15
|
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger, type PXE
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
3
|
import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
/** Objects to be returned by the uniswap setup function */
|
|
5
6
|
export type UniswapSetupContext = {
|
|
6
7
|
/** Aztec Node instance */
|
|
@@ -12,7 +13,7 @@ export type UniswapSetupContext = {
|
|
|
12
13
|
/** The L1 wallet client, extended with public actions. */
|
|
13
14
|
l1Client: ExtendedViemWalletClient;
|
|
14
15
|
/** The wallet. */
|
|
15
|
-
wallet:
|
|
16
|
+
wallet: TestWallet;
|
|
16
17
|
/** The owner address. */
|
|
17
18
|
ownerAddress: AztecAddress;
|
|
18
19
|
/** The sponsor wallet. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkBrD,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,+CAA+C;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,0BAA0B;IAC1B,cAAc,EAAE,YAAY,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,OAAO,CAAC,mBAAmB,CAAC,EACzC,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,gCAAkC,SAo+BnC,CAAC"}
|
|
@@ -72,7 +72,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
72
72
|
uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
|
|
73
73
|
from: ownerAddress
|
|
74
74
|
}).deployed();
|
|
75
|
-
const registryAddress = (await
|
|
75
|
+
const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
76
76
|
await uniswapPortal.write.initialize([
|
|
77
77
|
registryAddress.toString(),
|
|
78
78
|
uniswapL2Contract.address.toString()
|
|
@@ -439,11 +439,8 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
439
439
|
const nonceForWETHTransferToPublicApproval = new Fr(2n);
|
|
440
440
|
const expectedMessageHash = await computeAuthWitMessageHash({
|
|
441
441
|
caller: uniswapL2Contract.address,
|
|
442
|
-
|
|
443
|
-
},
|
|
444
|
-
chainId: new Fr(await aztecNode.getChainId()),
|
|
445
|
-
version: new Fr(await aztecNode.getVersion())
|
|
446
|
-
});
|
|
442
|
+
call: await wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval).getFunctionCall()
|
|
443
|
+
}, await wallet.getChainInfo());
|
|
447
444
|
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
|
|
448
445
|
from: ownerAddress
|
|
449
446
|
})).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
|
|
@@ -478,9 +475,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
478
475
|
caller: uniswapL2Contract.address,
|
|
479
476
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
480
477
|
}, true);
|
|
481
|
-
await validateActionInteraction.send(
|
|
482
|
-
from: ownerAddress
|
|
483
|
-
}).wait();
|
|
478
|
+
await validateActionInteraction.send().wait();
|
|
484
479
|
// No approval to call `swap` but should work even without it:
|
|
485
480
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
486
481
|
await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -500,9 +495,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
500
495
|
caller: approvedUser,
|
|
501
496
|
action
|
|
502
497
|
}, true);
|
|
503
|
-
await validateActionInteraction.send(
|
|
504
|
-
from: ownerAddress
|
|
505
|
-
}).wait();
|
|
498
|
+
await validateActionInteraction.send().wait();
|
|
506
499
|
await expect(action.simulate({
|
|
507
500
|
from: sponsorAddress
|
|
508
501
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -514,9 +507,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
514
507
|
caller: uniswapL2Contract.address,
|
|
515
508
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
516
509
|
}, true);
|
|
517
|
-
await validateActionInteraction.send(
|
|
518
|
-
from: ownerAddress
|
|
519
|
-
}).wait();
|
|
510
|
+
await validateActionInteraction.send().wait();
|
|
520
511
|
await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate({
|
|
521
512
|
from: ownerAddress
|
|
522
513
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -622,9 +613,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
622
613
|
caller: uniswapL2Contract.address,
|
|
623
614
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
624
615
|
}, true);
|
|
625
|
-
await validateActionInteraction.send(
|
|
626
|
-
from: ownerAddress
|
|
627
|
-
}).wait();
|
|
616
|
+
await validateActionInteraction.send().wait();
|
|
628
617
|
// Call swap_public on L2
|
|
629
618
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
630
619
|
const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type AztecAddress, type FeePaymentMethod, type PXE } from '@aztec/aztec.js';
|
|
1
|
+
import { type AztecAddress, type AztecNode, type FeePaymentMethod, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
4
|
import { TestWallet } from '@aztec/test-wallet';
|
|
5
5
|
export interface TestAccounts {
|
|
6
6
|
pxe: PXE;
|
|
7
|
+
aztecNode: AztecNode;
|
|
7
8
|
wallet: TestWallet;
|
|
8
9
|
accounts: AztecAddress[];
|
|
9
10
|
tokenContract: TokenContract;
|
|
@@ -12,8 +13,8 @@ export interface TestAccounts {
|
|
|
12
13
|
recipientAddress: AztecAddress;
|
|
13
14
|
tokenAddress: AztecAddress;
|
|
14
15
|
}
|
|
15
|
-
export declare function setupTestAccountsWithTokens(pxeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestAccounts>;
|
|
16
|
-
export declare function deploySponsoredTestAccounts(pxe: PXE, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestAccounts>;
|
|
16
|
+
export declare function setupTestAccountsWithTokens(pxeUrl: string, nodeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestAccounts>;
|
|
17
|
+
export declare function deploySponsoredTestAccounts(pxe: PXE, aztecNode: AztecNode, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestAccounts>;
|
|
17
18
|
export declare function deployTestAccountsWithTokens(pxeUrl: string, nodeUrl: string, l1RpcUrls: string[], mnemonicOrPrivateKey: string, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestAccounts>;
|
|
18
19
|
export declare function performTransfers({ testAccounts, rounds, transferAmount, logger, feePaymentMethod, }: {
|
|
19
20
|
testAccounts: TestAccounts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,gBAAgB,EAGrB,KAAK,GAAG,EAMT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAMD,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CA+BvB;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,YAAY,CAAC,CAsCvB;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,YAAY,CAAC,CAkDvB;AAgFD,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,EAAE;IACD,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,iBAiBA;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAmBrD"}
|
|
@@ -10,16 +10,18 @@ import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.
|
|
|
10
10
|
const TOKEN_NAME = 'USDC';
|
|
11
11
|
const TOKEN_SYMBOL = 'USD';
|
|
12
12
|
const TOKEN_DECIMALS = 18n;
|
|
13
|
-
export async function setupTestAccountsWithTokens(pxeUrl, mintAmount, logger) {
|
|
13
|
+
export async function setupTestAccountsWithTokens(pxeUrl, nodeUrl, mintAmount, logger) {
|
|
14
14
|
const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
|
|
15
15
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
16
|
-
const
|
|
16
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
17
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
17
18
|
const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(pxe)).slice(0, ACCOUNT_COUNT + 1);
|
|
18
19
|
const tokenAdmin = accounts[0];
|
|
19
20
|
const tokenAddress = await deployTokenAndMint(wallet, accounts.map((acc)=>acc.address), tokenAdmin.address, mintAmount, undefined, logger);
|
|
20
21
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
21
22
|
return {
|
|
22
23
|
pxe,
|
|
24
|
+
aztecNode,
|
|
23
25
|
accounts: accounts.map((acc)=>acc.address),
|
|
24
26
|
wallet,
|
|
25
27
|
tokenAdminAddress: tokenAdmin.address,
|
|
@@ -29,8 +31,8 @@ export async function setupTestAccountsWithTokens(pxeUrl, mintAmount, logger) {
|
|
|
29
31
|
recipientAddress: recipientAccount.address
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
|
-
export async function deploySponsoredTestAccounts(pxe, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
33
|
-
const wallet = new TestWallet(pxe);
|
|
34
|
+
export async function deploySponsoredTestAccounts(pxe, aztecNode, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
35
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
34
36
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
35
37
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
36
38
|
const fundedAccounts = await Promise.all(funded.map((a)=>wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
@@ -51,6 +53,7 @@ export async function deploySponsoredTestAccounts(pxe, mintAmount, logger, numbe
|
|
|
51
53
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
52
54
|
return {
|
|
53
55
|
pxe,
|
|
56
|
+
aztecNode,
|
|
54
57
|
wallet,
|
|
55
58
|
accounts: fundedAccounts.map((acc)=>acc.getAddress()),
|
|
56
59
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
@@ -62,16 +65,16 @@ export async function deploySponsoredTestAccounts(pxe, mintAmount, logger, numbe
|
|
|
62
65
|
}
|
|
63
66
|
export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mnemonicOrPrivateKey, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
64
67
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
65
|
-
const
|
|
66
|
-
const wallet = new TestWallet(pxe);
|
|
68
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
69
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
67
70
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
68
71
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
69
72
|
const fundedAccounts = await Promise.all(funded.map((a)=>wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
70
|
-
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)));
|
|
73
|
+
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, aztecNode, a.getAddress(), undefined, logger)));
|
|
71
74
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
72
|
-
await advanceL2Block(
|
|
73
|
-
await advanceL2Block(
|
|
74
|
-
await advanceL2Block(
|
|
75
|
+
await advanceL2Block(aztecNode);
|
|
76
|
+
await advanceL2Block(aztecNode);
|
|
77
|
+
await advanceL2Block(aztecNode);
|
|
75
78
|
await Promise.all(fundedAccounts.map(async (a, i)=>{
|
|
76
79
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.getAddress(), claims[i]);
|
|
77
80
|
await a.deploy({
|
|
@@ -86,6 +89,7 @@ export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, m
|
|
|
86
89
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
87
90
|
return {
|
|
88
91
|
pxe,
|
|
92
|
+
aztecNode,
|
|
89
93
|
wallet,
|
|
90
94
|
accounts: fundedAccounts.map((acc)=>acc.getAddress()),
|
|
91
95
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
@@ -95,21 +99,21 @@ export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, m
|
|
|
95
99
|
recipientAddress: recipientAccount.getAddress()
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
|
-
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
99
|
-
const { l1ChainId } = await
|
|
102
|
+
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, aztecNode, recipient, amount, log) {
|
|
103
|
+
const { l1ChainId } = await aztecNode.getNodeInfo();
|
|
100
104
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
101
105
|
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
102
106
|
// docs:start:bridge_fee_juice
|
|
103
|
-
const portal = await L1FeeJuicePortalManager.new(
|
|
107
|
+
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
104
108
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true);
|
|
105
109
|
// docs:end:bridge_fee_juice
|
|
106
|
-
const isSynced = async ()=>await
|
|
110
|
+
const isSynced = async ()=>await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash)) !== undefined;
|
|
107
111
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
108
112
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
109
113
|
return claim;
|
|
110
114
|
}
|
|
111
|
-
async function advanceL2Block(
|
|
112
|
-
const initialBlockNumber = await
|
|
115
|
+
async function advanceL2Block(aztecNode, nodeAdmin) {
|
|
116
|
+
const initialBlockNumber = await aztecNode.getBlockNumber();
|
|
113
117
|
let minTxsPerBlock = undefined;
|
|
114
118
|
if (nodeAdmin) {
|
|
115
119
|
({ minTxsPerBlock } = await nodeAdmin.getConfig());
|
|
@@ -117,7 +121,7 @@ async function advanceL2Block(node, nodeAdmin) {
|
|
|
117
121
|
minTxsPerBlock: 0
|
|
118
122
|
}); // Set to 0 to ensure we can advance the block
|
|
119
123
|
}
|
|
120
|
-
await retryUntil(async ()=>await
|
|
124
|
+
await retryUntil(async ()=>await aztecNode.getBlockNumber() >= initialBlockNumber + 1);
|
|
121
125
|
if (nodeAdmin && minTxsPerBlock !== undefined) {
|
|
122
126
|
await nodeAdmin.setConfig({
|
|
123
127
|
minTxsPerBlock
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250920",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,42 +25,42 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "3.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "3.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "3.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "3.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
46
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
47
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
48
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
50
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
52
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
53
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
54
|
-
"@aztec/prover-node": "3.0.0-nightly.
|
|
55
|
-
"@aztec/pxe": "3.0.0-nightly.
|
|
56
|
-
"@aztec/sequencer-client": "3.0.0-nightly.
|
|
57
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
58
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
59
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
60
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
61
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
62
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
63
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "3.0.0-nightly.20250920",
|
|
29
|
+
"@aztec/archiver": "3.0.0-nightly.20250920",
|
|
30
|
+
"@aztec/aztec": "3.0.0-nightly.20250920",
|
|
31
|
+
"@aztec/aztec-node": "3.0.0-nightly.20250920",
|
|
32
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250920",
|
|
33
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250920",
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250920",
|
|
35
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250920",
|
|
36
|
+
"@aztec/bot": "3.0.0-nightly.20250920",
|
|
37
|
+
"@aztec/cli": "3.0.0-nightly.20250920",
|
|
38
|
+
"@aztec/constants": "3.0.0-nightly.20250920",
|
|
39
|
+
"@aztec/entrypoints": "3.0.0-nightly.20250920",
|
|
40
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250920",
|
|
41
|
+
"@aztec/ethereum": "3.0.0-nightly.20250920",
|
|
42
|
+
"@aztec/foundation": "3.0.0-nightly.20250920",
|
|
43
|
+
"@aztec/kv-store": "3.0.0-nightly.20250920",
|
|
44
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250920",
|
|
45
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20250920",
|
|
46
|
+
"@aztec/node-keystore": "3.0.0-nightly.20250920",
|
|
47
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250920",
|
|
48
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20250920",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250920",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20250920",
|
|
51
|
+
"@aztec/p2p": "3.0.0-nightly.20250920",
|
|
52
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250920",
|
|
53
|
+
"@aztec/prover-client": "3.0.0-nightly.20250920",
|
|
54
|
+
"@aztec/prover-node": "3.0.0-nightly.20250920",
|
|
55
|
+
"@aztec/pxe": "3.0.0-nightly.20250920",
|
|
56
|
+
"@aztec/sequencer-client": "3.0.0-nightly.20250920",
|
|
57
|
+
"@aztec/simulator": "3.0.0-nightly.20250920",
|
|
58
|
+
"@aztec/slasher": "3.0.0-nightly.20250920",
|
|
59
|
+
"@aztec/stdlib": "3.0.0-nightly.20250920",
|
|
60
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250920",
|
|
61
|
+
"@aztec/test-wallet": "3.0.0-nightly.20250920",
|
|
62
|
+
"@aztec/validator-client": "3.0.0-nightly.20250920",
|
|
63
|
+
"@aztec/world-state": "3.0.0-nightly.20250920",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@jest/globals": "^30.0.0",
|
|
66
66
|
"@noble/curves": "=1.0.0",
|
|
@@ -207,7 +207,7 @@ export class ClientFlowsBenchmark {
|
|
|
207
207
|
this.pxe = pxe;
|
|
208
208
|
this.adminWallet = wallet;
|
|
209
209
|
this.aztecNode = aztecNode;
|
|
210
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
210
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
211
211
|
|
|
212
212
|
this.adminAddress = adminAddress;
|
|
213
213
|
this.sequencerAddress = sequencerAddress;
|
|
@@ -229,7 +229,7 @@ export class ClientFlowsBenchmark {
|
|
|
229
229
|
prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
|
|
230
230
|
},
|
|
231
231
|
});
|
|
232
|
-
this.userWallet = new TestWallet(this.userPXE);
|
|
232
|
+
this.userWallet = new TestWallet(this.userPXE, this.aztecNode);
|
|
233
233
|
},
|
|
234
234
|
);
|
|
235
235
|
}
|
|
@@ -178,7 +178,7 @@ export class BlacklistTokenContractTest {
|
|
|
178
178
|
secretHash: Fr,
|
|
179
179
|
txHash: TxHash,
|
|
180
180
|
) {
|
|
181
|
-
const txEffects = await this.
|
|
181
|
+
const txEffects = await this.aztecNode.getTxEffect(txHash);
|
|
182
182
|
await contract.methods
|
|
183
183
|
.deliver_transparent_note(
|
|
184
184
|
contract.address,
|
|
@@ -72,7 +72,7 @@ export class CrossChainMessagingTest {
|
|
|
72
72
|
this.aztecNode = this.ctx.aztecNode;
|
|
73
73
|
this.pxe = this.ctx.pxe;
|
|
74
74
|
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
75
|
-
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
75
|
+
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe, this.aztecNode);
|
|
76
76
|
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
77
77
|
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
78
78
|
}
|
|
@@ -194,8 +194,11 @@ export class EpochsTestContext {
|
|
|
194
194
|
const proverNode = await withLogNameSuffix(suffix, () =>
|
|
195
195
|
createAndSyncProverNode(
|
|
196
196
|
proverNodePrivateKey,
|
|
197
|
-
{ ...this.context.config
|
|
198
|
-
{
|
|
197
|
+
{ ...this.context.config },
|
|
198
|
+
{
|
|
199
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
200
|
+
proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
|
|
201
|
+
},
|
|
199
202
|
this.context.aztecNode,
|
|
200
203
|
undefined,
|
|
201
204
|
{ dateProvider: this.context.dateProvider },
|
|
@@ -188,7 +188,7 @@ export class FeesTest {
|
|
|
188
188
|
this.wallet = wallet;
|
|
189
189
|
this.aztecNode = aztecNode;
|
|
190
190
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
191
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
191
|
+
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
192
192
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
193
193
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
194
194
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -318,7 +318,7 @@ export class FeesTest {
|
|
|
318
318
|
};
|
|
319
319
|
|
|
320
320
|
this.getProverFee = async (blockNumber: number) => {
|
|
321
|
-
const block = await this.
|
|
321
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
322
322
|
|
|
323
323
|
// @todo @lherskind As we deal with #13601
|
|
324
324
|
// Right now the value is from `FeeLib.sol`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, type Logger, type PXE, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
4
|
|
|
@@ -18,6 +18,7 @@ export class NestedContractTest {
|
|
|
18
18
|
wallet!: Wallet;
|
|
19
19
|
defaultAccountAddress!: AztecAddress;
|
|
20
20
|
pxe!: PXE;
|
|
21
|
+
aztecNode!: AztecNode;
|
|
21
22
|
|
|
22
23
|
parentContract!: ParentContract;
|
|
23
24
|
childContract!: ChildContract;
|
|
@@ -39,10 +40,11 @@ export class NestedContractTest {
|
|
|
39
40
|
await this.snapshotManager.snapshot(
|
|
40
41
|
'accounts',
|
|
41
42
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
42
|
-
({ deployedAccounts }, { pxe, wallet }) => {
|
|
43
|
+
({ deployedAccounts }, { pxe, wallet, aztecNode }) => {
|
|
43
44
|
this.wallet = wallet;
|
|
44
45
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
45
46
|
this.pxe = pxe;
|
|
47
|
+
this.aztecNode = aztecNode;
|
|
46
48
|
return Promise.resolve();
|
|
47
49
|
},
|
|
48
50
|
);
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const createPXEServiceAndSubmitTransactions = async (
|
|
|
65
65
|
const rpcConfig = getRpcConfig();
|
|
66
66
|
rpcConfig.proverEnabled = false;
|
|
67
67
|
const pxeService = await createPXEService(node, rpcConfig, { useLogSuffix: true });
|
|
68
|
-
const wallet = new TestWallet(pxeService);
|
|
68
|
+
const wallet = new TestWallet(pxeService, node);
|
|
69
69
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
70
70
|
const txs = await submitTxsTo(wallet, fundedAccountManager.getAddress(), numTxs, logger);
|
|
71
71
|
return { txs, pxeService, node };
|
|
@@ -81,7 +81,7 @@ export async function createPXEServiceAndPrepareTransactions(
|
|
|
81
81
|
rpcConfig.proverEnabled = false;
|
|
82
82
|
const pxe = await createPXEService(node, rpcConfig, { useLogSuffix: true });
|
|
83
83
|
|
|
84
|
-
const wallet = new TestWallet(pxe);
|
|
84
|
+
const wallet = new TestWallet(pxe, node);
|
|
85
85
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
86
86
|
|
|
87
87
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger,
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
|
|
5
6
|
import { jest } from '@jest/globals';
|
|
6
7
|
|
|
@@ -27,7 +28,7 @@ export class TokenContractTest {
|
|
|
27
28
|
node!: AztecNode;
|
|
28
29
|
|
|
29
30
|
badAccount!: InvalidAccountContract;
|
|
30
|
-
wallet!:
|
|
31
|
+
wallet!: TestWallet;
|
|
31
32
|
adminAddress!: AztecAddress;
|
|
32
33
|
account1Address!: AztecAddress;
|
|
33
34
|
account2Address!: AztecAddress;
|
|
@@ -224,7 +224,7 @@ export class FullProverTest {
|
|
|
224
224
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
225
225
|
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
226
226
|
|
|
227
|
-
const provenWallet = new TestWallet(result.pxe);
|
|
227
|
+
const provenWallet = new TestWallet(result.pxe, this.aztecNode);
|
|
228
228
|
|
|
229
229
|
for (let i = 0; i < 2; i++) {
|
|
230
230
|
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
type ContractFunctionInteraction,
|
|
9
9
|
EthAddress,
|
|
10
10
|
type Logger,
|
|
11
|
-
type PXE,
|
|
12
11
|
type Wallet,
|
|
13
12
|
getContractClassFromArtifact,
|
|
14
13
|
waitForProven,
|
|
@@ -449,8 +448,8 @@ async function setupFromFresh(
|
|
|
449
448
|
// Only enable proving if specifically requested.
|
|
450
449
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
451
450
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
452
|
-
const wallet = new TestWallet(pxe);
|
|
453
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
451
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
452
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
454
453
|
|
|
455
454
|
if (statePath) {
|
|
456
455
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -578,8 +577,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
578
577
|
const pxeConfig = getPXEServiceConfig();
|
|
579
578
|
pxeConfig.dataDirectory = statePath;
|
|
580
579
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
581
|
-
const wallet = new TestWallet(pxe);
|
|
582
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
580
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
581
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe, aztecNode);
|
|
583
582
|
|
|
584
583
|
return {
|
|
585
584
|
aztecNodeConfig,
|
|
@@ -641,13 +640,13 @@ export const deployAccounts =
|
|
|
641
640
|
* @param sender - Wallet to send the deployment tx.
|
|
642
641
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
643
642
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
644
|
-
* @param
|
|
643
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
645
644
|
*/
|
|
646
645
|
export async function publicDeployAccounts(
|
|
647
646
|
wallet: Wallet,
|
|
648
647
|
accountsToDeploy: AztecAddress[],
|
|
649
648
|
waitUntilProven = false,
|
|
650
|
-
|
|
649
|
+
node?: AztecNode,
|
|
651
650
|
) {
|
|
652
651
|
const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
|
|
653
652
|
metadata => metadata.contractInstance,
|
|
@@ -665,10 +664,10 @@ export async function publicDeployAccounts(
|
|
|
665
664
|
|
|
666
665
|
const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
667
666
|
if (waitUntilProven) {
|
|
668
|
-
if (!
|
|
669
|
-
throw new Error('Need to provide
|
|
667
|
+
if (!node) {
|
|
668
|
+
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
670
669
|
} else {
|
|
671
|
-
await waitForProven(
|
|
670
|
+
await waitForProven(node, txReceipt);
|
|
672
671
|
}
|
|
673
672
|
}
|
|
674
673
|
}
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -226,7 +226,7 @@ async function setupWithRemoteEnvironment(
|
|
|
226
226
|
await waitForPXE(pxeClient, logger);
|
|
227
227
|
logger.verbose('JSON RPC client connected to PXE');
|
|
228
228
|
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
229
|
-
const { l1ContractAddresses, rollupVersion } = await
|
|
229
|
+
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
230
230
|
|
|
231
231
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
232
232
|
|
|
@@ -236,12 +236,12 @@ async function setupWithRemoteEnvironment(
|
|
|
236
236
|
rollupVersion,
|
|
237
237
|
};
|
|
238
238
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
239
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient
|
|
239
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!, aztecNode);
|
|
240
240
|
const teardown = () => Promise.resolve();
|
|
241
241
|
|
|
242
242
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
243
243
|
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
244
|
-
const wallet = new TestWallet(pxeClient);
|
|
244
|
+
const wallet = new TestWallet(pxeClient, aztecNode);
|
|
245
245
|
|
|
246
246
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
247
247
|
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
@@ -657,7 +657,7 @@ export async function setup(
|
|
|
657
657
|
logger.verbose('Creating a pxe...');
|
|
658
658
|
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode!, pxeOpts, logger);
|
|
659
659
|
|
|
660
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe
|
|
660
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe!, aztecNode);
|
|
661
661
|
|
|
662
662
|
if (
|
|
663
663
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -670,12 +670,12 @@ export async function setup(
|
|
|
670
670
|
await cheatCodes.rollup.setupEpoch();
|
|
671
671
|
await cheatCodes.rollup.debugRollup();
|
|
672
672
|
}
|
|
673
|
-
const wallet = new TestWallet(pxe);
|
|
673
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
674
674
|
let accounts: AztecAddress[] = [];
|
|
675
675
|
// Below we continue with what we described in the long comment on line 571.
|
|
676
676
|
if (numberOfAccounts === 0) {
|
|
677
677
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
678
|
-
while ((await
|
|
678
|
+
while ((await aztecNode.getBlockNumber()) === 0) {
|
|
679
679
|
await sleep(2000);
|
|
680
680
|
}
|
|
681
681
|
} else {
|
|
@@ -139,7 +139,7 @@ export class CrossChainTestHarness {
|
|
|
139
139
|
underlyingERC20Address: EthAddress,
|
|
140
140
|
): Promise<CrossChainTestHarness> {
|
|
141
141
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
142
|
-
const l1ContractAddresses = (await
|
|
142
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
143
143
|
|
|
144
144
|
// Deploy and initialize all required contracts
|
|
145
145
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
@@ -41,7 +41,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
41
41
|
const { aztecNode, aztecNodeAdmin, pxeService, l1Client, wallet, logger } = this.config;
|
|
42
42
|
|
|
43
43
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
44
|
-
const l1ContractAddresses = (await
|
|
44
|
+
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
45
45
|
|
|
46
46
|
const feeJuiceAddress = l1ContractAddresses.feeJuiceAddress;
|
|
47
47
|
const feeJuicePortalAddress = l1ContractAddresses.feeJuicePortalAddress;
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
Fr,
|
|
6
6
|
type Logger,
|
|
7
7
|
type PXE,
|
|
8
|
-
type Wallet,
|
|
9
8
|
computeAuthWitMessageHash,
|
|
10
9
|
generateClaimSecret,
|
|
11
10
|
} from '@aztec/aztec.js';
|
|
@@ -22,6 +21,7 @@ import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-art
|
|
|
22
21
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
23
22
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
24
23
|
import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
24
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
25
25
|
|
|
26
26
|
import { jest } from '@jest/globals';
|
|
27
27
|
import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
|
|
@@ -50,7 +50,7 @@ export type UniswapSetupContext = {
|
|
|
50
50
|
/** The L1 wallet client, extended with public actions. */
|
|
51
51
|
l1Client: ExtendedViemWalletClient;
|
|
52
52
|
/** The wallet. */
|
|
53
|
-
wallet:
|
|
53
|
+
wallet: TestWallet;
|
|
54
54
|
/** The owner address. */
|
|
55
55
|
ownerAddress: AztecAddress;
|
|
56
56
|
/** The sponsor wallet. */
|
|
@@ -80,7 +80,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
80
80
|
|
|
81
81
|
let l1Client: ExtendedViemWalletClient;
|
|
82
82
|
|
|
83
|
-
let wallet:
|
|
83
|
+
let wallet: TestWallet;
|
|
84
84
|
let ownerAddress: AztecAddress;
|
|
85
85
|
let ownerEthAddress: EthAddress;
|
|
86
86
|
// does transactions on behalf of owner on Aztec:
|
|
@@ -155,7 +155,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
155
155
|
.send({ from: ownerAddress })
|
|
156
156
|
.deployed();
|
|
157
157
|
|
|
158
|
-
const registryAddress = (await
|
|
158
|
+
const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
159
159
|
|
|
160
160
|
await uniswapPortal.write.initialize(
|
|
161
161
|
[registryAddress.toString(), uniswapL2Contract.address.toString()],
|
|
@@ -614,14 +614,16 @@ export const uniswapL1L2TestSuite = (
|
|
|
614
614
|
const expectedMessageHash = await computeAuthWitMessageHash(
|
|
615
615
|
{
|
|
616
616
|
caller: uniswapL2Contract.address,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
617
|
+
call: await wethCrossChainHarness.l2Token.methods
|
|
618
|
+
.transfer_to_public(
|
|
619
|
+
ownerAddress,
|
|
620
|
+
uniswapL2Contract.address,
|
|
621
|
+
wethAmountToBridge,
|
|
622
|
+
nonceForWETHTransferToPublicApproval,
|
|
623
|
+
)
|
|
624
|
+
.getFunctionCall(),
|
|
623
625
|
},
|
|
624
|
-
|
|
626
|
+
await wallet.getChainInfo(),
|
|
625
627
|
);
|
|
626
628
|
|
|
627
629
|
await expect(
|
|
@@ -699,7 +701,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
699
701
|
},
|
|
700
702
|
true,
|
|
701
703
|
);
|
|
702
|
-
await validateActionInteraction.send(
|
|
704
|
+
await validateActionInteraction.send().wait();
|
|
703
705
|
|
|
704
706
|
// No approval to call `swap` but should work even without it:
|
|
705
707
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
@@ -749,7 +751,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
749
751
|
{ caller: approvedUser, action },
|
|
750
752
|
true,
|
|
751
753
|
);
|
|
752
|
-
await validateActionInteraction.send(
|
|
754
|
+
await validateActionInteraction.send().wait();
|
|
753
755
|
|
|
754
756
|
await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
|
|
755
757
|
});
|
|
@@ -771,7 +773,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
771
773
|
},
|
|
772
774
|
true,
|
|
773
775
|
);
|
|
774
|
-
await validateActionInteraction.send(
|
|
776
|
+
await validateActionInteraction.send().wait();
|
|
775
777
|
|
|
776
778
|
await expect(
|
|
777
779
|
uniswapL2Contract.methods
|
|
@@ -942,7 +944,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
942
944
|
},
|
|
943
945
|
true,
|
|
944
946
|
);
|
|
945
|
-
await validateActionInteraction.send(
|
|
947
|
+
await validateActionInteraction.send().wait();
|
|
946
948
|
|
|
947
949
|
// Call swap_public on L2
|
|
948
950
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
@@ -26,6 +26,7 @@ import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.
|
|
|
26
26
|
|
|
27
27
|
export interface TestAccounts {
|
|
28
28
|
pxe: PXE;
|
|
29
|
+
aztecNode: AztecNode;
|
|
29
30
|
wallet: TestWallet;
|
|
30
31
|
accounts: AztecAddress[];
|
|
31
32
|
tokenContract: TokenContract;
|
|
@@ -41,13 +42,15 @@ const TOKEN_DECIMALS = 18n;
|
|
|
41
42
|
|
|
42
43
|
export async function setupTestAccountsWithTokens(
|
|
43
44
|
pxeUrl: string,
|
|
45
|
+
nodeUrl: string,
|
|
44
46
|
mintAmount: bigint,
|
|
45
47
|
logger: Logger,
|
|
46
48
|
): Promise<TestAccounts> {
|
|
47
49
|
const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
|
|
48
50
|
|
|
49
51
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
50
|
-
const
|
|
52
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
53
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
51
54
|
|
|
52
55
|
const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(pxe)).slice(0, ACCOUNT_COUNT + 1);
|
|
53
56
|
|
|
@@ -64,6 +67,7 @@ export async function setupTestAccountsWithTokens(
|
|
|
64
67
|
|
|
65
68
|
return {
|
|
66
69
|
pxe,
|
|
70
|
+
aztecNode,
|
|
67
71
|
accounts: accounts.map(acc => acc.address),
|
|
68
72
|
wallet,
|
|
69
73
|
tokenAdminAddress: tokenAdmin.address,
|
|
@@ -76,11 +80,12 @@ export async function setupTestAccountsWithTokens(
|
|
|
76
80
|
|
|
77
81
|
export async function deploySponsoredTestAccounts(
|
|
78
82
|
pxe: PXE,
|
|
83
|
+
aztecNode: AztecNode,
|
|
79
84
|
mintAmount: bigint,
|
|
80
85
|
logger: Logger,
|
|
81
86
|
numberOfFundedWallets = 1,
|
|
82
87
|
): Promise<TestAccounts> {
|
|
83
|
-
const wallet = new TestWallet(pxe);
|
|
88
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
84
89
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
85
90
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
86
91
|
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
@@ -108,6 +113,7 @@ export async function deploySponsoredTestAccounts(
|
|
|
108
113
|
|
|
109
114
|
return {
|
|
110
115
|
pxe,
|
|
116
|
+
aztecNode,
|
|
111
117
|
wallet,
|
|
112
118
|
accounts: fundedAccounts.map(acc => acc.getAddress()),
|
|
113
119
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
@@ -128,21 +134,23 @@ export async function deployTestAccountsWithTokens(
|
|
|
128
134
|
numberOfFundedWallets = 1,
|
|
129
135
|
): Promise<TestAccounts> {
|
|
130
136
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
131
|
-
const
|
|
132
|
-
const wallet = new TestWallet(pxe);
|
|
137
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
138
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
133
139
|
|
|
134
140
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
135
141
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
136
142
|
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
137
143
|
|
|
138
144
|
const claims = await Promise.all(
|
|
139
|
-
fundedAccounts.map(a =>
|
|
145
|
+
fundedAccounts.map(a =>
|
|
146
|
+
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, aztecNode, a.getAddress(), undefined, logger),
|
|
147
|
+
),
|
|
140
148
|
);
|
|
141
149
|
|
|
142
150
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
143
|
-
await advanceL2Block(
|
|
144
|
-
await advanceL2Block(
|
|
145
|
-
await advanceL2Block(
|
|
151
|
+
await advanceL2Block(aztecNode);
|
|
152
|
+
await advanceL2Block(aztecNode);
|
|
153
|
+
await advanceL2Block(aztecNode);
|
|
146
154
|
|
|
147
155
|
await Promise.all(
|
|
148
156
|
fundedAccounts.map(async (a, i) => {
|
|
@@ -165,6 +173,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
165
173
|
|
|
166
174
|
return {
|
|
167
175
|
pxe,
|
|
176
|
+
aztecNode,
|
|
168
177
|
wallet,
|
|
169
178
|
accounts: fundedAccounts.map(acc => acc.getAddress()),
|
|
170
179
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
@@ -179,28 +188,30 @@ async function bridgeL1FeeJuice(
|
|
|
179
188
|
l1RpcUrls: string[],
|
|
180
189
|
mnemonicOrPrivateKey: string,
|
|
181
190
|
pxe: PXE,
|
|
191
|
+
aztecNode: AztecNode,
|
|
182
192
|
recipient: AztecAddress,
|
|
183
193
|
amount: bigint | undefined,
|
|
184
194
|
log: Logger,
|
|
185
195
|
) {
|
|
186
|
-
const { l1ChainId } = await
|
|
196
|
+
const { l1ChainId } = await aztecNode.getNodeInfo();
|
|
187
197
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
188
198
|
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
189
199
|
|
|
190
200
|
// docs:start:bridge_fee_juice
|
|
191
|
-
const portal = await L1FeeJuicePortalManager.new(
|
|
201
|
+
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
192
202
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
193
203
|
// docs:end:bridge_fee_juice
|
|
194
204
|
|
|
195
|
-
const isSynced = async () =>
|
|
205
|
+
const isSynced = async () =>
|
|
206
|
+
(await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
196
207
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
197
208
|
|
|
198
209
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
199
210
|
return claim;
|
|
200
211
|
}
|
|
201
212
|
|
|
202
|
-
async function advanceL2Block(
|
|
203
|
-
const initialBlockNumber = await
|
|
213
|
+
async function advanceL2Block(aztecNode: AztecNode, nodeAdmin?: AztecNodeAdmin) {
|
|
214
|
+
const initialBlockNumber = await aztecNode.getBlockNumber();
|
|
204
215
|
|
|
205
216
|
let minTxsPerBlock = undefined;
|
|
206
217
|
if (nodeAdmin) {
|
|
@@ -208,7 +219,7 @@ async function advanceL2Block(node: AztecNode, nodeAdmin?: AztecNodeAdmin) {
|
|
|
208
219
|
await nodeAdmin.setConfig({ minTxsPerBlock: 0 }); // Set to 0 to ensure we can advance the block
|
|
209
220
|
}
|
|
210
221
|
|
|
211
|
-
await retryUntil(async () => (await
|
|
222
|
+
await retryUntil(async () => (await aztecNode.getBlockNumber()) >= initialBlockNumber + 1);
|
|
212
223
|
|
|
213
224
|
if (nodeAdmin && minTxsPerBlock !== undefined) {
|
|
214
225
|
await nodeAdmin.setConfig({ minTxsPerBlock });
|