Skip to content

Commit

Permalink
Make relay CLI generic (#849)
Browse files Browse the repository at this point in the history
* Start generalizing rialto-millau commands.

* cargo fmt --all

* Introduce generic balance.

* Unify message payloads.

* cargo fmt --all

* init - generic

* Attempt to unify send message.

* Start moving things around.

* cargo fmt --all

* Move init-bridge.

* cargo fmt --all

* Improve UX of bridge argument.

* Fix clippy.

* Fix docs and scripts.

* Add docs.

* Apply suggestions from code review

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Fix copyright.

* Add issue numbers.

* More todos.

* Update comments.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
  • Loading branch information
tomusdrw and HCastano authored Apr 1, 2021
1 parent 18e34c0 commit 2a07bd5
Show file tree
Hide file tree
Showing 38 changed files with 1,017 additions and 998 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,20 @@ Then we need to initialize and run the relayer:

```bash
docker run --network=host -it \
paritytech/substrate-relay initialize-rialto-headers-bridge-in-millau \
--millau-host localhost \
--millau-port 9945 \
--rialto-host localhost \
--rialto-port 9944 \
--millau-signer //Alice
paritytech/substrate-relay init-bridge RialtoToMillau \
--target-host localhost \
--target-port 9945 \
--source-host localhost \
--source-port 9944 \
--target-signer //Alice

docker run --network=host -it \
paritytech/substrate-relay rialto-headers-to-millau \
--millau-host localhost \
--millau-port 9945 \
--rialto-host localhost \
--rialto-port 9944 \
--millau-signer //Bob \
paritytech/substrate-relay relay-headers RialtoToMillau \
--target-host localhost \
--target-port 9945 \
--source-host localhost \
--source-port 9944 \
--target-signer //Bob \
```

You should now see the relayer submitting headers from the Millau chain to the Rialto chain.
Expand Down
12 changes: 6 additions & 6 deletions deployments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ seeds for the `sr25519` keys. This seed may also be used in the signer argument
and PoA relays. Example:

```bash
./substrate-relay relay-headers rialto-to-millau \
--rialto-host rialto-node-alice \
--rialto-port 9944 \
--millau-host millau-node-alice \
--millau-port 9944 \
--rialto-signer //Harry \
./substrate-relay relay-headers RialtoToMillau \
--source-host rialto-node-alice \
--source-port 9944 \
--target-host millau-node-alice \
--target-port 9944 \
--source-signer //Harry \
--prometheus-host=0.0.0.0
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ sleep 3
curl -v http://millau-node-alice:9933/health
curl -v http://rialto-node-alice:9933/health

/home/user/substrate-relay init-bridge millau-to-rialto \
--millau-host millau-node-alice \
--millau-port 9944 \
--rialto-host rialto-node-alice \
--rialto-port 9944 \
--rialto-signer //Alice
/home/user/substrate-relay init-bridge MillauToRialto \
--source-host millau-node-alice \
--source-port 9944 \
--target-host rialto-node-alice \
--target-port 9944 \
--target-signer //Alice

# Give chain a little bit of time to process initialization transaction
sleep 6
/home/user/substrate-relay relay-headers millau-to-rialto \
--millau-host millau-node-alice \
--millau-port 9944 \
--rialto-host rialto-node-alice \
--rialto-port 9944 \
--rialto-signer //Charlie \
/home/user/substrate-relay relay-headers MillauToRialto \
--source-host millau-node-alice \
--source-port 9944 \
--target-host rialto-node-alice \
--target-port 9944 \
--target-signer //Charlie \
--prometheus-host=0.0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ sleep 3
curl -v http://millau-node-alice:9933/health
curl -v http://rialto-node-alice:9933/health

/home/user/substrate-relay init-bridge rialto-to-millau \
--millau-host millau-node-alice \
--millau-port 9944 \
--rialto-host rialto-node-alice \
--rialto-port 9944 \
--millau-signer //Alice
/home/user/substrate-relay init-bridge RialtoToMillau \
--target-host millau-node-alice \
--target-port 9944 \
--source-host rialto-node-alice \
--source-port 9944 \
--target-signer //Alice

# Give chain a little bit of time to process initialization transaction
sleep 6
/home/user/substrate-relay relay-headers rialto-to-millau \
--millau-host millau-node-alice \
--millau-port 9944 \
--rialto-host rialto-node-alice \
--rialto-port 9944 \
--millau-signer //Charlie \
/home/user/substrate-relay relay-headers RialtoToMillau \
--target-host millau-node-alice \
--target-port 9944 \
--source-host rialto-node-alice \
--source-port 9944 \
--target-signer //Charlie \
--prometheus-host=0.0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ MESSAGE_LANE=${MSG_EXCHANGE_GEN_LANE:-00000000}

/home/user/substrate-relay relay-messages millau-to-rialto \
--lane $MESSAGE_LANE \
--millau-host millau-node-bob \
--millau-port 9944 \
--millau-signer //Eve \
--rialto-host rialto-node-bob \
--rialto-port 9944 \
--rialto-signer //Eve \
--source-host millau-node-bob \
--source-port 9944 \
--source-signer //Eve \
--target-host rialto-node-bob \
--target-port 9944 \
--target-signer //Eve \
--prometheus-host=0.0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ MESSAGE_LANE=${MSG_EXCHANGE_GEN_LANE:-00000000}

/home/user/substrate-relay relay-messages rialto-to-millau \
--lane $MESSAGE_LANE \
--rialto-host rialto-node-bob \
--rialto-port 9944 \
--rialto-signer //Ferdie \
--millau-host millau-node-bob \
--millau-port 9944 \
--millau-signer //Ferdie \
--source-host rialto-node-bob \
--source-port 9944 \
--source-signer //Ferdie \
--target-host millau-node-bob \
--target-port 9944 \
--target-signer //Ferdie \
--prometheus-host=0.0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE=1024
FERDIE_ADDR=5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL

SHARED_CMD="/home/user/substrate-relay send-message rialto-to-millau"
SHARED_HOST="--rialto-host rialto-node-bob --rialto-port 9944"
DAVE_SIGNER="--rialto-signer //Dave --millau-signer //Dave"
SHARED_HOST="--source-host rialto-node-bob --source-port 9944"
DAVE_SIGNER="--source-signer //Dave --target-signer //Dave"

SEND_MESSAGE="$SHARED_CMD $SHARED_HOST $DAVE_SIGNER"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE=128
FERDIE_ADDR=5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL

SHARED_CMD=" /home/user/substrate-relay send-message millau-to-rialto"
SHARED_HOST="--millau-host millau-node-bob --millau-port 9944"
DAVE_SIGNER="--rialto-signer //Dave --millau-signer //Dave"
SHARED_HOST="--source-host millau-node-bob --source-port 9944"
DAVE_SIGNER="--target-signer //Dave --source-signer //Dave"

SEND_MESSAGE="$SHARED_CMD $SHARED_HOST $DAVE_SIGNER"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ set -xeu
sleep 3
curl -v http://millau-node-alice:9933/health

/home/user/substrate-relay init-bridge westend-to-millau \
--westend-host westend-rpc.polkadot.io \
--westend-port 443 \
--westend-secure \
--millau-host millau-node-alice \
--millau-port 9944 \
--millau-signer //George
/home/user/substrate-relay init-bridge WestendToMillau \
--source-host westend-rpc.polkadot.io \
--source-port 443 \
--source-secure \
--target-host millau-node-alice \
--target-port 9944 \
--target-signer //George

# Give chain a little bit of time to process initialization transaction
sleep 6
/home/user/substrate-relay relay-headers westend-to-millau \
--westend-host westend-rpc.polkadot.io \
--westend-port 443 \
--westend-secure \
--millau-host millau-node-alice \
--millau-port 9944 \
--millau-signer //George \
/home/user/substrate-relay relay-headers WestendToMillau \
--source-host westend-rpc.polkadot.io \
--source-port 443 \
--source-secure \
--target-host millau-node-alice \
--target-port 9944 \
--target-signer //George \
--prometheus-host=0.0.0.0
12 changes: 6 additions & 6 deletions deployments/local-scripts/relay-messages-millau-to-rialto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ RIALTO_PORT="${RIALTO_PORT:-9944}"
RUST_LOG=bridge=debug \
./target/debug/substrate-relay relay-messages millau-to-rialto \
--lane 00000000 \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--millau-signer //Bob \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--rialto-signer //Bob \
--source-host localhost \
--source-port $MILLAU_PORT \
--source-signer //Bob \
--target-host localhost \
--target-port $RIALTO_PORT \
--target-signer //Bob \
--prometheus-host=0.0.0.0
12 changes: 6 additions & 6 deletions deployments/local-scripts/relay-messages-rialto-to-millau.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ RIALTO_PORT="${RIALTO_PORT:-9944}"
RUST_LOG=bridge=debug \
./target/debug/substrate-relay relay-messages rialto-to-millau \
--lane 00000000 \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--rialto-signer //Bob \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--millau-signer //Bob \
--source-host localhost \
--source-port $RIALTO_PORT \
--source-signer //Bob \
--target-host localhost \
--target-port $MILLAU_PORT \
--target-signer //Bob \
--prometheus-host=0.0.0.0
24 changes: 12 additions & 12 deletions deployments/local-scripts/relay-millau-to-rialto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ MILLAU_PORT="${MILLAU_PORT:-9945}"
RIALTO_PORT="${RIALTO_PORT:-9944}"

RUST_LOG=bridge=debug \
./target/debug/substrate-relay init-bridge millau-to-rialto \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--rialto-signer //Alice \
./target/debug/substrate-relay init-bridge MillauToRialto \
--source-host localhost \
--source-port $MILLAU_PORT \
--target-host localhost \
--target-port $RIALTO_PORT \
--target-signer //Alice \

sleep 5
RUST_LOG=bridge=debug \
./target/debug/substrate-relay relay-headers millau-to-rialto \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--rialto-signer //Alice \
./target/debug/substrate-relay relay-headers MillauToRialto \
--source-host localhost \
--source-port $MILLAU_PORT \
--target-host localhost \
--target-port $RIALTO_PORT \
--target-signer //Alice \
--prometheus-host=0.0.0.0
24 changes: 12 additions & 12 deletions deployments/local-scripts/relay-rialto-to-millau.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ MILLAU_PORT="${MILLAU_PORT:-9945}"
RIALTO_PORT="${RIALTO_PORT:-9944}"

RUST_LOG=bridge=debug \
./target/debug/substrate-relay init-bridge rialto-to-millau \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--millau-signer //Alice \
./target/debug/substrate-relay init-bridge RialtoToMillau \
--target-host localhost \
--target-port $MILLAU_PORT \
--source-host localhost \
--source-port $RIALTO_PORT \
--target-signer //Alice \

sleep 5
RUST_LOG=bridge=debug \
./target/debug/substrate-relay relay-headers rialto-to-millau \
--millau-host localhost \
--millau-port $MILLAU_PORT \
--rialto-host localhost \
--rialto-port $RIALTO_PORT \
--millau-signer //Alice \
./target/debug/substrate-relay relay-headers RialtoToMillau \
--target-host localhost \
--target-port $MILLAU_PORT \
--source-host localhost \
--source-port $RIALTO_PORT \
--target-signer //Alice \
--prometheus-host=0.0.0.0
Loading

0 comments on commit 2a07bd5

Please sign in to comment.