forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
269 changed files
with
57,147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers | ||
pledge to making participation in our project and our community a harassment-free experience for | ||
everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity | ||
and expression, level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit | ||
permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
### Facilitation, Not Strongarming | ||
|
||
We recognise that this software is merely a tool for users to create and maintain their blockchain | ||
of preference. We see that blockchains are naturally community platforms with users being the | ||
ultimate decision makers. We assert that good software will maximise user agency by facilitate | ||
user-expression on the network. As such: | ||
|
||
* This project will strive to give users as much choice as is both reasonable and possible over what | ||
protocol they adhere to; but | ||
* use of the project's technical forums, commenting systems, pull requests and issue trackers as a | ||
means to express individual protocol preferences is forbidden. | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are | ||
expected to take appropriate and fair corrective action in response to any instances of unacceptable | ||
behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, | ||
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or | ||
to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is | ||
representing the project or its community. Examples of representing a project or community include | ||
using an official project e-mail address, posting via an official social media account, or acting as | ||
an appointed representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting | ||
the project team at [email protected]. All complaints will be reviewed and investigated and will | ||
result in a response that is deemed necessary and appropriate to the circumstances. The project team | ||
is obligated to maintain confidentiality with regard to the reporter of an incident. Further | ||
details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face | ||
temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at | ||
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# 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. | ||
|
||
🚧 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/ci-unified): | ||
|
||
```bash | ||
docker pull paritytech/ci-unified:latest | ||
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/ci-unified:latest 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 Installation | ||
page](https://docs.substrate.io/main-docs/install/) 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. | ||
|
||
``` | ||
+---------------+ +---------------+ | ||
| | | | | ||
| Rococo | | Westend | | ||
| | | | | ||
+-------+-------+ +-------+-------+ | ||
^ ^ | ||
| +---------------+ | | ||
| | | | | ||
+-----> | Bridge Relay | <-------+ | ||
| | | ||
+---------------+ | ||
``` | ||
|
||
The Rococo chain must be able to accept Westend 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 Rococo headers via RPC and submit them to the Westend | ||
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 `bin`, 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. | ||
|
||
``` | ||
├── modules // Substrate Runtime Modules (a.k.a Pallets) | ||
│ ├── beefy // On-Chain BEEFY Light Client (in progress) | ||
│ ├── grandpa // On-Chain GRANDPA Light Client | ||
│ ├── messages // Cross Chain Message Passing | ||
│ ├── parachains // On-Chain Parachains Light Client | ||
│ ├── relayers // Relayer Rewards Registry | ||
│ ├── xcm-bridge-hub // Multiple Dynamic Bridges Support | ||
│ ├── xcm-bridge-hub-router // XCM Router that may be used to Connect to XCM Bridge Hub | ||
├── primitives // Code shared between modules, runtimes, and relays | ||
│ └── ... | ||
├── relays // Application for sending finality proofs and messages between chains | ||
│ └── ... | ||
└── scripts // Useful development and maintenance scripts | ||
``` | ||
|
||
## Running the Bridge | ||
|
||
Apart from live Rococo <> Westend bridge, you may spin up local networks and test see how it works locally. More | ||
details may be found in | ||
[this document](https://github.com/paritytech/polkadot-sdk/tree/master//cumulus/parachains/runtimes/bridge-hubs/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Security Policy | ||
|
||
Thanks for helping make the Parity ecosystem more secure. Security is one of our first priorities. | ||
|
||
## Reporting a vulnerability | ||
|
||
If you find something that can be treated as a security vulnerability, please do not use the issue tracker or discuss it | ||
in the public forum as it can cause more damage, rather than giving real help to the ecosystem. | ||
|
||
Security vulnerabilities should be reported by the [contact form](https://security-submission.parity.io/). | ||
|
||
If you think that your report might be eligible for the Bug Bounty Program, please mark this during the submission. | ||
Please check up-to-date [Parity Bug Bounty Program rules](https://www.parity.io/bug-bounty) to find out the information | ||
about our Bug Bounty Program. | ||
|
||
**Warning**: This is an unified SECURITY.md file for Paritytech GitHub Organization. The presence of this file does not | ||
mean that this repository is covered by the Bug Bounty program. Please always check the Bug Bounty Program scope for | ||
information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
[package] | ||
name = "bridge-runtime-common" | ||
version = "0.7.0" | ||
description = "Common types and functions that may be used by substrate-based runtimes of all bridged chains" | ||
authors.workspace = true | ||
edition.workspace = true | ||
repository.workspace = true | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } | ||
hash-db = { version = "0.16.0", default-features = false } | ||
log = { workspace = true } | ||
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] } | ||
static_assertions = { version = "1.1", optional = true } | ||
|
||
# Bridge dependencies | ||
|
||
bp-header-chain = { path = "../../primitives/header-chain", default-features = false } | ||
bp-messages = { path = "../../primitives/messages", default-features = false } | ||
bp-parachains = { path = "../../primitives/parachains", default-features = false } | ||
bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false } | ||
bp-relayers = { path = "../../primitives/relayers", default-features = false } | ||
bp-runtime = { path = "../../primitives/runtime", default-features = false } | ||
bp-xcm-bridge-hub = { path = "../../primitives/xcm-bridge-hub", default-features = false } | ||
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false } | ||
pallet-bridge-grandpa = { path = "../../modules/grandpa", default-features = false } | ||
pallet-bridge-messages = { path = "../../modules/messages", default-features = false } | ||
pallet-bridge-parachains = { path = "../../modules/parachains", default-features = false } | ||
pallet-bridge-relayers = { path = "../../modules/relayers", default-features = false } | ||
|
||
# Substrate dependencies | ||
|
||
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } | ||
|
||
# Polkadot dependencies | ||
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", default-features = false , branch = "master" } | ||
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", default-features = false , branch = "master" } | ||
|
||
[dev-dependencies] | ||
bp-test-utils = { path = "../../primitives/test-utils" } | ||
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"bp-header-chain/std", | ||
"bp-messages/std", | ||
"bp-parachains/std", | ||
"bp-polkadot-core/std", | ||
"bp-relayers/std", | ||
"bp-runtime/std", | ||
"bp-xcm-bridge-hub-router/std", | ||
"bp-xcm-bridge-hub/std", | ||
"codec/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"hash-db/std", | ||
"log/std", | ||
"pallet-bridge-grandpa/std", | ||
"pallet-bridge-messages/std", | ||
"pallet-bridge-parachains/std", | ||
"pallet-bridge-relayers/std", | ||
"pallet-transaction-payment/std", | ||
"pallet-utility/std", | ||
"scale-info/std", | ||
"sp-api/std", | ||
"sp-core/std", | ||
"sp-io/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
"sp-trie/std", | ||
"xcm-builder/std", | ||
"xcm/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"pallet-balances/runtime-benchmarks", | ||
"pallet-bridge-grandpa/runtime-benchmarks", | ||
"pallet-bridge-messages/runtime-benchmarks", | ||
"pallet-bridge-parachains/runtime-benchmarks", | ||
"pallet-bridge-relayers/runtime-benchmarks", | ||
"pallet-utility/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
"xcm-builder/runtime-benchmarks", | ||
] | ||
integrity-test = ["static_assertions"] |
Oops, something went wrong.