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

Increase test coverage & Fix for goerli setup #853

Merged
merged 26 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 21 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
9 changes: 3 additions & 6 deletions .github/workflows/ethereum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ jobs:
node-version: v18.16.0
cache: "pnpm"
cache-dependency-path: core/pnpm-lock.yaml
- name: Install dependencies
working-directory: core
run: pnpm install --frozen-lockfile
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Build
working-directory: core/packages/contracts
run: pnpm build
- name: Install dependencies and Build all
working-directory: core
run: pnpm install --frozen-lockfile && pnpm build
- name: Test
working-directory: core/packages/contracts
run: forge test
Expand Down
7 changes: 5 additions & 2 deletions core/init.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

echo "Update submodules"
(cd .. && (git submodule update --init --recursive||true))

echo "Install husky hook"
(cd .. && ./core/node_modules/.bin/husky install)

echo "Installing sszgen"
go install github.com/ferranbt/fastssz/sszgen@latest

echo "Initialize foundry libraries"
(cd packages/contracts && (forge install||true))
(cd packages/contracts && forge install)

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "./init.sh",
"postinstall": "/bin/bash ./init.sh",
yrong marked this conversation as resolved.
Show resolved Hide resolved
"build": "turbo run build --filter '!./packages/contracts/lib/*'",
"test": "turbo run test --filter '!./packages/contracts/lib/*'",
"lint": "turbo run lint --filter '!./packages/contracts/lib/*'",
Expand Down
2 changes: 0 additions & 2 deletions core/packages/test/scripts/configure-beacon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ config_beacon_checkpoint()
check_point_call=$($relay_bin generate-beacon-checkpoint --spec $active_spec --url $beacon_endpoint_http)
popd
send_governance_transact_from_relaychain $bridgehub_para_id "$check_point_call" 180000000000 900000
# waiting for xcm to be executed on parachain
sleep 12
}

wait_beacon_chain_ready()
Expand Down
2 changes: 1 addition & 1 deletion core/packages/test/scripts/deploy-ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ start_lodestar() {
--enr.ip6 "127.0.0.1" \
--eth1.providerUrls "http://127.0.0.1:8545" \
--execution.urls "http://127.0.0.1:8551" \
--dataDir "$output_dir/beacon-$timestamp" \
--dataDir "$ethereum_data_dir" \
--reset \
--terminal-total-difficulty-override 0 \
--genesisEth1Hash $genesisHash \
Expand Down
3 changes: 1 addition & 2 deletions core/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ cumulus_bin="${CUMULUS_BIN:-$cumulus_dir/bin/polkadot-parachain}"
core_dir="$root_dir/core"
lodestar_version="${LODESTAR_VER:-1.8.0}"
geth_version="${GETH_VER:-v1.11.2}"
geth_dir="$root_dir/../go-ethereum/$geth_version"
contract_dir="$core_dir/packages/contracts"
relay_dir="$root_dir/relayer"
relay_bin="$relay_dir/build/snowbridge-relay"
export output_dir="${OUTPUT_DIR:-/tmp/snowbridge}"
export output_bin_dir="$output_dir/bin"
ethereum_data_dir="$output_dir/geth"
ethereum_data_dir="$output_dir/ethereum"
zombienet_data_dir="$output_dir/zombienet"
export PATH="$output_bin_dir:$PATH"

Expand Down
2 changes: 1 addition & 1 deletion core/packages/test/scripts/start-ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ start_chains()
if [ -z "${from_start_services:-}" ]; then
echo "start ethereum only!"
trap kill_all SIGINT SIGTERM EXIT
check_tool && cleanup && start_chains
check_tool && rm -rf "$ethereum_data_dir" && start_chains
wait
fi
15 changes: 11 additions & 4 deletions core/packages/test/scripts/start-goerli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ set -eu

source scripts/set-env.sh


start_chains()
{
npx lodestar beacon --dataDir="./ethereum-goerli" --network="goerli" --rest.namespace="*" --jwt-secret="./config/jwtsecret" --checkpointSyncUrl="https://sync-goerli.beaconcha.in" 2>&1 &
geth --goerli --override.shanghai=0 --datadir="./ethereum-goerli" --authrpc.addr="127.0.0.1" --http.addr="0.0.0.0" --http.corsdomain '*' --http --http.api eth,net,engine,admin --authrpc.jwtsecret config/jwtsecret 2>&1 &
echo "Starting execution node"
geth --goerli --override.shanghai=0 --datadir="$ethereum_data_dir" --authrpc.addr="127.0.0.1" --http.addr="0.0.0.0" --http.corsdomain '*' --http --http.api eth,net,engine,admin --authrpc.jwtsecret config/jwtsecret > "$output_dir/geth.log" 2>&1 &
echo "Waiting for geth API to be ready"
sleep 3
echo "Starting beacon node"
# explicit config max-old-space-size or will be oom
node --max-old-space-size=4096 ../../node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@chainsafe/lodestar/lib/index.js beacon --dataDir="$ethereum_data_dir" --network=goerli --rest.namespace=* --jwt-secret=./config/jwtsecret --checkpointSyncUrl=https://sync-goerli.beaconcha.in > "$output_dir/lodestar.log" 2>&1 &
echo "Waiting for beacon node to sync from checkpoint"
sleep 10
echo "Ethereum started!"
}

if [ -z "${from_start_services:-}" ]; then
echo "start goerli locally!"
trap kill_all SIGINT SIGTERM EXIT
start_chains
check_tool && rm -rf "$ethereum_data_dir" && start_chains
wait
fi
2 changes: 1 addition & 1 deletion core/packages/test/scripts/start-polkadot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ start_chains()
if [ -z "${from_start_services:-}" ]; then
echo "start polkadot only!"
trap kill_all SIGINT SIGTERM EXIT
check_tool && build_relaychain && build_cumulus_from_source && start_chains
check_tool && build_relaychain && build_cumulus_from_source && rm -rf $zombienet_data_dir && start_chains
wait
fi

2 changes: 1 addition & 1 deletion core/packages/test/scripts/start-relayer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ build_relayer()
if [ -z "${from_start_services:-}" ]; then
echo "start relayers only!"
trap kill_all SIGINT SIGTERM EXIT
check_tool && build_relayer && start_relayer
check_tool && build_relayer && config_relayer && start_relayer
wait
fi
2 changes: 2 additions & 0 deletions parachain/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ rococo-local.json

# coverage reports
cobertura.xml

pallets/ethereum-beacon-client/tests/fixtures/*.mainnet.json
Loading