Skip to content

Commit

Permalink
Link cumulus as submodule (paritytech#793)
Browse files Browse the repository at this point in the history
* Link cumulus as submodule

* Update submodules when init

* Cleanup

* Update submodule
  • Loading branch information
yrong authored Mar 25, 2023
1 parent b2acc82 commit 9e586ad
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 30 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
path = core/packages/contracts/lib/openzeppelin-contracts
url = https:/openzeppelin/openzeppelin-contracts
branch = v4.8.2
[submodule "cumulus"]
path = cumulus
url = https:/Snowfork/cumulus
branch = snowbridge
3 changes: 2 additions & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ extend-exclude = [
"**/fixtures/*.js",
"**/*ffi*.js",
"**/*mock*.rs",
"**/*data*.rs"
"**/*data*.rs",
"cumulus/**"
]
3 changes: 3 additions & 0 deletions core/init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/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)

Expand Down
3 changes: 3 additions & 0 deletions core/packages/test/.envrc-example
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ source_up_if_exists
# export BEEFY_RELAY_ETH_KEY= # Your Beefy relayer account private key
# export PARACHAIN_RELAY_ETH_KEY= # Your Parachain relayer account private key
# export E2E_TEST_ETH_KEY= # Your E2E test account private key

# export CUMULUS_VER=snowbridge # For dev setup change to some feature branch

25 changes: 0 additions & 25 deletions core/packages/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,6 @@ https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer

Confirm the block number is > 2.

### Using a custom Cumulus build for BridgeHub and Statemine

By default `scripts/start-services.sh` will use `cargo` to install the `polkadot-parachain` binary from the [Snowbridge/cumulus](https:/Snowfork/cumulus) forks `snowbridge` branch.

To use a custom version of cumulus:

1. Clone a cumulus repo. In the example below we clone the [Snowbridge/cumulus](https:/Snowfork/cumulus) fork.

```console
git clone https:/Snowfork/cumulus.git -b snowbridge
```

2. Build `polkadot-parachain` bin.

```console
cd cumulus
cargo build --release --bin polkadot-parachain
```

3. Set `CUMULUS_BIN` in `core/packages/test/.envrc` and `direnv allow`.

```sh
export CUMULUS_BIN=/path/to/cumulus/target/release/polkadot-parachain
```

## E2E tests

These tests are meant to closely replicate real-world behaviour. This means that they also replicate real-world delays and confirmation times. This can take up to 4 minutes per test and around 40 minutes for all tests.
Expand Down
9 changes: 8 additions & 1 deletion core/packages/test/scripts/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ rebuild_cumulus(){
popd
}

build_cumulus_from_source(){
pushd $root_dir/cumulus
cargo build --release --bin polkadot-parachain
cp target/release/polkadot-parachain $output_bin_dir/polkadot-parachain
popd
}

rebuild_relaychain(){
pushd $root_dir/parachain
mkdir -p $relaychain_dir
Expand Down Expand Up @@ -61,7 +68,7 @@ install_binary() {
echo "Building and installing binaries."
mkdir -p $output_bin_dir
build_ethereum
build_cumulus
build_cumulus_from_source
build_relaychain
build_relayer
}
Expand Down
4 changes: 2 additions & 2 deletions core/packages/test/scripts/deploy-polkadot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source scripts/set-env.sh

generate_chain_spec() {
echo "Generating chain specification"
"$cumulus_bin" build-spec --chain "$bridge_hub_runtime" --disable-default-bootnode > "$output_dir/spec.json"
"$output_bin_dir/polkadot-parachain" build-spec --chain "$bridge_hub_runtime" --disable-default-bootnode > "$output_dir/spec.json"

initial_beacon_block=""
while [ -z "$initial_beacon_block" ] || [ "$initial_beacon_block" == "0x0000000000000000000000000000000000000000000000000000000000000000" ]
Expand All @@ -23,7 +23,7 @@ generate_chain_spec() {
do
echo "Waiting for beacon to get initial bootstrap..."
bootstrap_data=$(curl -s "$beacon_endpoint_http/eth/v1/beacon/light_client/bootstrap/$initial_beacon_block")
# sometimes will get http 503 error from the above bootstrap endpoint in goerli network
# sometimes will get http 503 error from the above bootstrap endpoint in goerli network
# so add true here to ignore the error and just retry
bootstrap_header=$(jq -r '.data.header' <<< "$bootstrap_data" || true)
slot=$(jq -r '.data.header.beacon.slot' <<< "$bootstrap_data" || true)
Expand Down
2 changes: 1 addition & 1 deletion core/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bridge_hub_runtime="${PARACHAIN_RUNTIME:-bridge-hub-rococo-local}"
relaychain_version="${POLKADOT_VER:-v0.9.38}"
relaychain_dir="$root_dir/parachain/.cargo/$relaychain_version"
relaychain_bin="${POLKADOT_BIN:-$relaychain_dir/bin/polkadot}"
cumulus_version="${CUMULUS_VER:-snowbridge-v0.9.38}"
cumulus_version="${CUMULUS_VER:-snowbridge}"
cumulus_dir="$root_dir/parachain/.cargo/$cumulus_version"
cumulus_bin="${CUMULUS_BIN:-$cumulus_dir/bin/polkadot-parachain}"
core_dir="$root_dir/core"
Expand Down
1 change: 1 addition & 0 deletions cumulus
Submodule cumulus added at 07296e

0 comments on commit 9e586ad

Please sign in to comment.