Skip to content

Commit

Permalink
fix: Fixes for the nightly test run against Sepolia (#8229)
Browse files Browse the repository at this point in the history
This PR makes some fixes to the nightly Sepolia test run
  • Loading branch information
PhilWindle authored Aug 27, 2024
1 parent 19edbbb commit cfc65c6
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 58 deletions.
62 changes: 21 additions & 41 deletions .github/workflows/sepolia-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

# Uncomment the following to run against Sepolia
# SEQ_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }}
# PROVER_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }}
# ETHEREUM_HOST: 'https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}';
# L1_CHAIN_ID: '11155111' # Sepolia Chain ID
# Address 0x652575Ff941e7c2850fB89f2B207efF6B06BC7B4
SEQ_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }}

# Address 0xE3b8F9F23b8D4BD7d437218Bff3bcED1ce5E70B3
PROVER_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }}

ETHEREUM_HOST: "https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}"
L1_CHAIN_ID: "11155111"

jobs:
setup:
Expand All @@ -28,11 +31,9 @@ jobs:
runner_type: builder-x86
secrets: inherit

build:
build-and-test:
needs: setup
runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86
outputs:
e2e_list: ${{ steps.e2e_list.outputs.list }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -47,37 +48,16 @@ jobs:
run: |
earthly-ci ./yarn-project+export-e2e-test-images
- name: Create list of testnet end-to-end jobs
id: e2e_list
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep 'public-testnet' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT

e2e:
needs: build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
test: ${{ fromJson( needs.build.outputs.e2e_list )}}
steps:
- uses: actions/checkout@v4
with: { ref: "${{ env.GIT_COMMIT }}" }
- uses: ./.github/ci-setup-action
with:
# must be globally unique for build x runner
concurrency_key: public-testnet-x86
- name: Setup and Test
- name: Run Testnet Test
timeout-minutes: 40
uses: ./.github/ensure-tester-with-images
with:
runner_type: "8core-tester-x86"
builder_type: builder-x86
# these are copied to the tester and expected by the earthly command below
# if they fail to copy, it will try to build them on the tester and fail
builder_images_to_copy: aztecprotocol/end-to-end:${{ env.GIT_COMMIT }}
# command to produce the images in case they don't exist
builder_command: scripts/earthly-ci ./yarn-project+export-e2e-test-images
run: |
set -eux
cd ./yarn-project/end-to-end/
export FORCE_COLOR=1
../../scripts/earthly-ci -P --no-output +${{ matrix.test }}
run: |
set -eux
cd ./yarn-project/end-to-end/
export FORCE_COLOR=1
../../scripts/earthly-ci -P --no-output +e2e-public-testnet \
--SEQ_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }} \
--PROVER_PUBLISHER_PRIVATE_KEY=${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }} \
--ETHEREUM_HOST="https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}" \
--L1_CHAIN_ID="11155111"
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"schnorr",
"secp",
"SEMRESATTRS",
"Sepolia",
"sigchld",
"Signerless",
"siloes",
Expand Down
27 changes: 25 additions & 2 deletions yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,28 @@ E2E_TEST:
BUILD ../+export-end-to-end
END
END
# Run our docker compose, ending whenever sandbox ends, filtering out noisy eth_getLogs
RUN docker run -e HARDWARE_CONCURRENCY=$hardware_concurrency --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $test || $allow_fail

E2E_TEST_PUBLIC_TESTNET:
FUNCTION
ARG hardware_concurrency=""
ARG test
ARG allow_fail=false
ARG seq_private_key
ARG prover_private_key
ARG ethereum_host
ARG l1_chain_id
LOCALLY
# Let docker compose know about the pushed tags above
ENV AZTEC_DOCKER_TAG=$(git rev-parse HEAD)
# Optimize to not cause serial behavior if image already exists
IF ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"
WAIT
BUILD ../+export-end-to-end
END
END
RUN docker run -e L1_CHAIN_ID=$l1_chain_id -e ETHEREUM_HOST=$ethereum_host -e SEQ_PUBLISHER_PRIVATE_KEY=$seq_private_key -e PROVER_PUBLISHER_PRIVATE_KEY=$prover_private_key -e HARDWARE_CONCURRENCY=$hardware_concurrency --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $test || $allow_fail

NETWORK_TEST:
FUNCTION
ARG hardware_concurrency=""
Expand Down Expand Up @@ -225,7 +244,11 @@ e2e-token-contract:
DO +E2E_TEST --test=./src/e2e_token_contract

e2e-public-testnet:
DO +E2E_TEST --test=./src/public-testnet
ARG L1_CHAIN_ID="31337"
ARG ETHEREUM_HOST
ARG SEQ_PUBLISHER_PRIVATE_KEY
ARG PROVER_PUBLISHER_PRIVATE_KEY
DO +E2E_TEST_PUBLIC_TESTNET --test=./src/public-testnet --seq_private_key=${SEQ_PUBLISHER_PRIVATE_KEY:-} --prover_private_key=${PROVER_PUBLISHER_PRIVATE_KEY:-} --ethereum_host=${ETHEREUM_HOST:-} --l1_chain_id=${L1_CHAIN_ID:-}

flakey-e2e-tests:
DO +E2E_TEST --test=./src/flakey --allow_fail=true
Expand Down
32 changes: 17 additions & 15 deletions yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,25 +250,27 @@ export const deployL1Contracts = async (
client: walletClient,
});

// @note We make a time jump PAST the very first slot to not have to deal with the edge case of the first slot.
// The edge case being that the genesis block is already occupying slot 0, so we cannot have another block.
try {
// Need to get the time
const currentSlot = (await rollup.read.getCurrentSlot([])) as bigint;

if (BigInt(currentSlot) === 0n) {
const ts = Number(await rollup.read.getTimestampForSlot([1]));
await rpcCall('evm_setNextBlockTimestamp', [ts]);
await rpcCall('hardhat_mine', [1]);
if (chain.id == foundry.id) {
// @note We make a time jump PAST the very first slot to not have to deal with the edge case of the first slot.
// The edge case being that the genesis block is already occupying slot 0, so we cannot have another block.
try {
// Need to get the time
const currentSlot = (await rollup.read.getCurrentSlot([])) as bigint;

if (BigInt(currentSlot) !== 1n) {
throw new Error(`Error jumping time: current slot is ${currentSlot}`);
if (BigInt(currentSlot) === 0n) {
const ts = Number(await rollup.read.getTimestampForSlot([1]));
await rpcCall('evm_setNextBlockTimestamp', [ts]);
await rpcCall('hardhat_mine', [1]);
const currentSlot = (await rollup.read.getCurrentSlot([])) as bigint;

if (BigInt(currentSlot) !== 1n) {
throw new Error(`Error jumping time: current slot is ${currentSlot}`);
}
logger.info(`Jumped to slot 1`);
}
logger.info(`Jumped to slot 1`);
} catch (e) {
throw new Error(`Error jumping time: ${e}`);
}
} catch (e) {
throw new Error(`Error jumping time: ${e}`);
}

// Set initial blocks as proven if requested
Expand Down

0 comments on commit cfc65c6

Please sign in to comment.