From dc05b2206604e78cc803c14b36ad4f209e8eb1ee Mon Sep 17 00:00:00 2001 From: just-mitch Date: Wed, 9 Oct 2024 19:13:09 +0000 Subject: [PATCH 01/13] fix: call correct method on fee juice contract also better logging when invalid proof quotes --- yarn-project/cli/src/cmds/misc/setup_contracts.ts | 2 +- yarn-project/end-to-end/scripts/network_test.sh | 1 - yarn-project/end-to-end/src/fixtures/utils.ts | 2 +- yarn-project/sequencer-client/src/publisher/l1-publisher.ts | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn-project/cli/src/cmds/misc/setup_contracts.ts b/yarn-project/cli/src/cmds/misc/setup_contracts.ts index e1317fe29d4..fcab491d7d6 100644 --- a/yarn-project/cli/src/cmds/misc/setup_contracts.ts +++ b/yarn-project/cli/src/cmds/misc/setup_contracts.ts @@ -19,7 +19,7 @@ export async function setupCanonicalL2FeeJuice( const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer); log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...'); await feeJuiceContract.methods - .initialize(feeJuicePortalAddress) + .set_portal(feeJuicePortalAddress) .send({ fee: { paymentMethod: new NoFeePaymentMethod(), gasSettings: GasSettings.teardownless() } }) .wait(waitOpts); } diff --git a/yarn-project/end-to-end/scripts/network_test.sh b/yarn-project/end-to-end/scripts/network_test.sh index 490dfa91d78..72cfef176ef 100755 --- a/yarn-project/end-to-end/scripts/network_test.sh +++ b/yarn-project/end-to-end/scripts/network_test.sh @@ -35,7 +35,6 @@ if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotoco fi # Load the Docker images into kind -kind load docker-image aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG kind load docker-image aztecprotocol/aztec:$AZTEC_DOCKER_TAG # If FRESH_INSTALL is true, delete the namespace diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 8093f9f8d0c..153f07742fc 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -695,7 +695,7 @@ export async function setupCanonicalFeeJuice(pxe: PXE) { try { await feeJuice.methods - .initialize(feeJuicePortalAddress) + .set_portal(feeJuicePortalAddress) .send({ fee: { paymentMethod: new NoFeePaymentMethod(), gasSettings: GasSettings.teardownless() } }) .wait(); getLogger().info(`Fee Juice successfully setup. Portal address: ${feeJuicePortalAddress}`); diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts index a0a40a3bc0f..3f76c7aa51b 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts @@ -263,8 +263,9 @@ export class L1Publisher { try { await this.rollupContract.read.validateEpochProofRightClaim(args, { account: this.account }); } catch (err) { + this.log.verbose(JSON.stringify(err)); const errorName = tryGetCustomErrorName(err); - this.log.verbose(`Proof quote validation failed: ${errorName}`); + this.log.warn(`Proof quote validation failed: ${errorName}`); return undefined; } return quote; From f12176371ad8e8a01cda72b333b04bbfb8c5b1e2 Mon Sep 17 00:00:00 2001 From: just-mitch Date: Wed, 9 Oct 2024 19:26:33 +0000 Subject: [PATCH 02/13] skip proof wait --- spartan/aztec-network/templates/l2-contracts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spartan/aztec-network/templates/l2-contracts.yaml b/spartan/aztec-network/templates/l2-contracts.yaml index 9b556a0ff76..9d3275f9309 100644 --- a/spartan/aztec-network/templates/l2-contracts.yaml +++ b/spartan/aztec-network/templates/l2-contracts.yaml @@ -27,7 +27,7 @@ spec: done echo "PXE service is ready!" set -e - node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts + node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait echo "L2 contracts initialized" env: - name: PXE_URL From e4a449461f0e2579fecdb65efba89f3f6b6b7b26 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 19:37:16 +0000 Subject: [PATCH 03/13] iterate on local tests --- .github/workflows/ci.yml | 6 +-- .github/workflows/network-deploy.yml | 2 +- .github/workflows/nightly-kind-test.yml | 2 +- scripts/run_interleaved.sh | 38 +++++++++++++++---- yarn-project/Earthfile | 16 ++++++++ yarn-project/end-to-end/Earthfile | 4 +- .../native-network/deploy-l2-contracts.sh | 2 +- .../scripts/native-network/prover-node.sh | 2 +- .../end-to-end/scripts/native_network_test.sh | 12 ++---- .../end-to-end/src/spartan/transfer.test.ts | 2 +- 10 files changed, 58 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb816c42c2b..a1d2aa556e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,8 +118,7 @@ jobs: build: needs: [build-images, changes] - # NOTE: we don't skip this job here instead using if's below so that dependencies are not broken - # we still want build to be at the bottom of the dependency chain + if: (needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 outputs: e2e_list: ${{ steps.e2e_list.outputs.list }} @@ -133,7 +132,6 @@ jobs: # prepare images locally, tagged by commit hash - name: "Build E2E Image" timeout-minutes: 40 - if: (needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' run: | earthly-ci ./yarn-project+export-e2e-test-images # We base our e2e list used in e2e-x86 off the targets in ./yarn-project/end-to-end @@ -414,7 +412,7 @@ jobs: run: earthly-ci --no-output ./+barretenberg-acir-tests-bb.js noir-format: - needs: [build, changes] + needs: [build-images, changes] runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 if: needs.changes.outputs.noir == 'true' || needs.changes.outputs.noir-projects == 'true' steps: diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 8acd9378d61..2aa862f4499 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -54,4 +54,4 @@ jobs: - name: Deploy Helm chart run: | helm dependency update ${{ env.CHART_PATH }} - helm upgrade --install ${{ env.NAMESPACE }} ${{ env.CHART_PATH }} --namespace ${{ env.NAMESPACE }} --set network.public=true --atomic + helm upgrade --install ${{ env.NAMESPACE }} ${{ env.CHART_PATH }} --namespace ${{ env.NAMESPACE }} --set network.public=true --atomic --create-namespace --timeout 20m diff --git a/.github/workflows/nightly-kind-test.yml b/.github/workflows/nightly-kind-test.yml index 8c2a1a4daad..255835daa76 100644 --- a/.github/workflows/nightly-kind-test.yml +++ b/.github/workflows/nightly-kind-test.yml @@ -75,7 +75,7 @@ jobs: ./spartan/scripts/setup_local_k8s.sh export FORCE_COLOR=1 export EARTHLY_BUILD_ARGS="${{ env.EARTHLY_BUILD_ARGS }}" - ./scripts/earthly-ci --exec-stats -P --no-output ./yarn-project/end-to-end/+network-transfer --values-file=${{ matrix.values_file }} + ./scripts/earthly-ci --exec-stats -P --no-output ./yarn-project/end-to-end/+kind-network-transfer --values-file=${{ matrix.values_file }} success-check: runs-on: ubuntu-20.04 diff --git a/scripts/run_interleaved.sh b/scripts/run_interleaved.sh index 1df4e16fc3d..24b61a0617c 100755 --- a/scripts/run_interleaved.sh +++ b/scripts/run_interleaved.sh @@ -2,35 +2,57 @@ set -eu # Usage: run_bg_args.sh
... -# Runs the main command with output logging and background commands without logging. +# Runs the main command with output logging and background commands with logging. # Finishes when the main command exits. -# Check if at least two commands are provided (otherwise what is the point) +# Check if at least two commands are provided if [ "$#" -lt 2 ]; then echo "Usage: $0 ..." exit 1 fi +# Define colors +colors=( + "\e[31m" # Red + "\e[32m" # Green + "\e[33m" # Yellow + "\e[34m" # Blue + "\e[35m" # Magenta + "\e[36m" # Cyan + "\e[37m" # White + "\e[91m" # Bright Red + "\e[92m" # Bright Green + "\e[93m" # Bright Yellow + "\e[94m" # Bright Blue + "\e[95m" # Bright Magenta + "\e[96m" # Bright Cyan +) + main_cmd="$1" shift -# Function to run a command and prefix the output +# Function to run a command and prefix the output with color function run_command() { local cmd="$1" + local color="$2" while IFS= read -r line; do - echo "[$cmd] $line" + echo -e "${color}[$cmd] $line\e[0m" done < <($cmd 2>&1) } -# Run the main command, piping output through the run_command function -run_command "$main_cmd" & +i=0 + +# Run the main command with its assigned color +run_command "$main_cmd" "${colors[$((i % ${#colors[@]}))]}" & main_pid=$! +((i++)) -# Run background commands without logging output +# Run background commands with their assigned colors declare -a bg_pids for cmd in "$@"; do - run_command "$cmd" & + run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & bg_pids+=($!) + ((i++)) done # Wait for the main command to finish and capture its exit code diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index 3accd2fee52..d7525c643ad 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -279,6 +279,22 @@ prover-client-test: ARG debug="" RUN cd prover-client && DEBUG=$debug yarn test $test +# NOTE: This is not in the end-to-end Earthfile as that is entirely LOCALLY commands that will go away sometime. +# Running this inside the main builder as the point is not to run this through dockerization. +network-test-fake-proofs: + FROM +build + # All script arguments are in the end-to-end/scripts/native-network folder + RUN INTERLEAVED=true end-to-end/scripts/native_network_test.sh \ + ./test-transfer.sh \ + ./deploy-l1-contracts.sh \ + ./deploy-l2-contracts.sh \ + ./boot-node.sh \ + ./ethereum.sh \ + "./prover-node.sh false" \ + ./pxe.sh \ + ./transaction-bot.sh \ + "./validator.sh 8081" + publish-npm: FROM +build ARG DIST_TAG="latest" diff --git a/yarn-project/end-to-end/Earthfile b/yarn-project/end-to-end/Earthfile index a8346f103d8..1844c503cb1 100644 --- a/yarn-project/end-to-end/Earthfile +++ b/yarn-project/end-to-end/Earthfile @@ -297,7 +297,7 @@ network-smoke: LOCALLY RUN NAMESPACE=smoke FRESH_INSTALL=true VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/smoke.test.ts -network-transfer: +kind-network-transfer: ARG values_file LOCALLY - RUN NAMESPACE=transfer FRESH_INSTALL=true VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/transfer.test.ts + RUN NAMESPACE=transfer FRESH_INSTALL=true VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/transfer.test.ts \ No newline at end of file diff --git a/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh b/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh index 69e3d6c3a1f..194737315dc 100755 --- a/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh +++ b/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh @@ -25,7 +25,7 @@ ARGS="--skipProofWait" # Deploy L2 contracts export AZTEC_NODE_URL="http://127.0.0.1:8080" export PXE_URL="http://127.0.0.1:8079" -node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-protocol-contracts $ARGS +node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts $ARGS echo "Deployed L2 contracts" # Use file just as done signal echo "" > l2-contracts.env diff --git a/yarn-project/end-to-end/scripts/native-network/prover-node.sh b/yarn-project/end-to-end/scripts/native-network/prover-node.sh index bb326896456..a7e6218e9c7 100755 --- a/yarn-project/end-to-end/scripts/native-network/prover-node.sh +++ b/yarn-project/end-to-end/scripts/native-network/prover-node.sh @@ -1,6 +1,7 @@ #!/bin/bash set -eu +export PROVER_REAL_PROOFS="$1" # Get the name of the script without the path and extension SCRIPT_NAME=$(basename "$0" .sh) @@ -28,7 +29,6 @@ export BOOTSTRAP_NODES=$(echo "$output" | grep -oP 'Node ENR: \K.*') export LOG_LEVEL="debug" export DEBUG="aztec:*" export ETHEREUM_HOST="http://127.0.0.1:8545" -export PROVER_REAL_PROOFS="false" export PROVER_AGENT_ENABLED="true" export PROVER_PUBLISHER_PRIVATE_KEY="0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" export PROVER_COORDINATION_NODE_URL="http://127.0.0.1:8080" diff --git a/yarn-project/end-to-end/scripts/native_network_test.sh b/yarn-project/end-to-end/scripts/native_network_test.sh index f37e3e5cfc2..fd2e854b0bf 100755 --- a/yarn-project/end-to-end/scripts/native_network_test.sh +++ b/yarn-project/end-to-end/scripts/native_network_test.sh @@ -8,6 +8,8 @@ # The will run in parallel either in tmux or just interleaved # They will log to native-network/logs, where it is easier to debug errors further up the logs, while watching tmux helps catch issues live, # or where things crash and need to be tweaked and restarted. +# Arguments: +# Expects a list of scripts from the native-network folder. # Optional environment variables: # INTERLEAVED (default: "false") should we just start all programs in the background? @@ -45,12 +47,4 @@ function run_parallel() { # We exit with the return code of the first command # While the others are ran in the background, either in tmux or just interleaved -run_parallel ./test-transfer.sh \ - ./deploy-l1-contracts.sh \ - ./deploy-l2-contracts.sh \ - ./boot-node.sh \ - ./ethereum.sh \ - ./prover-node.sh \ - ./pxe.sh \ - ./transaction-bot.sh - # "./validator.sh 8081" +run_parallel "$@" \ No newline at end of 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 0e1bda7c720..4c675c7541d 100644 --- a/yarn-project/end-to-end/src/spartan/transfer.test.ts +++ b/yarn-project/end-to-end/src/spartan/transfer.test.ts @@ -39,7 +39,7 @@ describe('token transfer test', () => { const TOKEN_DECIMALS = 18n; const MINT_AMOUNT = 20n; - const WALLET_COUNT = 16; + const WALLET_COUNT = 1; // TODO fix this to allow for 16 wallets again const ROUNDS = 5n; let pxe: PXE; From a95d8af72f528b762b000557332e4633fea1455b Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 19:44:22 +0000 Subject: [PATCH 04/13] get native network tests into CI --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1d2aa556e7..3d7167fdcf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,8 @@ jobs: build: needs: [build-images, changes] - if: (needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' + # NOTE: we don't skip this job here instead using if's below so that dependencies are not broken + # we still want build to be at the bottom of the dependency chain runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 outputs: e2e_list: ${{ steps.e2e_list.outputs.list }} @@ -132,6 +133,7 @@ jobs: # prepare images locally, tagged by commit hash - name: "Build E2E Image" timeout-minutes: 40 + if: (needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' run: | earthly-ci ./yarn-project+export-e2e-test-images # We base our e2e list used in e2e-x86 off the targets in ./yarn-project/end-to-end @@ -412,7 +414,7 @@ jobs: run: earthly-ci --no-output ./+barretenberg-acir-tests-bb.js noir-format: - needs: [build-images, changes] + needs: [build, changes] runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 if: needs.changes.outputs.noir == 'true' || needs.changes.outputs.noir-projects == 'true' steps: @@ -540,6 +542,19 @@ jobs: timeout-minutes: 40 run: earthly-ci --no-output ./yarn-project/+prover-client-test + network-test-fake-proofs: + needs: build + runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 + steps: + - uses: actions/checkout@v4 + with: { ref: "${{ env.GIT_COMMIT }}" } + - uses: ./.github/ci-setup-action + with: + concurrency_key: network-test-fake-proofs-x86 + - name: "Prover Client Tests" + timeout-minutes: 40 + run: earthly-ci --no-output ./yarn-project/+network-test-fake-proofs + l1-contracts-test: needs: [build, changes] runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 @@ -764,6 +779,7 @@ jobs: - yarn-project-formatting - yarn-project-test - prover-client-test + - network-test-fake-proofs - l1-contracts-test - docs-preview # - bb-bench # non-blocking @@ -819,6 +835,7 @@ jobs: - yarn-project-formatting - yarn-project-test - prover-client-test + - network-test-fake-proofs - l1-contracts-test - docs-preview # - bb-bench # non-blocking From 91ddc432393d7e9520c302328fab23f086ffa1b6 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 19:53:39 +0000 Subject: [PATCH 05/13] fix --- yarn-project/end-to-end/scripts/native_network_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/end-to-end/scripts/native_network_test.sh b/yarn-project/end-to-end/scripts/native_network_test.sh index fd2e854b0bf..cc5b15cbe4c 100755 --- a/yarn-project/end-to-end/scripts/native_network_test.sh +++ b/yarn-project/end-to-end/scripts/native_network_test.sh @@ -17,7 +17,6 @@ set -eu # Ensure dependencies are installed command -v anvil >/dev/null || (echo "We need 'anvil' installed to be able to simulate ethereum" && exit 1) -command -v tmux >/dev/null || (echo "We need 'tmux' installed to be able to manage terminal sessions" && exit 1) REPO=$(git rev-parse --show-toplevel) @@ -37,6 +36,7 @@ rm -f l1-contracts.env l2-contracts.env logs/*.log function run_parallel() { if [ "${INTERLEAVED:-false}" = "false" ] ; then + command -v tmux >/dev/null || (echo "We need 'tmux' installed to be able to manage terminal sessions" && exit 1) # Run in tmux for local debugging "$REPO"/scripts/tmux_split_args.sh native_network_test_session "$@" else From 9a93934424a08fa802549dcc166415752d333c45 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 20:04:07 +0000 Subject: [PATCH 06/13] fix --- yarn-project/Earthfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index d7525c643ad..b37d6a952b1 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -283,6 +283,8 @@ prover-client-test: # Running this inside the main builder as the point is not to run this through dockerization. network-test-fake-proofs: FROM +build + # Bare minimum git setup to run 'git rev-parse --show-toplevel' + RUN (cd .. && git init) # All script arguments are in the end-to-end/scripts/native-network folder RUN INTERLEAVED=true end-to-end/scripts/native_network_test.sh \ ./test-transfer.sh \ From e4e002ef1795f07c6299b6e8c492fc57c7e17266 Mon Sep 17 00:00:00 2001 From: just-mitch Date: Wed, 9 Oct 2024 20:20:12 +0000 Subject: [PATCH 07/13] partial revert --- yarn-project/cli/src/cmds/misc/setup_contracts.ts | 2 +- yarn-project/end-to-end/src/fixtures/utils.ts | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/yarn-project/cli/src/cmds/misc/setup_contracts.ts b/yarn-project/cli/src/cmds/misc/setup_contracts.ts index fcab491d7d6..e1317fe29d4 100644 --- a/yarn-project/cli/src/cmds/misc/setup_contracts.ts +++ b/yarn-project/cli/src/cmds/misc/setup_contracts.ts @@ -19,7 +19,7 @@ export async function setupCanonicalL2FeeJuice( const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer); log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...'); await feeJuiceContract.methods - .set_portal(feeJuicePortalAddress) + .initialize(feeJuicePortalAddress) .send({ fee: { paymentMethod: new NoFeePaymentMethod(), gasSettings: GasSettings.teardownless() } }) .wait(waitOpts); } diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 153f07742fc..60e0de4a58e 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -207,7 +207,6 @@ async function setupWithRemoteEnvironment( config: AztecNodeConfig, logger: DebugLogger, numberOfAccounts: number, - enableGas: boolean, ) { // we are setting up against a remote environment, l1 contracts are already deployed const aztecNodeUrl = getAztecUrl(); @@ -238,11 +237,9 @@ async function setupWithRemoteEnvironment( const teardown = () => Promise.resolve(); const { l1ChainId: chainId, protocolVersion } = await pxeClient.getNodeInfo(); - if (enableGas) { - await setupCanonicalFeeJuice( - new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(chainId, protocolVersion)), - ); - } + await setupCanonicalFeeJuice( + new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(chainId, protocolVersion)), + ); logger.verbose('Constructing available wallets from already registered accounts...'); const wallets = await getDeployedTestAccountsWallets(pxeClient); @@ -389,7 +386,7 @@ export async function setup( if (PXE_URL) { // we are setting up against a remote environment, l1 contracts are assumed to already be deployed - return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts, enableGas); + return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts); } const deployL1ContractsValues = @@ -441,7 +438,7 @@ export async function setup( const { pxe } = await setupPXEService(aztecNode!, pxeOpts, logger); - if (!config.skipProtocolContracts && enableGas) { + if (!config.skipProtocolContracts) { logger.verbose('Setting up Fee Juice...'); await setupCanonicalFeeJuice( new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(config.l1ChainId, config.version)), @@ -695,7 +692,7 @@ export async function setupCanonicalFeeJuice(pxe: PXE) { try { await feeJuice.methods - .set_portal(feeJuicePortalAddress) + .initialize(feeJuicePortalAddress) .send({ fee: { paymentMethod: new NoFeePaymentMethod(), gasSettings: GasSettings.teardownless() } }) .wait(); getLogger().info(`Fee Juice successfully setup. Portal address: ${feeJuicePortalAddress}`); From 8ef558fc61cf6b0ee1eae8bf0b0b78a6209080e0 Mon Sep 17 00:00:00 2001 From: just-mitch Date: Wed, 9 Oct 2024 21:01:53 +0000 Subject: [PATCH 08/13] satisfy linter --- .../end-to-end/src/benchmarks/bench_prover.test.ts | 1 - .../end-to-end/src/benchmarks/bench_tx_size_fees.test.ts | 2 +- yarn-project/end-to-end/src/fixtures/utils.ts | 1 - .../public-testnet/e2e_public_testnet_transfer.test.ts | 8 +------- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts index 6093e33a5d2..fb9ca25c781 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts @@ -60,7 +60,6 @@ describe('benchmarks/proving', () => { minTxsPerBlock: 1, }, {}, - true, ); schnorrWalletSalt = Fr.random(); diff --git a/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts index c0ca0e2e23b..fb2f9e53fca 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts @@ -30,7 +30,7 @@ describe('benchmarks/tx_size_fees', () => { // setup the environment beforeAll(async () => { - ctx = await setup(3, {}, {}, true); + ctx = await setup(3, {}, {}); aliceWallet = ctx.wallets[0]; bobAddress = ctx.wallets[1].getAddress(); diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 60e0de4a58e..618f70dfbed 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -327,7 +327,6 @@ export async function setup( numberOfAccounts = 1, opts: SetupOptions = {}, pxeOpts: Partial = {}, - enableGas = false, chain: Chain = foundry, ): Promise { const config = { ...getConfigEnvVars(), ...opts }; diff --git a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts index 22cb491facf..31fcb352394 100644 --- a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts +++ b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts @@ -22,13 +22,7 @@ describe(`deploys and transfers a private only token`, () => { beforeEach(async () => { const chainId = !process.env.L1_CHAIN_ID ? foundry.id : +process.env.L1_CHAIN_ID; const chain = chainId == sepolia.id ? sepolia : foundry; // Not the best way of doing this. - ({ logger, pxe, teardown } = await setup( - 0, - { skipProtocolContracts: true, stateLoad: undefined }, - {}, - false, - chain, - )); + ({ logger, pxe, teardown } = await setup(0, { skipProtocolContracts: true, stateLoad: undefined }, {}, chain)); }, 600_000); afterEach(async () => { From dd7fa6d85f3fd0beb2ddf83e46cb2831f54ecda5 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 21:07:22 +0000 Subject: [PATCH 09/13] fix scripts --- scripts/run_interleaved.sh | 23 ++++++++----------- yarn-project/Earthfile | 5 +++- .../native-network/deploy-l1-contracts.sh | 5 +++- .../native-network/deploy-l2-contracts.sh | 5 +++- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/scripts/run_interleaved.sh b/scripts/run_interleaved.sh index 24b61a0617c..b95bb8b6756 100755 --- a/scripts/run_interleaved.sh +++ b/scripts/run_interleaved.sh @@ -2,10 +2,10 @@ set -eu # Usage: run_bg_args.sh
... -# Runs the main command with output logging and background commands with logging. +# Runs the main command with output logging and background commands without logging. # Finishes when the main command exits. -# Check if at least two commands are provided +# Check if at least two commands are provided (otherwise what is the point) if [ "$#" -lt 2 ]; then echo "Usage: $0 ..." exit 1 @@ -13,19 +13,16 @@ fi # Define colors colors=( - "\e[31m" # Red - "\e[32m" # Green "\e[33m" # Yellow "\e[34m" # Blue "\e[35m" # Magenta "\e[36m" # Cyan - "\e[37m" # White - "\e[91m" # Bright Red "\e[92m" # Bright Green "\e[93m" # Bright Yellow "\e[94m" # Bright Blue "\e[95m" # Bright Magenta "\e[96m" # Bright Cyan + "\e[91m" # Bright Red ) main_cmd="$1" @@ -36,23 +33,21 @@ function run_command() { local cmd="$1" local color="$2" while IFS= read -r line; do - echo -e "${color}[$cmd] $line\e[0m" + echo -e "${color}[$cmd]\e[0m $line" done < <($cmd 2>&1) } -i=0 - -# Run the main command with its assigned color -run_command "$main_cmd" "${colors[$((i % ${#colors[@]}))]}" & +# Run the main command, piping output through the run_command function with green color +run_command "$main_cmd" "\e[32m" & main_pid=$! -((i++)) -# Run background commands with their assigned colors +# Run background commands without logging output declare -a bg_pids +i=0 for cmd in "$@"; do run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & bg_pids+=($!) - ((i++)) + ((i++)) || true # annoyingly considered a failure based on result done # Wait for the main command to finish and capture its exit code diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index b37d6a952b1..c6ba4f0e5b2 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -283,8 +283,11 @@ prover-client-test: # Running this inside the main builder as the point is not to run this through dockerization. network-test-fake-proofs: FROM +build + WORKDIR /usr/src/ # Bare minimum git setup to run 'git rev-parse --show-toplevel' - RUN (cd .. && git init) + RUN git init -b master + COPY ../scripts/+scripts/run_interleaved.sh scripts/run_interleaved.sh + WORKDIR /usr/src/yarn-project # All script arguments are in the end-to-end/scripts/native-network folder RUN INTERLEAVED=true end-to-end/scripts/native_network_test.sh \ ./test-transfer.sh \ diff --git a/yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh b/yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh index 7ff2036f5f3..99d24e4f0ea 100755 --- a/yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh +++ b/yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh @@ -44,4 +44,7 @@ EOCONFIG echo "Contract addresses saved to l1-contracts.env" sleep 5 -tmux kill-pane -t $(tmux display -p '#{pane_id}') \ No newline at end of file +function close_tmux_pane() { + tmux kill-pane -t $(tmux display -p '#{pane_id}') +} +close_tmux_pane 2>/dev/null || true \ No newline at end of file diff --git a/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh b/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh index 194737315dc..e015b8a862b 100755 --- a/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh +++ b/yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh @@ -31,4 +31,7 @@ echo "Deployed L2 contracts" echo "" > l2-contracts.env echo "Wrote to l2-contracts.env to signal completion" sleep 5 -tmux kill-pane -t $(tmux display -p '#{pane_id}') \ No newline at end of file +function close_tmux_pane() { + tmux kill-pane -t $(tmux display -p '#{pane_id}') +} +close_tmux_pane 2>/dev/null || true \ No newline at end of file From cf4ace8e26eae67c63d56a85a22254894fcd02b8 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 21:29:00 +0000 Subject: [PATCH 10/13] tweaks --- scripts/run_interleaved.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/run_interleaved.sh b/scripts/run_interleaved.sh index b95bb8b6756..d2a073cc6c5 100755 --- a/scripts/run_interleaved.sh +++ b/scripts/run_interleaved.sh @@ -1,7 +1,9 @@ #!/bin/bash set -eu +# propagate errors inside while loop pipe +set -o pipefail -# Usage: run_bg_args.sh
... +# Usage: run_interleaved.sh
... # Runs the main command with output logging and background commands without logging. # Finishes when the main command exits. @@ -32,9 +34,9 @@ shift function run_command() { local cmd="$1" local color="$2" - while IFS= read -r line; do + $cmd 2>&1 | while IFS= read -r line; do echo -e "${color}[$cmd]\e[0m $line" - done < <($cmd 2>&1) + done } # Run the main command, piping output through the run_command function with green color @@ -43,6 +45,14 @@ main_pid=$! # Run background commands without logging output declare -a bg_pids +function cleanup() { +# Kill any remaining background jobs +for pid in "${bg_pids[@]}"; do + kill "$pid" 2>/dev/null || true +done +} +trap EXIT cleanup + i=0 for cmd in "$@"; do run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & @@ -54,10 +64,5 @@ done wait $main_pid main_exit_code=$? -# Kill any remaining background jobs -for pid in "${bg_pids[@]}"; do - kill "$pid" 2>/dev/null || true -done - # Exit with the same code as the main command exit $main_exit_code From 38e0bcc77a66db43d693c1800e27d30a2d6b8920 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 22:05:49 +0000 Subject: [PATCH 11/13] tweak --- scripts/run_interleaved.sh | 68 ++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/scripts/run_interleaved.sh b/scripts/run_interleaved.sh index d2a073cc6c5..854c80e4bd9 100755 --- a/scripts/run_interleaved.sh +++ b/scripts/run_interleaved.sh @@ -9,60 +9,50 @@ set -o pipefail # Check if at least two commands are provided (otherwise what is the point) if [ "$#" -lt 2 ]; then - echo "Usage: $0 ..." - exit 1 + echo "Usage: $0 ..." + exit 1 fi # Define colors colors=( - "\e[33m" # Yellow - "\e[34m" # Blue - "\e[35m" # Magenta - "\e[36m" # Cyan - "\e[92m" # Bright Green - "\e[93m" # Bright Yellow - "\e[94m" # Bright Blue - "\e[95m" # Bright Magenta - "\e[96m" # Bright Cyan - "\e[91m" # Bright Red + "\e[33m" # Yellow + "\e[34m" # Blue + "\e[35m" # Magenta + "\e[36m" # Cyan + "\e[92m" # Bright Green + "\e[93m" # Bright Yellow + "\e[94m" # Bright Blue + "\e[95m" # Bright Magenta + "\e[96m" # Bright Cyan + "\e[91m" # Bright Red ) main_cmd="$1" shift +# pattern from https://stackoverflow.com/questions/28238952/how-to-kill-a-running-bash-function-from-terminal +function cleanup_function() { + kill $(jobs -p) 2>/dev/null || true + return +} + # Function to run a command and prefix the output with color function run_command() { - local cmd="$1" - local color="$2" - $cmd 2>&1 | while IFS= read -r line; do - echo -e "${color}[$cmd]\e[0m $line" - done + # pattern from https://stackoverflow.com/questions/28238952/how-to-kill-a-running-bash-function-from-terminal + trap cleanup_function INT EXIT + local cmd="$1" + local color="$2" + $cmd 2>&1 | while IFS= read -r line; do + echo -e "${color}[$cmd]\e[0m $line" + done } -# Run the main command, piping output through the run_command function with green color -run_command "$main_cmd" "\e[32m" & -main_pid=$! - # Run background commands without logging output -declare -a bg_pids -function cleanup() { -# Kill any remaining background jobs -for pid in "${bg_pids[@]}"; do - kill "$pid" 2>/dev/null || true -done -} -trap EXIT cleanup - i=0 for cmd in "$@"; do - run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & - bg_pids+=($!) - ((i++)) || true # annoyingly considered a failure based on result + run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & + ((i++)) || true # annoyingly considered a failure based on result done -# Wait for the main command to finish and capture its exit code -wait $main_pid -main_exit_code=$? - -# Exit with the same code as the main command -exit $main_exit_code +# Run the main command synchronously, piping output through the run_command function with green color +run_command "$main_cmd" "\e[32m" \ No newline at end of file From 23bcf253c9ad8013c2e0b9a17dd19d5341214f2b Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 22:29:55 +0000 Subject: [PATCH 12/13] test transfer working --- yarn-project/Earthfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index c6ba4f0e5b2..6b6abd466ed 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -296,9 +296,7 @@ network-test-fake-proofs: ./boot-node.sh \ ./ethereum.sh \ "./prover-node.sh false" \ - ./pxe.sh \ - ./transaction-bot.sh \ - "./validator.sh 8081" + ./pxe.sh publish-npm: FROM +build From a5d083613662e725148b5eaafd4734f2aad47f6f Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 9 Oct 2024 22:49:30 +0000 Subject: [PATCH 13/13] missing file --- scripts/Earthfile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/Earthfile diff --git a/scripts/Earthfile b/scripts/Earthfile new file mode 100644 index 00000000000..2aa3bae9244 --- /dev/null +++ b/scripts/Earthfile @@ -0,0 +1,6 @@ +VERSION 0.8 + +scripts: + FROM scratch + COPY *.sh . + SAVE ARTIFACT *.sh \ No newline at end of file