Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and refactor e2e tests #303

Draft
wants to merge 8 commits into
base: celo10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
cp -r .devnet/ .devnet-mt-cannon/
- run:
name: Generate Celo allocs
command: DEVNET_L2OO="true" DEVNET_CELO="true" make devnet-allocs
command: DEVNET_L2OO="false" DEVNET_ALTDA="true" GENERIC_ALTDA="true" DEVNET_CELO="true" make devnet-allocs
- run:
name: Copy Celo allocs to .devnet-celo
command: cp -r .devnet/ .devnet-celo/
Expand Down Expand Up @@ -259,12 +259,7 @@ jobs:
- ".devnet-altda"
- ".devnet-altda-generic"
- ".devnet-mt-cannon"
- ".devnet-celo/addresses.json"
- ".devnet-celo/allocs-l1.json"
- ".devnet-celo/allocs-l2-delta.json"
- ".devnet-celo/allocs-l2-ecotone.json"
- ".devnet-celo/allocs-l2-fjord.json"
- ".devnet-celo/addresses.json"
- ".devnet-celo"
- notify-failures-on-develop

docker-build:
Expand Down Expand Up @@ -1039,12 +1034,15 @@ jobs:
condition:
equal: ['celo', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_ALTDA = true
command: echo 'export DEVNET_ALTDA=true' >> $BASH_ENV
- run:
name: Set GENERIC_ALTDA = true
command: echo 'export GENERIC_ALTDA=true' >> $BASH_ENV
- run:
name: Set DEVNET_CELO = true
command: echo 'export DEVNET_CELO=true' >> $BASH_ENV
- run:
name: Set DEVNET_L2OO = true
command: echo 'export DEVNET_L2OO=true' >> $BASH_ENV
- when:
condition:
equal: ['altda-generic', <<parameters.variant>>]
Expand Down Expand Up @@ -1138,25 +1136,37 @@ jobs:
command: make devnet-test
- when:
condition:
equal: ['celo', <<parameters.variant>>]
equal: ['celo', <<parameters.variant>>]
steps:
# TODO: include this in the base image directly
- run:
name: install Deno v2.
command: |
curl -fsSL https://deno.land/install.sh | DENO_INSTALL=$HOME/.local sh -s v2.1.9 &&
echo 'export PATH=$HOME/.local/bin/:${PATH}' >> $BASH_ENV
- run:
name: set Deno cache path in env
command: |
echo 'export DENO_DIR=$HOME/.cache/deno' >> $BASH_ENV
- restore_cache:
key: v1-celo-deps-{{ checksum "op-e2e/celo/package-lock.json" }}
# install dependencies
key: deno-cache-v2-{{ checksum "op-e2e/celo/deno.lock" }}
paths:
- ~/.cache/deno
- run:
working_directory: op-e2e/celo
name: install dependencies
command: npm install
# save any changes to the cache
name: Cache Deno Dependencies
working_directory: op-e2e/celo
command: deno run cache-deps
- save_cache:
key: v1-celo-deps-{{ checksum "op-e2e/celo/package-lock.json" }}
key: deno-cache-v2-{{ checksum "op-e2e/celo/deno.lock" }}
paths:
- op-e2e/celo/node_modules
- ~/.cache/deno
- run:
working_directory: op-e2e/celo
environment:
CELOTEST_SPAWN_DEVNET: false
working_directory: op-e2e/celo
name: Run Celo e2e tests
command: |
SPAWN_DEVNET=false ./run_all_tests.sh
deno run test
- run:
name: Dump op-node logs
command: |
Expand Down
22 changes: 13 additions & 9 deletions bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,27 @@ def main():

def init_devnet_l1_deploy_config(paths, update_timestamp=False):
deploy_config = read_json(paths.devnet_config_template_path)
if update_timestamp:
deploy_config['l1GenesisBlockTimestamp'] = '{:#x}'.format(int(time.time()))
if DEVNET_L2OO:
deploy_config['useFaultProofs'] = False
if DEVNET_ALTDA:
deploy_config['useAltDA'] = True
if GENERIC_ALTDA:
deploy_config['daCommitmentType'] = "GenericCommitment"
if DEVNET_CELO:
deploy_config['useFaultProofs'] = True
deploy_config['useCustomGasToken'] = True
deploy_config['gasPriceOracleScalar'] = 0
# 'gasPriceOracleScalar' has to be zero in order for those
# to work
deploy_config['gasPriceOracleBlobBaseFeeScalar'] = 0
deploy_config['gasPriceOracleBaseFeeScalar'] = 0

deploy_config['useCustomGasToken'] = True
deploy_config['deployCeloContracts'] = True
# Usage of the zero address in combination of the useCustomGasToken == True
# will deploy a new contract
deploy_config['customGasTokenAddress'] = "0x0000000000000000000000000000000000000000"
if update_timestamp:
deploy_config['l1GenesisBlockTimestamp'] = '{:#x}'.format(int(time.time()))
if DEVNET_L2OO:
deploy_config['useFaultProofs'] = False
if DEVNET_ALTDA:
deploy_config['useAltDA'] = True
if GENERIC_ALTDA:
deploy_config['daCommitmentType'] = "GenericCommitment"
write_json(paths.devnet_config_path, deploy_config)

def devnet_l1_allocs(paths):
Expand Down
11 changes: 11 additions & 0 deletions op-e2e/celo/.default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export CELOTEST_L2_RPCURL='http://localhost:9545'
export CELOTEST_L1_RPCURL='http://localhost:8545'
export CELOTEST_L1_CHAINID=900
export CELOTEST_L2_CHAINID=901
export CELOTEST_MONOREPOPATH='../../'
export CELOTEST_TESTDIRPATH='./tests/'
# m/44'/60'/0'/0/11 of "test test test test test test test test test test test junk":
export CELOTEST_FUNDER_PRIVATEKEY="0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82"
export CELOTEST_SPAWN_DEVNET=true
export CELOTEST_USE_FAULTPROOFS=true
export CELOTEST_USE_ALTDA=true
4 changes: 0 additions & 4 deletions op-e2e/celo/.prettierrc.toml

This file was deleted.

3 changes: 0 additions & 3 deletions op-e2e/celo/babel.config.cjs

This file was deleted.

21 changes: 21 additions & 0 deletions op-e2e/celo/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"tasks": {
"test": "deno test --allow-read --allow-run --allow-net='127.0.0.1,localhost' --allow-env --env-file=.default.env --env-file=.env main.test.ts"
"cache-deps": "deno cache main.test.ts"
},
"workspace": [
"./packages/celo-test-runner",
"./packages/celo-test-util",
"./packages/celo-test-viem"
],
"imports": {
"@dx/reflect": "jsr:@dx/reflect@^0.2.14",
"@std/assert": "jsr:@std/assert@^1.0.11",
"@std/dotenv": "jsr:@std/dotenv@^0.225.3",
"@std/expect": "jsr:@std/expect@^1.0.13",
"@std/io": "jsr:@std/io@^0.225.2",
"@std/testing": "jsr:@std/testing@^1.0.9",
"reverse-mirage": "npm:reverse-mirage@^1.1.0",
"viem": "npm:viem@^2.22.21"
}
}
213 changes: 213 additions & 0 deletions op-e2e/celo/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions op-e2e/celo/jest.config.json

This file was deleted.

3 changes: 3 additions & 0 deletions op-e2e/celo/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { parseConfigWithPrefixFromEnv, run } from "@celo-test/runner";

await run(parseConfigWithPrefixFromEnv(Deno.env.toObject(), "CELOTEST"));
Loading
Loading