diff --git a/yarn-project/end-to-end/src/e2e_card_game.test.ts b/yarn-project/end-to-end/src/e2e_card_game.test.ts index 2632ef1a648..84d52e8cca4 100644 --- a/yarn-project/end-to-end/src/e2e_card_game.test.ts +++ b/yarn-project/end-to-end/src/e2e_card_game.test.ts @@ -1,4 +1,10 @@ -import { AccountWallet, AztecAddress, Wallet, getSandboxAccountsWallets } from '@aztec/aztec.js'; +import { + AccountWallet, + AztecAddress, + Wallet, + deployInitialSandboxAccounts, + getSandboxAccountsWallets, +} from '@aztec/aztec.js'; import { DebugLogger } from '@aztec/foundation/log'; import { CardGameContract } from '@aztec/noir-contracts/types'; import { PXE } from '@aztec/types'; @@ -7,6 +13,8 @@ import { setup } from './fixtures/utils.js'; /* eslint-disable camelcase */ +const { PXE_URL } = process.env; + interface Card { points: bigint; strength: bigint; @@ -65,7 +73,14 @@ describe('e2e_card_game', () => { // Card stats are derived from the users' private keys, so to get consistent values, we set up the // initial sandbox accounts that always use the same private keys, instead of random ones. ({ pxe, logger, teardown } = await setup(0)); - wallets = await getSandboxAccountsWallets(pxe); + + // Get pre-deployed account wallets if we're running against sandbox. + if (PXE_URL) { + wallets = await getSandboxAccountsWallets(pxe); + } else { + // Deploy initial wallets if we're NOT running against sandbox. + wallets = await Promise.all((await deployInitialSandboxAccounts(pxe)).map(a => a.account.getWallet())); + } [firstPlayerWallet, secondPlayerWallet, thirdPlayerWallet] = wallets; [firstPlayer, secondPlayer, thirdPlayer] = wallets.map(a => a.getAddress()); await deployContract(); diff --git a/yarn-project/end-to-end/src/e2e_cli.test.ts b/yarn-project/end-to-end/src/e2e_cli.test.ts index 681fc0b2adb..bb3d0a11d71 100644 --- a/yarn-project/end-to-end/src/e2e_cli.test.ts +++ b/yarn-project/end-to-end/src/e2e_cli.test.ts @@ -1,23 +1,38 @@ +import { startHttpRpcServer } from '@aztec/aztec-sandbox'; import { PXE, createDebugLogger } from '@aztec/aztec.js'; +import { createPXERpcServer } from '@aztec/pxe'; import { setup as e2eSetup } from './fixtures/utils.js'; import { cliTestSuite } from './shared/cli.js'; -const { PXE_URL } = process.env; +const HTTP_PORT = 9009; +let RPC_URL = `http://localhost:${HTTP_PORT}`; const debug = createDebugLogger('aztec:e2e_cli'); +let http: ReturnType; let pxe: PXE; let teardown: () => Promise; +// Use Sandbox PXE URL if we're running against sandbox +const { PXE_URL } = process.env; +if (PXE_URL) { + RPC_URL = PXE_URL; +} + const testSetup = async () => { const context = await e2eSetup(2); debug(`Environment set up`); ({ pxe, teardown } = context); + if (!PXE_URL) { + http = startHttpRpcServer(pxe, createPXERpcServer, HTTP_PORT); + debug(`HTTP RPC server started in port ${HTTP_PORT}`); + } return pxe; }; const testCleanup = async () => { + http?.close(); await teardown(); }; -cliTestSuite('E2E CLI Test', testSetup, testCleanup, createDebugLogger('aztec:e2e_cli'), PXE_URL); +cliTestSuite('E2E CLI Test', testSetup, testCleanup, createDebugLogger('aztec:e2e_cli'), RPC_URL); diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index 9e8f9d1b139..85cca3baeb0 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -10,10 +10,12 @@ import { import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; import { DebugLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts/types'; -import { AztecNode, PXE, TxStatus } from '@aztec/types'; +import { AztecNode, CompleteAddress, PXE, TxStatus } from '@aztec/types'; import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './fixtures/utils.js'; +const { PXE_URL } = process.env; + describe('e2e_multiple_accounts_1_enc_key', () => { let aztecNode: AztecNode | undefined; let pxe: PXE; @@ -45,12 +47,18 @@ describe('e2e_multiple_accounts_1_enc_key', () => { // Verify that all accounts use the same encryption key const encryptionPublicKey = await generatePublicKey(encryptionPrivateKey); + // Disregard sandbox accounts - const sandBoxWallets = await getSandboxAccountsWallets(pxe); - const allAccounts = await pxe.getRegisteredAccounts(); - const keyAccounts = allAccounts.filter( - acc => !sandBoxWallets.map(wlt => wlt.getAddress().toString()).includes(acc.address.toString()), - ); + let keyAccounts: CompleteAddress[]; + if (PXE_URL) { + const sandBoxWallets = await getSandboxAccountsWallets(pxe); + const allAccounts = await pxe.getRegisteredAccounts(); + keyAccounts = allAccounts.filter( + acc => !sandBoxWallets.map(wlt => wlt.getAddress().toString()).includes(acc.address.toString()), + ); + } else { + keyAccounts = await pxe.getRegisteredAccounts(); + } for (const account of keyAccounts) { expect(account.publicKey).toEqual(encryptionPublicKey); }