Adds Snowbridge to Rococo runtime (#2522)

# Description

Adds Snowbridge to the Rococo bridge hub runtime. Includes config
changes required in Rococo asset hub.

---------

Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>
Co-authored-by: ron <yrong1997@gmail.com>
Co-authored-by: Vincent Geddes <vincent.geddes@hey.com>
Co-authored-by: claravanstaden <Cats 4 life!>
This commit is contained in:
Clara van Staden
2023-12-21 18:06:36 +02:00
committed by GitHub
parent 9f5221cc2f
commit 18d53dbf91
151 changed files with 19379 additions and 149 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Example command for updating pallet benchmarking
pushd ../cumulus
cargo run --release --bin polkadot-parachain \
--features runtime-benchmarks \
-- \
benchmark pallet \
--chain=bridge-hub-rococo-dev \
--pallet=snowbridge_ethereum_beacon_client \
--extrinsic="*" \
--execution=wasm --wasm-execution=compiled \
--steps 50 --repeat 20 \
--output ./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/snowbridge_ethereum_beacon_client.rs
popd
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Creates a string constant from STDIN
echo "const DATA: &'static str = concat!("
cat - | fold | sed 's/^.*/\t"&",/'
echo ");"
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
echo "*** Initializing WASM build environment"
if [ -z $CI_PROJECT_NAME ] ; then
rustup update nightly
rustup update stable
fi
rustup target add wasm32-unknown-unknown --toolchain nightly
@@ -0,0 +1,5 @@
#!/bin/bash
cd ../ethereum
truffle exec scripts/dumpParachainConfig.js | sed '/^Using/d;/^$/d'
@@ -0,0 +1,113 @@
#!/bin/bash
# A script to remove everything from snowbridge repository/subtree, except:
#
# - parachain
# - readme
# - license
set -eu
# show CLI help
function show_help() {
set +x
echo " "
echo Error: $1
echo "Usage:"
echo " ./scripts/verify-pallets-build.sh Exit with code 0 if pallets code is well decoupled from the other code in the repo"
echo "Options:"
echo " --no-revert Leaves only runtime code on exit"
echo " --ignore-git-state Ignores git actual state"
exit 1
}
# parse CLI args
NO_REVERT=
IGNORE_GIT_STATE=
for i in "$@"
do
case $i in
--no-revert)
NO_REVERT=true
shift
;;
--ignore-git-state)
IGNORE_GIT_STATE=true
shift
;;
*)
show_help "Unknown option: $i"
;;
esac
done
# the script is able to work only on clean git copy, unless we want to ignore this check
[[ ! -z "${IGNORE_GIT_STATE}" ]] || [[ -z "$(git status --porcelain)" ]] || { echo >&2 "The git copy must be clean"; exit 1; }
# let's avoid any restrictions on where this script can be called for - snowbridge repo may be
# plugged into any other repo folder. So the script (and other stuff that needs to be removed)
# may be located either in call dir, or one of it subdirs.
SNOWBRIDGE_FOLDER="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../.."
# remove everything we think is not required for our needs
rm -rf $SNOWBRIDGE_FOLDER/.cargo
rm -rf $SNOWBRIDGE_FOLDER/.github
rm -rf $SNOWBRIDGE_FOLDER/contracts
rm -rf $SNOWBRIDGE_FOLDER/codecov.yml
rm -rf $SNOWBRIDGE_FOLDER/docs
rm -rf $SNOWBRIDGE_FOLDER/hooks
rm -rf $SNOWBRIDGE_FOLDER/relayer
rm -rf $SNOWBRIDGE_FOLDER/smoketest
rm -rf $SNOWBRIDGE_FOLDER/web
rm -rf $SNOWBRIDGE_FOLDER/.envrc-example
rm -rf $SNOWBRIDGE_FOLDER/.gitbook.yaml
rm -rf $SNOWBRIDGE_FOLDER/.gitignore
rm -rf $SNOWBRIDGE_FOLDER/.gitmodules
rm -rf $SNOWBRIDGE_FOLDER/_typos.toml
rm -rf $SNOWBRIDGE_FOLDER/_codecov.yml
rm -rf $SNOWBRIDGE_FOLDER/flake.lock
rm -rf $SNOWBRIDGE_FOLDER/flake.nix
rm -rf $SNOWBRIDGE_FOLDER/go.work
rm -rf $SNOWBRIDGE_FOLDER/go.work.sum
rm -rf $SNOWBRIDGE_FOLDER/polkadot-sdk
rm -rf $SNOWBRIDGE_FOLDER/rust-toolchain.toml
rm -rf $SNOWBRIDGE_FOLDER/parachain/rustfmt.toml
rm -rf $SNOWBRIDGE_FOLDER/parachain/.gitignore
rm -rf $SNOWBRIDGE_FOLDER/parachain/templates
rm -rf $SNOWBRIDGE_FOLDER/parachain/.config
rm -rf $SNOWBRIDGE_FOLDER/parachain/pallets/ethereum-beacon-client/fuzz
cd bridges/snowbridge/parachain
# fix polkadot-sdk paths in Cargo.toml files
find "." -name 'Cargo.toml' | while read -r file; do
replace=$(printf '../../' )
if [[ "$(uname)" = "Darwin" ]] || [[ "$(uname)" = *BSD ]]; then
sed -i '' "s|polkadot-sdk/|$replace|g" "$file"
else
sed -i "s|polkadot-sdk/|$replace|g" "$file"
fi
done
# let's test if everything we need compiles
cargo check -p snowbridge-ethereum-beacon-client
cargo check -p snowbridge-ethereum-beacon-client --features runtime-benchmarks
cargo check -p snowbridge-ethereum-beacon-client --features try-runtime
cargo check -p snowbridge-inbound-queue
cargo check -p snowbridge-inbound-queue --features runtime-benchmarks
cargo check -p snowbridge-inbound-queue --features try-runtime
cargo check -p snowbridge-outbound-queue
cargo check -p snowbridge-outbound-queue --features runtime-benchmarks
cargo check -p snowbridge-outbound-queue --features try-runtime
cargo check -p snowbridge-system
cargo check -p snowbridge-system --features runtime-benchmarks
cargo check -p snowbridge-system --features try-runtime
cd -
# we're removing lock file after all checks are done. Otherwise we may use different
# Substrate/Polkadot/Cumulus commits and our checks will fail
rm -f $SNOWBRIDGE_FOLDER/parachain/Cargo.toml
rm -f $SNOWBRIDGE_FOLDER/parachain/Cargo.lock
echo "OK"