Bridge: make some headers submissions free (#4102)

supersedes https://github.com/paritytech/parity-bridges-common/pull/2873

Draft because of couple of TODOs:
- [x] fix remaining TODOs;
- [x] double check that all changes from
https://github.com/paritytech/parity-bridges-common/pull/2873 are
correctly ported;
- [x] create a separate PR (on top of that one or a follow up?) for
https://github.com/paritytech/polkadot-sdk/tree/sv-try-new-bridge-fees;
- [x] fix compilation issues (haven't checked, but there should be
many).

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Svyatoslav Nikolsky
2024-04-25 08:26:16 +03:00
committed by GitHub
parent 4f3d43a0c4
commit a633e954f3
54 changed files with 3731 additions and 616 deletions
@@ -40,7 +40,7 @@ cumulus_based = true
rpc_port = 8933
ws_port = 8943
args = [
"-lparachain=debug,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
"-lparachain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"
]
# run bob as parachain collator
@@ -51,7 +51,7 @@ cumulus_based = true
rpc_port = 8934
ws_port = 8944
args = [
"-lparachain=trace,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
"-lparachain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"
]
[[parachains]]
@@ -65,14 +65,14 @@ cumulus_based = true
ws_port = 9910
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
"-lparachain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"
]
[[parachains.collators]]
name = "asset-hub-rococo-collator2"
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
"-lparachain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"
]
#[[hrmp_channels]]
@@ -40,7 +40,7 @@ cumulus_based = true
rpc_port = 8935
ws_port = 8945
args = [
"-lparachain=debug,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
"-lparachain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"
]
# run bob as parachain collator
@@ -51,7 +51,7 @@ cumulus_based = true
rpc_port = 8936
ws_port = 8946
args = [
"-lparachain=trace,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
"-lparachain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"
]
[[parachains]]
@@ -65,14 +65,14 @@ cumulus_based = true
ws_port = 9010
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
"-lparachain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"
]
[[parachains.collators]]
name = "asset-hub-westend-collator2"
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
"-lparachain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"
]
#[[hrmp_channels]]
@@ -169,12 +169,107 @@ function run_relay() {
--lane "${LANE_ID}"
}
function run_finality_relay() {
local relayer_path=$(ensure_relayer)
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-headers rococo-to-bridge-hub-westend \
--only-free-headers \
--source-host localhost \
--source-port 9942 \
--target-host localhost \
--target-port 8945 \
--target-version-mode Auto \
--target-signer //Charlie \
--target-transactions-mortality 4&
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-headers westend-to-bridge-hub-rococo \
--only-free-headers \
--source-host localhost \
--source-port 9945 \
--target-host localhost \
--target-port 8943 \
--target-version-mode Auto \
--target-signer //Charlie \
--target-transactions-mortality 4
}
function run_parachains_relay() {
local relayer_path=$(ensure_relayer)
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-parachains rococo-to-bridge-hub-westend \
--only-free-headers \
--source-host localhost \
--source-port 9942 \
--target-host localhost \
--target-port 8945 \
--target-version-mode Auto \
--target-signer //Dave \
--target-transactions-mortality 4&
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-parachains westend-to-bridge-hub-rococo \
--only-free-headers \
--source-host localhost \
--source-port 9945 \
--target-host localhost \
--target-port 8943 \
--target-version-mode Auto \
--target-signer //Dave \
--target-transactions-mortality 4
}
function run_messages_relay() {
local relayer_path=$(ensure_relayer)
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-messages bridge-hub-rococo-to-bridge-hub-westend \
--source-host localhost \
--source-port 8943 \
--source-version-mode Auto \
--source-signer //Eve \
--source-transactions-mortality 4 \
--target-host localhost \
--target-port 8945 \
--target-version-mode Auto \
--target-signer //Eve \
--target-transactions-mortality 4 \
--lane $LANE_ID&
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-messages bridge-hub-westend-to-bridge-hub-rococo \
--source-host localhost \
--source-port 8945 \
--source-version-mode Auto \
--source-signer //Ferdie \
--source-transactions-mortality 4 \
--target-host localhost \
--target-port 8943 \
--target-version-mode Auto \
--target-signer //Ferdie \
--target-transactions-mortality 4 \
--lane $LANE_ID
}
case "$1" in
run-relay)
init_wnd_ro
init_ro_wnd
run_relay
;;
run-finality-relay)
init_wnd_ro
init_ro_wnd
run_finality_relay
;;
run-parachains-relay)
run_parachains_relay
;;
run-messages-relay)
run_messages_relay
;;
init-asset-hub-rococo-local)
ensure_polkadot_js_api
# create foreign assets for native Westend token (governance call on Rococo)
@@ -386,6 +481,9 @@ case "$1" in
echo "A command is require. Supported commands for:
Local (zombienet) run:
- run-relay
- run-finality-relay
- run-parachains-relay
- run-messages-relay
- init-asset-hub-rococo-local
- init-bridge-hub-rococo-local
- init-asset-hub-westend-local
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Rococo AH
xdg-open https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9910#/explorer&
# Rococo BH
xdg-open https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer&
# Westend BH
xdg-open https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer&
# Westend AH
xdg-open https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9010#/explorer&
@@ -1,3 +1,9 @@
#!/bin/bash
$ENV_PATH/bridges_rococo_westend.sh "$@"
if [ $1 == "auto-log" ]; then
shift # ignore "auto-log"
log_name=$1
$ENV_PATH/bridges_rococo_westend.sh "$@" >$TEST_DIR/logs/$log_name.log
else
$ENV_PATH/bridges_rococo_westend.sh "$@"
fi
@@ -59,12 +59,12 @@ if [[ $init -eq 1 ]]; then
fi
if [[ $start_relayer -eq 1 ]]; then
${BASH_SOURCE%/*}/start_relayer.sh $rococo_dir $westend_dir relayer_pid
${BASH_SOURCE%/*}/start_relayer.sh $rococo_dir $westend_dir finality_relayer_pid parachains_relayer_pid messages_relayer_pid
fi
echo $rococo_dir > $TEST_DIR/rococo.env
echo $westend_dir > $TEST_DIR/westend.env
echo
wait -n $rococo_pid $westend_pid $relayer_pid
wait -n $rococo_pid $westend_pid $finality_relayer_pid $parachains_relayer_pid $messages_relayer_pid
kill -9 -$$
@@ -7,17 +7,31 @@ source "$FRAMEWORK_PATH/utils/zombienet.sh"
rococo_dir=$1
westend_dir=$2
__relayer_pid=$3
__finality_relayer_pid=$3
__parachains_relayer_pid=$4
__messages_relayer_pid=$5
logs_dir=$TEST_DIR/logs
helper_script="${BASH_SOURCE%/*}/helper.sh"
relayer_log=$logs_dir/relayer.log
echo -e "Starting rococo-westend relayer. Logs available at: $relayer_log\n"
start_background_process "$helper_script run-relay" $relayer_log relayer_pid
# start finality relayer
finality_relayer_log=$logs_dir/relayer_finality.log
echo -e "Starting rococo-westend finality relayer. Logs available at: $finality_relayer_log\n"
start_background_process "$helper_script run-finality-relay" $finality_relayer_log finality_relayer_pid
# start parachains relayer
parachains_relayer_log=$logs_dir/relayer_parachains.log
echo -e "Starting rococo-westend parachains relayer. Logs available at: $parachains_relayer_log\n"
start_background_process "$helper_script run-parachains-relay" $parachains_relayer_log parachains_relayer_pid
# start messages relayer
messages_relayer_log=$logs_dir/relayer_messages.log
echo -e "Starting rococo-westend messages relayer. Logs available at: $messages_relayer_log\n"
start_background_process "$helper_script run-messages-relay" $messages_relayer_log messages_relayer_pid
run_zndsl ${BASH_SOURCE%/*}/rococo.zndsl $rococo_dir
run_zndsl ${BASH_SOURCE%/*}/westend.zndsl $westend_dir
eval $__relayer_pid="'$relayer_pid'"
eval $__finality_relayer_pid="'$finality_relayer_pid'"
eval $__parachains_relayer_pid="'$parachains_relayer_pid'"
eval $__messages_relayer_pid="'$messages_relayer_pid'"