diff --git a/.github/workflows/spartan-test.yml b/.github/workflows/nightly-kind-test.yml similarity index 99% rename from .github/workflows/spartan-test.yml rename to .github/workflows/nightly-kind-test.yml index 901dbebdb5a7..10174a03d32b 100644 --- a/.github/workflows/spartan-test.yml +++ b/.github/workflows/nightly-kind-test.yml @@ -1,4 +1,4 @@ -name: Run spartan network tests +name: KIND network tests on: workflow_dispatch: schedule: diff --git a/yarn-project/aztec.js/src/rpc_clients/node/index.ts b/yarn-project/aztec.js/src/rpc_clients/node/index.ts index c7a23bc9ee9c..9029ac673830 100644 --- a/yarn-project/aztec.js/src/rpc_clients/node/index.ts +++ b/yarn-project/aztec.js/src/rpc_clients/node/index.ts @@ -1,6 +1,6 @@ import { type PXE } from '@aztec/circuit-types'; import { type DebugLogger } from '@aztec/foundation/log'; -import { NoRetryError } from '@aztec/foundation/retry'; +import { NoRetryError, makeBackoff, retry } from '@aztec/foundation/retry'; import axios, { type AxiosError, type AxiosResponse } from 'axios'; @@ -12,10 +12,9 @@ import { createPXEClient } from '../pxe_client.js'; * @param rpcMethod - The RPC method to call. * @param body - The body of the request. * @param useApiEndpoints - Whether to use the API endpoints or inject the method in the body. - * @param _noRetry - Whether to retry on non-server errors. * @returns The response data. */ -async function axiosFetch(host: string, rpcMethod: string, body: any, useApiEndpoints: boolean, _noRetry = true) { +async function axiosFetch(host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) { let resp: AxiosResponse; if (useApiEndpoints) { resp = await axios @@ -62,8 +61,18 @@ async function axiosFetch(host: string, rpcMethod: string, body: any, useApiEndp * @param _logger - Debug logger to warn version incompatibilities. * @returns A PXE client. */ -export function createCompatibleClient(rpcUrl: string, _logger: DebugLogger): Promise { +export function createCompatibleClient(rpcUrl: string, logger: DebugLogger): Promise { // Use axios due to timeout issues with fetch when proving TXs. - const pxe = createPXEClient(rpcUrl, axiosFetch); + const fetch = async (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) => { + return await retry( + () => axiosFetch(host, rpcMethod, body, useApiEndpoints), + `JsonRpcClient request ${rpcMethod} to ${host}`, + makeBackoff([1, 2, 3]), + logger, + false, + ); + }; + const pxe = createPXEClient(rpcUrl, fetch); + return Promise.resolve(pxe); } diff --git a/yarn-project/aztec/src/sandbox.ts b/yarn-project/aztec/src/sandbox.ts index 30c38f5b3a7a..0a9f6158c720 100644 --- a/yarn-project/aztec/src/sandbox.ts +++ b/yarn-project/aztec/src/sandbox.ts @@ -162,7 +162,9 @@ export async function createSandbox(config: Partial = {}) { let watcher: AnvilTestWatcher | undefined = undefined; if (!aztecNodeConfig.p2pEnabled) { - const l1ContractAddresses = await deployContractsToL1(aztecNodeConfig, hdAccount); + const l1ContractAddresses = await deployContractsToL1(aztecNodeConfig, hdAccount, undefined, { + assumeProvenThroughBlockNumber: Number.MAX_SAFE_INTEGER, + }); const chain = aztecNodeConfig.l1RpcUrl ? createEthereumChain(aztecNodeConfig.l1RpcUrl, aztecNodeConfig.l1ChainId) diff --git a/yarn-project/end-to-end/scripts/network_test.sh b/yarn-project/end-to-end/scripts/network_test.sh index 77f92f0b14e3..b878ccbeecaf 100755 --- a/yarn-project/end-to-end/scripts/network_test.sh +++ b/yarn-project/end-to-end/scripts/network_test.sh @@ -11,6 +11,8 @@ set -eu +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + # Main positional parameter TEST="$1" @@ -28,7 +30,7 @@ fi if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then - echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-test-images' or otherwise tagged with aztecprotocol/aztec:$AZTEC_DOCKER_TAG and aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." + echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-e2e-test-images' or otherwise tagged with aztecprotocol/aztec:$AZTEC_DOCKER_TAG and aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." exit 1 fi @@ -42,7 +44,7 @@ if [ "$FRESH_INSTALL" = "true" ]; then fi # Install the Helm chart -helm install spartan spartan/aztec-network/ \ +helm install spartan "$(git rev-parse --show-toplevel)/spartan/aztec-network/" \ --namespace "$NAMESPACE" \ --create-namespace \ --values "$(git rev-parse --show-toplevel)/spartan/aztec-network/values/$VALUES_FILE" \ diff --git a/yarn-project/end-to-end/src/spartan/transfer.test.ts b/yarn-project/end-to-end/src/spartan/transfer.test.ts index 704b333d5eb3..d32c6d157fa8 100644 --- a/yarn-project/end-to-end/src/spartan/transfer.test.ts +++ b/yarn-project/end-to-end/src/spartan/transfer.test.ts @@ -2,11 +2,8 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountWalletWithSecretKey, type AztecAddress, - ExtendedNote, Fr, - Note, type PXE, - computeSecretHash, createCompatibleClient, } from '@aztec/aztec.js'; import { createDebugLogger } from '@aztec/foundation/log'; @@ -66,7 +63,7 @@ describe('token transfer test', () => { logger.verbose(`Recipient Wallet address: ${recipientWallet.getAddress()} registered`); } - const { accountKeys } = await addAccounts(WALLET_COUNT, logger, true)({ pxe }); + const { accountKeys } = await addAccounts(WALLET_COUNT, logger, false)({ pxe }); const accountManagers = accountKeys.map(ak => getSchnorrAccount(pxe, ak[0], ak[1], 1)); wallets = await Promise.all( @@ -99,43 +96,6 @@ describe('token transfer test', () => { wallets.map(w => tokenAdminWallet.methods.mint_public(w.getAddress(), MINT_AMOUNT).send().wait({ timeout: 600 })), ); - logger.verbose(`Minting ${MINT_AMOUNT} private assets to the ${wallets.length} wallets...`); - - const mintSecrets = Array.from({ length: WALLET_COUNT }) - .map(() => Fr.random()) - .map(secret => ({ - secret, - hash: computeSecretHash(secret), - })); - - const txs = await Promise.all( - mintSecrets.map(({ hash }) => - tokenAdminWallet.methods.mint_private(MINT_AMOUNT, hash).send().wait({ timeout: 600 }), - ), - ); - - logger.verbose(`Redeeming private assets...`); - - await Promise.all( - mintSecrets.map(async ({ secret, hash }, i) => { - const wallet = wallets[i]; - const walletAddress = wallet.getAddress(); - const note = new Note([new Fr(MINT_AMOUNT), hash]); - const extendedNote = new ExtendedNote( - note, - walletAddress, - tokenAddress, - TokenContract.storage.pending_shields.slot, - TokenContract.notes.TransparentNote.id, - txs[i].txHash, - ); - - await pxe.addNote(extendedNote, walletAddress); - const token = await TokenContract.at(tokenAddress, wallet); - await token.methods.redeem_shield(walletAddress, MINT_AMOUNT, secret).send().wait({ timeout: 600 }); - }), - ); - logger.verbose(`Minting complete.`); }); @@ -149,23 +109,14 @@ describe('token transfer test', () => { const transferAmount = 1n; wallets.forEach(async w => { - expect(MINT_AMOUNT).toBe( - await (await TokenContract.at(tokenAddress, w)).methods.balance_of_private(w.getAddress()).simulate(), - ); expect(MINT_AMOUNT).toBe(await tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate()); }); - expect(0n).toBe( - await (await TokenContract.at(tokenAddress, recipientWallet)).methods.balance_of_private(recipient).simulate(), - ); expect(0n).toBe(await tokenAdminWallet.methods.balance_of_public(recipient).simulate()); // For each round, make both private and public transfers for (let i = 1n; i <= ROUNDS; i++) { const txs = await Promise.all([ - ...wallets.map(async w => - (await TokenContract.at(tokenAddress, w)).methods.transfer(recipient, transferAmount), - ), ...wallets.map(async w => ( await TokenContract.at(tokenAddress, w) @@ -179,17 +130,11 @@ describe('token transfer test', () => { } wallets.forEach(async w => { - expect(MINT_AMOUNT - ROUNDS * transferAmount).toBe( - await (await TokenContract.at(tokenAddress, w)).methods.balance_of_private(w.getAddress()).simulate(), - ); expect(MINT_AMOUNT - ROUNDS * transferAmount).toBe( await tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate(), ); }); - expect(ROUNDS * transferAmount * BigInt(wallets.length)).toBe( - await (await TokenContract.at(tokenAddress, recipientWallet)).methods.balance_of_private(recipient).simulate(), - ); expect(ROUNDS * transferAmount * BigInt(wallets.length)).toBe( await tokenAdminWallet.methods.balance_of_public(recipient).simulate(), );