mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 04:41:04 +00:00
392447f5c8
407bf44a8a add missing license header (#1204) 9babb19810 Custom relay strategy (#1198) c287872a11 fix clippy things (#1200) 3a40e62789 Expose some const value and type (#1186) 32b61476d1 increase sleep before connectingMillau (#1195) aabe7041fa revert messages transactions mortality (#1194) 3651f4f909 Message transactions mortality (#1191) 364d6e155d Bump dependencies (#1180) f0389acc08 cargo +nightly fmt --all (#1192) b270b6a016 Unify error enums in substrate and ethereum clients with `thiserror` (#1094) 58c4946f74 Limit max call size of Rialto/Millau runtimes (#1187) fd56a8cd56 Add UI to the deployment (#1047) 16f01dc736 Westend -> Millau alerts are pending before notifications are sent (#1184) 5628c11ece replace collective flip with babe randomness in Rialto (#1188) 1094a63b00 ignore another (pretty bad) RUSTSEC (#1185) 379fe323ea fix/ignore cargo deny issues (#1183) 92af5e6e64 additional log in finality relay + rephrase "failed" (#1182) b996a3b681 Rialto parachain in test deployments (#1178) 28d9332b44 Resubmit transactions strategy for Polkadot/Kusama (#1175) d0172c6847 Playing with CI (#1179) fb6f42456d fix checks order when registering parachain (#1177) ee828c005a Register-parachain subcommand of substrate-relay (#1170) 8cd2b1a112 Token swap pallet benchmarks (#1174) bb811accb1 fix collision with westend bridge (#1172) 8d2fba70ed add token swaps to test deployments (#1169) b6d1bdfe2c publish rialto parachain collator image (#1171) 834ae4a10a Fix OutboundLaneData types (#1159) 5ee0ea1626 copypasted -> copied (#1168) c3bb835f18 fix spelling (#1167) f90d041dc9 Upgrade `jsonrpsee` to v0.3 (#1051) 598c9b6d0d add some basic tests for swap tokens (#1164) 05e88c61f5 publish images when tag of specific format(e.g. v2021-09-27 + v2021-09-27-1) is published (#1166) 7f3f94a6e0 Fix CI again (#1165) ff37de332f Move calculation relayer reward into `MessageDeliveryAndDispatchPayment` (#1153) 36fbba839b fix clippy warning (#1163) 16da44d018 explicit wasm build (#1158) c9c8226449 Match substrate's fmt (#1148) 2fdd7f3e5e Fix/ignore clippy warnings (#1157) 43dfcc2686 Adding LookupAddress (#1156) 951eaa5582 Add rialto-parachain runtime and node (#1142) 803d266d61 Rename MessageId -> BridgeMessageId (#1152) 5f234484fc Box large arguments of GRANDPA pallet (#1154) cf9abc1011 Fix spelling (#1150) ab83ba2e58 Relay subcommand that performs token RLT <> MLAU token swap (#1141) 832536caf0 Polkadot <> Kusama relayers (#1122) 6d0daa8975 Add `OnMessageAccepted` callback (#1134) 5d03a20b3e Integrate token swap pallet into Millau runtime (#1099) ea4cfa833e Adding MultiAddress type and ValidationCodeHash (#1139) c20325a784 Add tests for `Raw` and `BridgeSendMessage` enum `Call` variants (#1125) 6d802416e2 increase pause before pining Rialto nodes (#1137) b54fa56b62 calculate fee using full message payload (#1132) ca5d8178f5 Add parachain pallets to rialto runtime (#1053) 9eaae4142e fix transaction resubmitter limits for Millau -> Rialto transactions (#1135) 9d4e17783c add --mandatory-headers-only cli option to complex relay (#1129) 1c5e0ec1cb Add local CI info to README (#1131) a8e0929e14 chore: spellchecker fixes (#1130) 3b8e2118e3 set fee for importing mandatory headers to zero (#1127) 49bba9aa52 another bunch of words for spellchecker (#1128) 8a72eafef6 Increase pause before messages generation start (#1126) 1f0ba9a191 Move some associated types from relay_substrate_client::Chain to bp_runtime::Chain (#1087) 74bc1a5b54 Transactions resubmitter (#1083) 21ba001f26 log max balance drop when sending message (#1117) 638a7ddffa Code Cleaning (#1124) be6555c51b Fix buildah logout (#1120) 87539c4a98 Format code work (#1116) 526fe7fdd7 fix spelling (#1119) bd4ce7f241 Fix spelling (#1118) 3c1147858e added missing constants to Kusama/Polkadot primitives (#1114) 52093b22ab Fix delivery transaction estimation used by rational relayer (#1109) 77a2f2fbed Remove fund account checks from upgrade. (#1111) 824334802b Rename param and update comment (#1108) d7784bfe06 Fix spellcheck (#1110) 0b18f5906a Refactor substrate messages source and substrate messages target (#1105) b27240bbff fix compilation (#1107) 9697da4fe8 Emit mortal transactions from relay (#1073) b29396c077 Change vault vars type to env vars (#1084) 35e0bbdc0c Make clippy mandatory. (#1103) a517e8541f Remove unused deps (#1102) 873dae608a Remove unnessary deps (#1101) 13450b74ee Stored conversion rate updater (#1005) 74389829f3 [BREAKING] Migrate messages pallet to frame v2 (#1088) 424da938dd README fix (#1100) 865744c909 upgrade currency exchange pallet to frame v2 (#1097) b5038148b3 Add missing docs (#1095) 0791e911c1 Common crate for substrate-relay (#1082) 3834c9d880 Update high-level-overview.md (#1093) c93553face Increase the time window for messaging alerts. (#1092) 8b9cc3cecd migrate pallet-shift-session-manager to frame v2 (#1090) dc91813c22 migrate eth PoA pallet to frame v2 (#1091) f16bb098cc Migrate dispatch pallet to frame v2 (#1089) 19f4325348 Bridge/This Chain Ids should be exposed as constants on pallet level. (#1085) 6381122df7 Change ChainSpec::from_genesis for Rialto and Millau chains to reflect the chain names. (#1079) 0f1d33e973 Make CI happy again (#1086) 238e65d96f fix typo (#1080) fc008457b6 Token-swap-over-bridge pallet (#944) 3fb97fa5ef Fix full spellcheck (#1076) eae4ed7170 fixed wrong trace (#1075) 219a0fad04 merge two weight-related loops in messages pallet (#1071) fc85632fdb increase_message_fee depends on stored mesage size (#1066) 530f37a23b companion for https://github.com/paritytech/polkadot/pull/3507 (#1067) 53b8cba683 sc_basic_authorship=trace for millau nodes (#1074) 9874e05e98 Improve traces of message generator scripts (#1069) 7b5ee84fbb extract message_details impl into runtime common (#1070) 5a4aed5a8b refund weight for mot pruning messages (#1062) 90e3d1e111 Fix Westend -> Millau sync (#1064) 427d30ddfc When restarting client, also "restart" tokio runtime (#1065) d47c05eeef Change get pipeline sensitive variables from Vault instead of GitLab settings (#1063) d775a85415 use tokio reactor to execute jsonrpsee futures (#1061) 15c8cd61cb Use BABE to author blocks on Rialto (previously: Aura) (#1050) 5186293500 Allow reading suri && password override from file (#1059) b506298262 Update jsonrpsee reference (#1049) 1734d00517 enable weight fee adjustent in Rialto/Millau (#1044) 607265afae Pay dispatch fee at target chain cli option (#1043) ce79ef91be bump dependencies before start referencing polkadot repo (#1048) 924fa24f6d Cli option for greedy relayer + run no-losses relayer by default (#1042) e21eba7b59 Yrong README Fixup + M1 Fixes (#1045) 20d08204a2 Confirm delivery detects when more than expected messages are confirmed (#1039) 994b846b52 pre and post dispatch weights of OnDeliveryConfirmed callback (#1040) 1dd5297e84 give real value to Rialto and Millau tokens (#1038) 035bee8715 Use real conversion rate in greedy relayer strategy (#1035) 9cfaecd0f7 fixed metrics prefix (#1037) 1d8d224937 Use kebab-case for bridge arguments (#1036) f30a4c79a6 Shared reference to conversion rate metric value (#1034) c34d7a5cbb estimate transaction fee (#1015) 93404b18bb change alert period from 2m to 10m for Westend -> Millau (GRANDPA or public node itself is lagging sometimes) (#1032) git-subtree-dir: bridges git-subtree-split: 407bf44a8a5f4e60aceef2dc755cd9ff09929ac3
249 lines
9.9 KiB
Markdown
249 lines
9.9 KiB
Markdown
# Parity Bridges Common
|
|
|
|
This is a collection of components for building bridges.
|
|
|
|
These components include Substrate pallets for syncing headers, passing arbitrary messages, as well
|
|
as libraries for building relayers to provide cross-chain communication capabilities.
|
|
|
|
Three bridge nodes are also available. The nodes can be used to run test networks which bridge other
|
|
Substrate chains or Ethereum Proof-of-Authority chains.
|
|
|
|
🚧 The bridges are currently under construction - a hardhat is recommended beyond this point 🚧
|
|
|
|
## Contents
|
|
|
|
- [Installation](#installation)
|
|
- [High-Level Architecture](#high-level-architecture)
|
|
- [Project Layout](#project-layout)
|
|
- [Running the Bridge](#running-the-bridge)
|
|
- [How to send a message](#how-to-send-a-message)
|
|
- [Community](#community)
|
|
|
|
## Installation
|
|
|
|
To get up and running you need both stable and nightly Rust. Rust nightly is used to build the Web
|
|
Assembly (WASM) runtime for the node. You can configure the WASM support as so:
|
|
|
|
```bash
|
|
rustup install nightly
|
|
rustup target add wasm32-unknown-unknown --toolchain nightly
|
|
```
|
|
|
|
Once this is configured you can build and test the repo as follows:
|
|
|
|
```
|
|
git clone https://github.com/paritytech/parity-bridges-common.git
|
|
cd parity-bridges-common
|
|
cargo build --all
|
|
cargo test --all
|
|
```
|
|
|
|
Also you can build the repo with
|
|
[Parity CI Docker image](https://github.com/paritytech/scripts/tree/master/dockerfiles/bridges-ci):
|
|
|
|
```bash
|
|
docker pull paritytech/bridges-ci:production
|
|
mkdir ~/cache
|
|
chown 1000:1000 ~/cache #processes in the container runs as "nonroot" user with UID 1000
|
|
docker run --rm -it -w /shellhere/parity-bridges-common \
|
|
-v /home/$(whoami)/cache/:/cache/ \
|
|
-v "$(pwd)":/shellhere/parity-bridges-common \
|
|
-e CARGO_HOME=/cache/cargo/ \
|
|
-e SCCACHE_DIR=/cache/sccache/ \
|
|
-e CARGO_TARGET_DIR=/cache/target/ paritytech/bridges-ci:production cargo build --all
|
|
#artifacts can be found in ~/cache/target
|
|
```
|
|
|
|
If you want to reproduce other steps of CI process you can use the following
|
|
[guide](https://github.com/paritytech/scripts#reproduce-ci-locally).
|
|
|
|
If you need more information about setting up your development environment Substrate's
|
|
[Getting Started](https://substrate.dev/docs/en/knowledgebase/getting-started/) page is a good
|
|
resource.
|
|
|
|
## High-Level Architecture
|
|
|
|
This repo has support for bridging foreign chains together using a combination of Substrate pallets
|
|
and external processes called relayers. A bridge chain is one that is able to follow the consensus
|
|
of a foreign chain independently. For example, consider the case below where we want to bridge two
|
|
Substrate based chains.
|
|
|
|
```
|
|
+---------------+ +---------------+
|
|
| | | |
|
|
| Rialto | | Millau |
|
|
| | | |
|
|
+-------+-------+ +-------+-------+
|
|
^ ^
|
|
| +---------------+ |
|
|
| | | |
|
|
+-----> | Bridge Relay | <-------+
|
|
| |
|
|
+---------------+
|
|
```
|
|
|
|
The Millau chain must be able to accept Rialto headers and verify their integrity. It does this by
|
|
using a runtime module designed to track GRANDPA finality. Since two blockchains can't interact
|
|
directly they need an external service, called a relayer, to communicate. The relayer will subscribe
|
|
to new Rialto headers via RPC and submit them to the Millau chain for verification.
|
|
|
|
Take a look at [Bridge High Level Documentation](./docs/high-level-overview.md) for more in-depth
|
|
description of the bridge interaction.
|
|
|
|
## Project Layout
|
|
|
|
Here's an overview of how the project is laid out. The main bits are the `node`, which is the actual
|
|
"blockchain", the `modules` which are used to build the blockchain's logic (a.k.a the runtime) and
|
|
the `relays` which are used to pass messages between chains.
|
|
|
|
```
|
|
├── bin // Node and Runtime for the various Substrate chains
|
|
│ └── ...
|
|
├── deployments // Useful tools for deploying test networks
|
|
│ └── ...
|
|
├── diagrams // Pretty pictures of the project architecture
|
|
│ └── ...
|
|
├── modules // Substrate Runtime Modules (a.k.a Pallets)
|
|
│ ├── ethereum // Ethereum PoA Header Sync Module
|
|
│ ├── grandpa // On-Chain GRANDPA Light Client
|
|
│ ├── messages // Cross Chain Message Passing
|
|
│ ├── dispatch // Target Chain Message Execution
|
|
│ └── ...
|
|
├── primitives // Code shared between modules, runtimes, and relays
|
|
│ └── ...
|
|
├── relays // Application for sending headers and messages between chains
|
|
│ └── ...
|
|
└── scripts // Useful development and maintenance scripts
|
|
```
|
|
|
|
## Running the Bridge
|
|
|
|
To run the Bridge you need to be able to connect the bridge relay node to the RPC interface of nodes
|
|
on each side of the bridge (source and target chain).
|
|
|
|
There are 2 ways to run the bridge, described below:
|
|
|
|
- building & running from source
|
|
- running a Docker Compose setup (recommended).
|
|
|
|
### Using the Source
|
|
|
|
First you'll need to build the bridge nodes and relay. This can be done as follows:
|
|
|
|
```bash
|
|
# In `parity-bridges-common` folder
|
|
cargo build -p rialto-bridge-node
|
|
cargo build -p millau-bridge-node
|
|
cargo build -p substrate-relay
|
|
```
|
|
|
|
### Running a Dev network
|
|
|
|
We will launch a dev network to demonstrate how to relay a message between two Substrate based
|
|
chains (named Rialto and Millau).
|
|
|
|
To do this we will need two nodes, two relayers which will relay headers, and two relayers which
|
|
will relay messages.
|
|
|
|
#### Running from local scripts
|
|
|
|
To run a simple dev network you can use the scripts located in the
|
|
[`deployments/local-scripts` folder](./deployments/local-scripts).
|
|
|
|
First, we must run the two Substrate nodes.
|
|
|
|
```bash
|
|
# In `parity-bridges-common` folder
|
|
./deployments/local-scripts/run-rialto-node.sh
|
|
./deployments/local-scripts/run-millau-node.sh
|
|
```
|
|
|
|
After the nodes are up we can run the header relayers.
|
|
|
|
```bash
|
|
./deployments/local-scripts/relay-millau-to-rialto.sh
|
|
./deployments/local-scripts/relay-rialto-to-millau.sh
|
|
```
|
|
|
|
At this point you should see the relayer submitting headers from the Millau Substrate chain to the
|
|
Rialto Substrate chain.
|
|
|
|
```
|
|
# Header Relayer Logs
|
|
[Millau_to_Rialto_Sync] [date] DEBUG bridge Going to submit finality proof of Millau header #147 to Rialto
|
|
[...] [date] INFO bridge Synced 147 of 147 headers
|
|
[...] [date] DEBUG bridge Going to submit finality proof of Millau header #148 to Rialto
|
|
[...] [date] INFO bridge Synced 148 of 149 headers
|
|
```
|
|
|
|
Finally, we can run the message relayers.
|
|
|
|
```bash
|
|
./deployments/local-scripts/relay-messages-millau-to-rialto.sh
|
|
./deployments/local-scripts/relay-messages-rialto-to-millau.sh
|
|
```
|
|
|
|
You will also see the message lane relayers listening for new messages.
|
|
|
|
```
|
|
# Message Relayer Logs
|
|
[Millau_to_Rialto_MessageLane_00000000] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about best message nonces
|
|
[...] [date] INFO bridge Synced Some(2) of Some(3) nonces in Millau::MessagesDelivery -> Rialto::MessagesDelivery race
|
|
[...] [date] DEBUG bridge Asking Millau::MessagesDelivery about message nonces
|
|
[...] [date] DEBUG bridge Received best nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces { latest_nonce: 0, nonces_data: () }
|
|
[...] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about finalized message nonces
|
|
[...] [date] DEBUG bridge Received finalized nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces { latest_nonce: 0, nonces_data: () }
|
|
[...] [date] DEBUG bridge Received nonces from Millau::MessagesDelivery: SourceClientNonces { new_nonces: {}, confirmed_nonce: Some(0) }
|
|
[...] [date] DEBUG bridge Asking Millau node about its state
|
|
[...] [date] DEBUG bridge Received state from Millau node: ClientState { best_self: HeaderId(1593, 0xacac***), best_finalized_self: HeaderId(1590, 0x0be81d...), best_finalized_peer_at_best_self: HeaderId(0, 0xdcdd89...) }
|
|
```
|
|
|
|
To send a message see the ["How to send a message" section](#how-to-send-a-message).
|
|
|
|
### Full Network Docker Compose Setup
|
|
|
|
For a more sophisticated deployment which includes bidirectional header sync, message passing,
|
|
monitoring dashboards, etc. see the [Deployments README](./deployments/README.md).
|
|
|
|
You should note that you can find images for all the bridge components published on
|
|
[Docker Hub](https://hub.docker.com/u/paritytech).
|
|
|
|
To run a Rialto node for example, you can use the following command:
|
|
|
|
```bash
|
|
docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 \
|
|
-it paritytech/rialto-bridge-node --dev --tmp \
|
|
--rpc-cors=all --unsafe-rpc-external --unsafe-ws-external
|
|
```
|
|
|
|
### How to send a message
|
|
|
|
In this section we'll show you how to quickly send a bridge message, if you want to
|
|
interact with and test the bridge see more details in [send message](./docs/send-message.md)
|
|
|
|
```bash
|
|
# In `parity-bridges-common` folder
|
|
./scripts/send-message-from-millau-rialto.sh remark
|
|
```
|
|
|
|
After sending a message you will see the following logs showing a message was successfully sent:
|
|
|
|
```
|
|
INFO bridge Sending message to Rialto. Size: 286. Dispatch weight: 1038000. Fee: 275,002,568
|
|
INFO bridge Signed Millau Call: 0x7904...
|
|
TRACE bridge Sent transaction to Millau node: 0x5e68...
|
|
```
|
|
|
|
## Community
|
|
|
|
Main hangout for the community is [Element](https://element.io/) (formerly Riot). Element is a chat
|
|
server like, for example, Discord. Most discussions around Polkadot and Substrate happen
|
|
in various Element "rooms" (channels). So, joining Element might be a good idea, anyway.
|
|
|
|
If you are interested in information exchange and development of Polkadot related bridges please
|
|
feel free to join the [Polkadot Bridges](https://app.element.io/#/room/#bridges:web3.foundation)
|
|
Element channel.
|
|
|
|
The [Substrate Technical](https://app.element.io/#/room/#substrate-technical:matrix.org) Element
|
|
channel is most suited for discussions regarding Substrate itself.
|