diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 1255c06050ca..37839791456b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,5 +1,3 @@
-bridges/ @tomusdrw @svyatonik @acatangiu
-
# CI
/.github/ @paritytech/ci @chevdor
/scripts/ci/ @paritytech/ci @chevdor
diff --git a/BRIDGES.md b/BRIDGES.md
deleted file mode 100644
index fb61132fbbb5..000000000000
--- a/BRIDGES.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Using Parity Bridges Common dependency (`git subtree`).
-
-In `./bridges` sub-directory you can find a `git subtree` imported version of:
-[parity-bridges-common](https://github.com/paritytech/parity-bridges-common/) repository.
-
-# How to fix broken Bridges code?
-
-To fix Bridges code simply create a commit in current (`polkadot`) repo. Best if
-the commit is isolated to changes in `./bridges` sub-directory, because it makes
-it easier to import that change back to upstream repo.
-
-# How to pull latest Bridges code or contribute back?
-
-Note that it's totally fine to ping the Bridges Team to do that for you. The point
-of adding the code as `git subtree` is to **reduce maintenance cost** for Polkadot
-developers.
-
-If you still would like to either update the code to match latest code from the repo
-or create an upstream PR read below. The following commands should be run in the
-current (`polkadot`) repo.
-
-1. Add Bridges repo as a local remote:
-```
-$ git remote add -f bridges git@github.com:paritytech/parity-bridges-common.git
-```
-
-If you plan to contribute back, consider forking the repository on Github and adding
-your personal fork as a remote as well.
-```
-$ git remote add -f my-bridges git@github.com:tomusdrw/parity-bridges-common.git
-```
-
-2. To update Bridges:
-```
-$ git fetch bridges master
-$ git subtree pull --prefix=bridges bridges master --squash
-````
-
-We use `--squash` to avoid adding individual commits and rather squashing them
-all into one.
-
-3. Contributing back to Bridges (creating upstream PR)
-```
-$ git subtree push --prefix=bridges my-bridges master
-```
-This command will push changes to your personal fork of Bridges repo, from where
-you can simply create a PR to the main repo.
diff --git a/Cargo.lock b/Cargo.lock
index d4ccc0fb72c2..612b5cc0504f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -674,162 +674,6 @@ dependencies = [
"thiserror",
]
-[[package]]
-name = "bp-header-chain"
-version = "0.1.0"
-dependencies = [
- "bp-runtime",
- "bp-test-utils",
- "finality-grandpa",
- "frame-support",
- "hex",
- "hex-literal",
- "parity-scale-codec",
- "scale-info",
- "serde",
- "sp-core",
- "sp-finality-grandpa",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "bp-message-dispatch"
-version = "0.1.0"
-dependencies = [
- "bp-runtime",
- "frame-support",
- "parity-scale-codec",
- "scale-info",
- "sp-std",
-]
-
-[[package]]
-name = "bp-messages"
-version = "0.1.0"
-dependencies = [
- "bitvec",
- "bp-runtime",
- "frame-support",
- "frame-system",
- "hex",
- "hex-literal",
- "impl-trait-for-tuples",
- "parity-scale-codec",
- "scale-info",
- "serde",
- "sp-core",
- "sp-std",
-]
-
-[[package]]
-name = "bp-polkadot-core"
-version = "0.1.0"
-dependencies = [
- "bp-messages",
- "bp-runtime",
- "frame-support",
- "frame-system",
- "hex",
- "parity-scale-codec",
- "scale-info",
- "sp-api",
- "sp-core",
- "sp-runtime",
- "sp-std",
- "sp-version",
-]
-
-[[package]]
-name = "bp-rococo"
-version = "0.1.0"
-dependencies = [
- "bp-messages",
- "bp-polkadot-core",
- "bp-runtime",
- "frame-support",
- "parity-scale-codec",
- "smallvec",
- "sp-api",
- "sp-runtime",
- "sp-std",
- "sp-version",
-]
-
-[[package]]
-name = "bp-runtime"
-version = "0.1.0"
-dependencies = [
- "frame-support",
- "hash-db",
- "hex-literal",
- "num-traits",
- "parity-scale-codec",
- "scale-info",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-state-machine",
- "sp-std",
- "sp-trie",
-]
-
-[[package]]
-name = "bp-test-utils"
-version = "0.1.0"
-dependencies = [
- "bp-header-chain",
- "ed25519-dalek",
- "finality-grandpa",
- "parity-scale-codec",
- "sp-application-crypto",
- "sp-finality-grandpa",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "bp-wococo"
-version = "0.1.0"
-dependencies = [
- "bp-messages",
- "bp-polkadot-core",
- "bp-rococo",
- "bp-runtime",
- "parity-scale-codec",
- "sp-api",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "bridge-runtime-common"
-version = "0.1.0"
-dependencies = [
- "bp-message-dispatch",
- "bp-messages",
- "bp-runtime",
- "ed25519-dalek",
- "frame-support",
- "frame-system",
- "hash-db",
- "pallet-balances",
- "pallet-bridge-dispatch",
- "pallet-bridge-grandpa",
- "pallet-bridge-messages",
- "pallet-transaction-payment",
- "parity-scale-codec",
- "scale-info",
- "sp-api",
- "sp-core",
- "sp-runtime",
- "sp-state-machine",
- "sp-std",
- "sp-trie",
- "sp-version",
- "static_assertions",
-]
-
[[package]]
name = "bs58"
version = "0.4.0"
@@ -5159,70 +5003,6 @@ dependencies = [
"sp-std",
]
-[[package]]
-name = "pallet-bridge-dispatch"
-version = "0.1.0"
-dependencies = [
- "bp-message-dispatch",
- "bp-runtime",
- "frame-support",
- "frame-system",
- "log",
- "parity-scale-codec",
- "scale-info",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "pallet-bridge-grandpa"
-version = "0.1.0"
-dependencies = [
- "bp-header-chain",
- "bp-runtime",
- "bp-test-utils",
- "finality-grandpa",
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "log",
- "num-traits",
- "parity-scale-codec",
- "scale-info",
- "serde",
- "sp-core",
- "sp-finality-grandpa",
- "sp-io",
- "sp-runtime",
- "sp-std",
- "sp-trie",
-]
-
-[[package]]
-name = "pallet-bridge-messages"
-version = "0.1.0"
-dependencies = [
- "bitvec",
- "bp-message-dispatch",
- "bp-messages",
- "bp-runtime",
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "log",
- "num-traits",
- "pallet-balances",
- "parity-scale-codec",
- "scale-info",
- "serde",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
[[package]]
name = "pallet-child-bounties"
version = "4.0.0-dev"
@@ -8492,11 +8272,6 @@ version = "0.9.25"
dependencies = [
"beefy-merkle-tree",
"beefy-primitives",
- "bp-messages",
- "bp-rococo",
- "bp-runtime",
- "bp-wococo",
- "bridge-runtime-common",
"frame-benchmarking",
"frame-executive",
"frame-support",
@@ -8511,9 +8286,6 @@ dependencies = [
"pallet-balances",
"pallet-beefy",
"pallet-beefy-mmr",
- "pallet-bridge-dispatch",
- "pallet-bridge-grandpa",
- "pallet-bridge-messages",
"pallet-collective",
"pallet-grandpa",
"pallet-im-online",
diff --git a/Cargo.toml b/Cargo.toml
index 355b15dec886..1b6cd4b8b212 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -114,10 +114,6 @@ members = [
"utils/generate-bags",
]
-# We want to be able to build the bridge relayer without pulling it (and all of its
-# dependencies into the Polkadot workspace)
-exclude = ["bridges/relays/bin-substrate", "bridges/bin/rialto/runtime", "bridges/bin/millau/runtime"]
-
[badges]
maintenance = { status = "actively-developed" }
diff --git a/bridges/.config/lingua.dic b/bridges/.config/lingua.dic
deleted file mode 100644
index 223a962006a2..000000000000
--- a/bridges/.config/lingua.dic
+++ /dev/null
@@ -1,243 +0,0 @@
-90
-
-&&
-1KB
-1MB
-5MB
-=
-API/SM
-APIs
-AccountId/MS
-Apache-2.0/M
-Autogenerated
-BFT/M
-BTC/S
-Best/MS
-BlockId
-BlockNumber
-BridgeStorage
-clonable
-CLI/MS
-Chain1
-Chain2
-ChainSpec
-ChainTime
-DOT/S
-ERC-20
-Ethereum
-FN
-FinalizationError
-GPL/M
-GPLv3/M
-GiB/S
-Handler/MS
-Hasher
-HeaderA
-HeaderId
-InitiateChange
-Instance1
-Instance2
-Instance42
-InstantCurrencyPayments
-KSM/S
-KYC/M
-keypair/MS
-KeyPair
-Kovan
-Lane1
-Lane2
-Lane3
-LaneId
-MIN_SIZE
-MIT/M
-MMR
-MaxUnrewardedRelayerEntriesAtInboundLane
-MaybeExtra
-MaybeOrphan
-Merklized
-MessageNonce
-MessageNonces
-MessagePayload
-MetricsParams
-Millau/MS
-OldHeader
-OutboundMessages
-PoA
-PoV/MS
-Pre
-RLP
-RPC/MS
-Rialto/MS
-Relayer/MS
-Runtime1
-Runtime2
-SIZE_FACTOR
-SS58
-SS58Prefix
-STALL_SYNC_TIMEOUT
-SURI
-ServiceFactory/MS
-SignedExtension
-Stringified
-Submitter1
-S|N
-TCP
-ThisChain
-TODO
-U256
-Unparsed
-Vec
-WND/S
-Westend/MS
-Wococo/MS
-XCM/S
-XCMP/M
-annualised/MS
-api/SM
-aren
-arg
-args
-async
-auth
-auths/SM
-backoff
-benchmarking/MS
-best_substrate_header
-bitfield/MS
-blake2/MS
-blockchain/MS
-borked
-chain_getBlock
-choosen
-config/MS
-cooldown
-crypto/MS
-customizable/B
-Debian/M
-decodable/MS
-delivery_and_dispatch_fee
-dev
-dispatchable
-dispatchables
-doesn
-ed25519
-enum/MS
-entrypoint/MS
-ethereum/MS
-externality/MS
-extrinsic/MS
-extrinsics
-fedora/M
-functor
-fuzzer
-hasher
-hardcoded
-https
-implementers
-include/BG
-inherent/MS
-initialize/RG
-instantiate/B
-intrinsic/MS
-invariant/MS
-invariants
-io
-isn
-isolate/BG
-js
-jsonrpsee
-keccak
-keccak256/M
-keyring
-keystore/MS
-kusama/S
-lane
-malus
-max_value
-merkle/MS
-metadata
-millau
-misbehavior/SM
-misbehaviors
-multivalidator/SM
-natively
-no_std
-nonces
-number
-ok
-oneshot/MS
-others'
-pallet_bridge_grandpa
-pallet_bridge_messages
-pallet_message_lane
-parablock/MS
-parachain/MS
-param/MS
-parameterize/D
-plancks
-polkadot/MS
-pov-block/MS
-precommit
-proc-macro/MS
-prometheus
-proxying
-provisioner/MS
-probabilistically
-prune_depth
-prune_end
-receival
-reconnection
-redhat/M
-repo/MS
-runtime/MS
-rustc/MS
-relayer/MS
-shouldn
-source_at_target
-source_latest_confirmed
-source_latest_generated
-sp_finality_grandpa
-spawner
-sr25519
-src
-stringified
-struct/MS
-submitters/MS
-subsystem/MS
-subsystems'
-subcommand/MS
-synchronizer
-target_at_source
-target_latest_confirmed
-target_latest_received
-taskmanager/MS
-teleport/RG
-teleportation/SM
-teleporter/SM
-teleporters
-testnet/MS
-timeframe
-tokio
-timestamp
-trie/MS
-trustless/Y
-tuple
-u32
-ubuntu/M
-undeliverable
-unfinalized
-union/MSG
-unpruned
-unservable/B
-unsynced
-updatable
-validator/SM
-ve
-vec
-verifier
-w3f/MS
-wakeup
-wasm/M
-websocket
-x2
-~
diff --git a/bridges/.config/spellcheck.toml b/bridges/.config/spellcheck.toml
deleted file mode 100644
index e061c29ac222..000000000000
--- a/bridges/.config/spellcheck.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-[hunspell]
-lang = "en_US"
-search_dirs = ["."]
-extra_dictionaries = ["lingua.dic"]
-skip_os_lookups = true
-use_builtin = true
-
-[hunspell.quirks]
-# `Type`'s
-# 5x
-transform_regex = ["^'([^\\s])'$", "^[0-9]+(?:\\.[0-9]*)?x$", "^'s$", "^\\+$", "[><+-]"]
-allow_concatenation = true
-allow_dashes = true
diff --git a/bridges/.dockerignore b/bridges/.dockerignore
deleted file mode 100644
index f4ceea785605..000000000000
--- a/bridges/.dockerignore
+++ /dev/null
@@ -1 +0,0 @@
-**/target/
diff --git a/bridges/.editorconfig b/bridges/.editorconfig
deleted file mode 100644
index e2375881ea06..000000000000
--- a/bridges/.editorconfig
+++ /dev/null
@@ -1,19 +0,0 @@
-root = true
-[*]
-indent_style=tab
-indent_size=tab
-tab_width=4
-end_of_line=lf
-charset=utf-8
-trim_trailing_whitespace=true
-max_line_length=100
-insert_final_newline=true
-
-[*.{yml,md,yaml,sh}]
-indent_style=space
-indent_size=2
-tab_width=8
-end_of_line=lf
-
-[*.md]
-max_line_length=80
diff --git a/bridges/.github/dependabot.yml b/bridges/.github/dependabot.yml
deleted file mode 100644
index a06d573703d8..000000000000
--- a/bridges/.github/dependabot.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-version: 2
-updates:
-- package-ecosystem: cargo
- directory: "/"
- schedule:
- interval: weekly
- time: "03:00"
- timezone: Europe/Berlin
- open-pull-requests-limit: 20
- ignore:
- - dependency-name: frame-*
- versions:
- - ">= 0"
- - dependency-name: node-inspect
- versions:
- - ">= 0"
- - dependency-name: pallet-*
- versions:
- - ">= 0"
- - dependency-name: sc-*
- versions:
- - ">= 0"
- - dependency-name: sp-*
- versions:
- - ">= 0"
- - dependency-name: substrate-*
- versions:
- - ">= 0"
- - dependency-name: vergen
- versions:
- - 4.0.1
- - 4.0.2
- - 4.1.0
- - 4.2.0
- - dependency-name: jsonrpc-core
- versions:
- - 17.0.0
- - dependency-name: finality-grandpa
- versions:
- - 0.13.0
- - 0.14.0
- rebase-strategy: disabled
diff --git a/bridges/.gitignore b/bridges/.gitignore
deleted file mode 100644
index 5d10cfa41a44..000000000000
--- a/bridges/.gitignore
+++ /dev/null
@@ -1,26 +0,0 @@
-**/target/
-**/.env
-**/.env2
-**/rust-toolchain
-hfuzz_target
-hfuzz_workspace
-**/Cargo.lock
-
-**/*.rs.bk
-
-*.o
-*.so
-*.rlib
-*.dll
-.gdb_history
-
-*.exe
-
-.DS_Store
-
-.cargo
-.idea
-.vscode
-*.iml
-*.swp
-*.swo
diff --git a/bridges/.gitlab-ci.yml b/bridges/.gitlab-ci.yml
deleted file mode 100644
index 7d3bf6fd8ac2..000000000000
--- a/bridges/.gitlab-ci.yml
+++ /dev/null
@@ -1,298 +0,0 @@
-stages:
- - lint
- - check
- - test
- - build
- - publish
-
-workflow:
- rules:
- - if: $CI_COMMIT_TAG
- - if: $CI_COMMIT_BRANCH
-
-variables: &default-vars
- GIT_STRATEGY: fetch
- GIT_DEPTH: 100
- CARGO_INCREMENTAL: 0
- ARCH: "x86_64"
- CI_IMAGE: "paritytech/bridges-ci:staging"
- RUST_BACKTRACE: full
-
-default:
- cache: {}
-
-.collect-artifacts: &collect-artifacts
- artifacts:
- name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
- when: on_success
- expire_in: 7 days
- paths:
- - artifacts/
-
-.kubernetes-build: &kubernetes-build
- tags:
- - kubernetes-parity-build
- interruptible: true
-
-.docker-env: &docker-env
- image: "${CI_IMAGE}"
- before_script:
- - rustup show
- - cargo --version
- - rustup +nightly show
- - cargo +nightly --version
- - sccache -s
- retry:
- max: 2
- when:
- - runner_system_failure
- - unknown_failure
- - api_failure
- interruptible: true
- tags:
- - linux-docker
-
-.test-refs: &test-refs
- rules:
- # FIXME: This is the cause why pipelines wouldn't start. The problem might be in our custom
- # mirroring. This should be investigated further, but for now let's have the working
- # pipeline.
- # - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH
- # changes:
- # - '**.md'
- # - diagrams/*
- # - docs/*
- # when: never
- - if: $CI_PIPELINE_SOURCE == "pipeline"
- - if: $CI_PIPELINE_SOURCE == "web"
- - if: $CI_PIPELINE_SOURCE == "schedule"
- - if: $CI_COMMIT_REF_NAME == "master"
- - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
-
-.build-refs: &build-refs
- rules:
- # won't run on the CI image update pipeline
- - if: $CI_PIPELINE_SOURCE == "pipeline"
- when: never
- - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]{4}-[0-9]{2}-[0-9]{2}.*$/ # i.e. v2021-09-27, v2021-09-27-1
- # there are two types of nightly pipelines:
- # 1. this one is triggered by the schedule with $PIPELINE == "nightly", it's for releasing.
- # this job runs only on nightly pipeline with the mentioned variable, against `master` branch
- - if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"
-
-.nightly-test: &nightly-test
- rules:
- # 2. another is triggered by scripts repo $CI_PIPELINE_SOURCE == "pipeline" it's for the CI image
- # update, it also runs all the nightly checks.
- - if: $CI_PIPELINE_SOURCE == "pipeline"
-
-#### stage: lint
-
-clippy-nightly:
- stage: lint
- <<: *docker-env
- <<: *test-refs
- script:
- - SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure
-
-fmt:
- stage: lint
- <<: *docker-env
- <<: *test-refs
- script:
- - cargo +nightly fmt --all -- --check
-
-spellcheck:
- stage: lint
- <<: *docker-env
- <<: *test-refs
- script:
- - cargo spellcheck check -vvvv --cfg=.config/spellcheck.toml --checkers hunspell -m 1
-
-#### stage: check
-
-check:
- stage: check
- <<: *docker-env
- <<: *test-refs
- script: &check-script
- - SKIP_WASM_BUILD=1 time cargo check --locked --verbose --workspace
- # Check Rialto benchmarks runtime
- - SKIP_WASM_BUILD=1 time cargo check -p rialto-runtime --locked --features runtime-benchmarks --verbose
- # Check Millau benchmarks runtime
- - SKIP_WASM_BUILD=1 time cargo check -p millau-runtime --locked --features runtime-benchmarks --verbose
-
-check-nightly:
- stage: check
- <<: *docker-env
- <<: *nightly-test
- script:
- - rustup default nightly
- - *check-script
-
-#### stage: test
-
-test:
- stage: test
- <<: *docker-env
- <<: *test-refs
-# variables:
-# RUSTFLAGS: "-D warnings"
- script: &test-script
- - time cargo fetch
- - time cargo fetch --manifest-path=`cargo metadata --format-version=1 | jq --compact-output --raw-output ".packages[] | select(.name == \"polkadot-test-runtime\").manifest_path"`
- - time cargo fetch --manifest-path=`cargo metadata --format-version=1 | jq --compact-output --raw-output ".packages[] | select(.name == \"polkadot-runtime\").manifest_path"`
- - CARGO_NET_OFFLINE=true time cargo test --verbose --workspace
-
-test-nightly:
- stage: test
- <<: *docker-env
- <<: *nightly-test
- script:
- - rustup default nightly
- - *test-script
-
-deny:
- stage: test
- <<: *docker-env
- <<: *nightly-test
- <<: *collect-artifacts
- script:
- - cargo deny check advisories --hide-inclusion-graph
- - cargo deny check bans sources --hide-inclusion-graph
- after_script:
- - mkdir -p ./artifacts
- - echo "___Complete logs can be found in the artifacts___"
- - cargo deny check advisories 2> advisories.log
- - cargo deny check bans sources 2> bans_sources.log
- # this job is allowed to fail, only licenses check is important
- allow_failure: true
-
-deny-licenses:
- stage: test
- <<: *docker-env
- <<: *test-refs
- <<: *collect-artifacts
- script:
- - cargo deny check licenses --hide-inclusion-graph
- after_script:
- - mkdir -p ./artifacts
- - echo "___Complete logs can be found in the artifacts___"
- - cargo deny check licenses 2> licenses.log
-
-#### stage: build
-
-build:
- stage: build
- <<: *docker-env
- <<: *build-refs
- <<: *collect-artifacts
- # master
- script: &build-script
- - time cargo fetch
- - time cargo fetch --manifest-path=`cargo metadata --format-version=1 | jq --compact-output --raw-output ".packages[] | select(.name == \"polkadot-test-runtime\").manifest_path"`
- - time cargo fetch --manifest-path=`cargo metadata --format-version=1 | jq --compact-output --raw-output ".packages[] | select(.name == \"polkadot-runtime\").manifest_path"`
- - CARGO_NET_OFFLINE=true time cargo build --release --verbose --workspace
- after_script:
- # Prepare artifacts
- - mkdir -p ./artifacts
- - strip ./target/release/rialto-bridge-node
- - mv -v ./target/release/rialto-bridge-node ./artifacts/
- - strip ./target/release/rialto-parachain-collator
- - mv -v ./target/release/rialto-parachain-collator ./artifacts/
- - strip ./target/release/millau-bridge-node
- - mv -v ./target/release/millau-bridge-node ./artifacts/
- - strip ./target/release/substrate-relay
- - mv -v ./target/release/substrate-relay ./artifacts/
- - mv -v ./deployments/local-scripts/bridge-entrypoint.sh ./artifacts/
- - mv -v ./ci.Dockerfile ./artifacts/
-
-build-nightly:
- stage: build
- <<: *docker-env
- <<: *collect-artifacts
- <<: *nightly-test
- script:
- - rustup default nightly
- - *build-script
-
-#### stage: publish
-
-.build-push-image: &build-push-image
- <<: *kubernetes-build
- image: quay.io/buildah/stable
- <<: *build-refs
- variables: &image-variables
- GIT_STRATEGY: none
- DOCKERFILE: ci.Dockerfile
- IMAGE_NAME: docker.io/paritytech/$CI_JOB_NAME
- VAULT_SERVER_URL: "https://vault.parity-mgmt-vault.parity.io"
- VAULT_AUTH_PATH: "gitlab-parity-io-jwt"
- VAULT_AUTH_ROLE: "cicd_gitlab_parity_${CI_PROJECT_NAME}"
- needs:
- - job: build
- artifacts: true
- before_script: &check-versions
- - if [[ "${CI_COMMIT_TAG}" ]]; then
- VERSION=${CI_COMMIT_TAG};
- elif [[ "${CI_COMMIT_REF_NAME}" ]]; then
- VERSION=$(echo ${CI_COMMIT_REF_NAME} | sed -r 's#/+#-#g');
- fi
- # When building from version tags (v1.0, v2.1rc1, ...) we'll use "production" to tag
- # docker image. In all other cases, it'll be "latest".
- - if [[ $CI_COMMIT_REF_NAME =~ ^v[0-9]+\.[0-9]+.*$ ]]; then
- FLOATING_TAG="production";
- else
- FLOATING_TAG="latest";
- fi
- - echo "Effective tags = ${VERSION} sha-${CI_COMMIT_SHORT_SHA} ${FLOATING_TAG}"
- secrets:
- DOCKER_HUB_USER:
- vault: cicd/gitlab/parity/DOCKER_HUB_USER@kv
- file: false
- DOCKER_HUB_PASS:
- vault: cicd/gitlab/parity/DOCKER_HUB_PASS@kv
- file: false
- script:
- - test "${DOCKER_HUB_USER}" -a "${DOCKER_HUB_PASS}" ||
- ( echo "no docker credentials provided"; exit 1 )
- - cd ./artifacts
- - buildah bud
- --format=docker
- --build-arg VCS_REF="${CI_COMMIT_SHORT_SHA}"
- --build-arg BUILD_DATE="$(date +%d-%m-%Y)"
- --build-arg PROJECT="${CI_JOB_NAME}"
- --build-arg VERSION="${VERSION}"
- --tag "${IMAGE_NAME}:${VERSION}"
- --tag "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}"
- --tag "${IMAGE_NAME}:${FLOATING_TAG}"
- --file "${DOCKERFILE}" .
- # The job will success only on the protected branch
- - echo "${DOCKER_HUB_PASS}" |
- buildah login --username "${DOCKER_HUB_USER}" --password-stdin docker.io
- - buildah info
- - buildah push --format=v2s2 "${IMAGE_NAME}:${VERSION}"
- - buildah push --format=v2s2 "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}"
- - buildah push --format=v2s2 "${IMAGE_NAME}:${FLOATING_TAG}"
- after_script:
- - env REGISTRY_AUTH_FILE= buildah logout --all
-
-rialto-bridge-node:
- stage: publish
- <<: *build-push-image
-
-rialto-parachain-collator:
- stage: publish
- <<: *build-push-image
-
-millau-bridge-node:
- stage: publish
- <<: *build-push-image
-
-substrate-relay:
- stage: publish
- <<: *build-push-image
-
-# FIXME: publish binaries
diff --git a/bridges/.maintain/millau-weight-template.hbs b/bridges/.maintain/millau-weight-template.hbs
deleted file mode 100644
index 7a2a67627bb2..000000000000
--- a/bridges/.maintain/millau-weight-template.hbs
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Autogenerated weights for `{{pallet}}`
-//!
-//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
-//! DATE: {{date}}, STEPS: {{cmd.steps}}, REPEAT: {{cmd.repeat}}
-//! LOW RANGE: {{cmd.lowest_range_values}}, HIGH RANGE: {{cmd.highest_range_values}}
-//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}
-//! CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}
-
-// Executed Command:
-{{#each args as |arg|~}}
-// {{arg}}
-{{/each}}
-
-#![allow(clippy::all)]
-#![allow(unused_parens)]
-#![allow(unused_imports)]
-
-use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
-use sp_std::marker::PhantomData;
-
-/// Weight functions needed for `{{pallet}}`.
-pub trait WeightInfo {
- {{~#each benchmarks as |benchmark|}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{c.name}}: u32, {{/each~}}
- ) -> Weight;
- {{~/each}}
-}
-
-/// Weights for `{{pallet}}` using the Millau node and recommended hardware.
-pub struct MillauWeight(PhantomData);
-impl WeightInfo for MillauWeight {
- {{~#each benchmarks as |benchmark|}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
- ) -> Weight {
- ({{underscore benchmark.base_weight}} as Weight)
- {{~#each benchmark.component_weight as |cw|}}
- .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
- {{~/each}}
- {{~#if (ne benchmark.base_reads "0")}}
- .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
- {{~/if}}
- {{~#each benchmark.component_reads as |cr|}}
- .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
- {{~/each}}
- {{~#if (ne benchmark.base_writes "0")}}
- .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
- {{~/if}}
- {{~#each benchmark.component_writes as |cw|}}
- .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
- {{~/each}}
- }
- {{~/each}}
-}
-
-// For backwards compatibility and tests
-impl WeightInfo for () {
- {{~#each benchmarks as |benchmark|}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
- ) -> Weight {
- ({{underscore benchmark.base_weight}} as Weight)
- {{~#each benchmark.component_weight as |cw|}}
- .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
- {{~/each}}
- {{~#if (ne benchmark.base_reads "0")}}
- .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
- {{~/if}}
- {{~#each benchmark.component_reads as |cr|}}
- .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
- {{~/each}}
- {{~#if (ne benchmark.base_writes "0")}}
- .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
- {{~/if}}
- {{~#each benchmark.component_writes as |cw|}}
- .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
- {{~/each}}
- }
- {{~/each}}
-}
diff --git a/bridges/CODEOWNERS b/bridges/CODEOWNERS
deleted file mode 100644
index 3941ba8451a1..000000000000
--- a/bridges/CODEOWNERS
+++ /dev/null
@@ -1,21 +0,0 @@
-# Lists some code owners.
-#
-# A codeowner just oversees some part of the codebase. If an owned file is changed then the
-# corresponding codeowner receives a review request. An approval of the codeowner might be
-# required for merging a PR (depends on repository settings).
-#
-# For details about syntax, see:
-# https://help.github.com/en/articles/about-code-owners
-# But here are some important notes:
-#
-# - Glob syntax is git-like, e.g. `/core` means the core directory in the root, unlike `core`
-# which can be everywhere.
-# - Multiple owners are supported.
-# - Either handle (e.g, @github_user or @github_org/team) or email can be used. Keep in mind,
-# that handles might work better because they are more recognizable on GitHub,
-# eyou can use them for mentioning unlike an email.
-# - The latest matching rule, if multiple, takes precedence.
-
-# CI
-/.github/ @paritytech/ci
-/.gitlab-ci.yml @paritytech/ci
diff --git a/bridges/CODE_OF_CONDUCT.md b/bridges/CODE_OF_CONDUCT.md
deleted file mode 100644
index 70541fb72fa2..000000000000
--- a/bridges/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# 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 admin@parity.io. 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
diff --git a/bridges/Dockerfile b/bridges/Dockerfile
deleted file mode 100644
index bc51f76ba99b..000000000000
--- a/bridges/Dockerfile
+++ /dev/null
@@ -1,71 +0,0 @@
-# Builds images used by the bridge.
-#
-# In particular, it can be used to build Substrate nodes and bridge relayers. The binary that gets
-# built can be specified with the `PROJECT` build-arg. For example, to build the `substrate-relay`
-# you would do the following:
-#
-# `docker build . -t local/substrate-relay --build-arg=PROJECT=substrate-relay`
-#
-# See the `deployments/README.md` for all the available `PROJECT` values.
-
-FROM docker.io/paritytech/bridges-ci:latest as builder
-WORKDIR /parity-bridges-common
-
-COPY . .
-
-ARG PROJECT=substrate-relay
-RUN cargo build --release --verbose -p ${PROJECT} && \
- strip ./target/release/${PROJECT}
-
-# In this final stage we copy over the final binary and do some checks
-# to make sure that everything looks good.
-FROM docker.io/library/ubuntu:20.04 as runtime
-
-# show backtraces
-ENV RUST_BACKTRACE 1
-ENV DEBIAN_FRONTEND=noninteractive
-
-RUN set -eux; \
- apt-get update && \
- apt-get install -y --no-install-recommends \
- curl ca-certificates libssl-dev && \
- update-ca-certificates && \
- groupadd -g 1000 user && \
- useradd -u 1000 -g user -s /bin/sh -m user && \
- # apt clean up
- apt-get autoremove -y && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists/*
-
-# switch to non-root user
-USER user
-
-WORKDIR /home/user
-
-ARG PROJECT=substrate-relay
-
-COPY --chown=user:user --from=builder /parity-bridges-common/target/release/${PROJECT} ./
-COPY --chown=user:user --from=builder /parity-bridges-common/deployments/local-scripts/bridge-entrypoint.sh ./
-
-# check if executable works in this container
-RUN ./${PROJECT} --version
-
-ENV PROJECT=$PROJECT
-ENTRYPOINT ["/home/user/bridge-entrypoint.sh"]
-
-# metadata
-ARG VCS_REF=master
-ARG BUILD_DATE=""
-ARG VERSION=""
-
-LABEL org.opencontainers.image.title="${PROJECT}" \
- org.opencontainers.image.description="${PROJECT} - component of Parity Bridges Common" \
- org.opencontainers.image.source="https://github.com/paritytech/parity-bridges-common/blob/${VCS_REF}/Dockerfile" \
- org.opencontainers.image.url="https://github.com/paritytech/parity-bridges-common/blob/${VCS_REF}/Dockerfile" \
- org.opencontainers.image.documentation="https://github.com/paritytech/parity-bridges-common/blob/${VCS_REF}/README.md" \
- org.opencontainers.image.created="${BUILD_DATE}" \
- org.opencontainers.image.version="${VERSION}" \
- org.opencontainers.image.revision="${VCS_REF}" \
- org.opencontainers.image.authors="devops-team@parity.io" \
- org.opencontainers.image.vendor="Parity Technologies" \
- org.opencontainers.image.licenses="GPL-3.0 License"
diff --git a/bridges/LICENSE b/bridges/LICENSE
deleted file mode 100644
index 733c072369ca..000000000000
--- a/bridges/LICENSE
+++ /dev/null
@@ -1,675 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- {one line to give the program's name and a brief idea of what it does.}
- Copyright (C) {year} {name of author}
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- {project} Copyright (C) {year} {fullname}
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
-
diff --git a/bridges/README.md b/bridges/README.md
deleted file mode 100644
index ac3e49b94c6a..000000000000
--- a/bridges/README.md
+++ /dev/null
@@ -1,247 +0,0 @@
-# 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/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)
-│ ├── 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.
diff --git a/bridges/bin/.keep b/bridges/bin/.keep
deleted file mode 100644
index e69de29bb2d1..000000000000
diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml
deleted file mode 100644
index 3825b92b703c..000000000000
--- a/bridges/bin/millau/node/Cargo.toml
+++ /dev/null
@@ -1,63 +0,0 @@
-[package]
-name = "millau-bridge-node"
-description = "Substrate node compatible with Millau runtime"
-version = "0.1.0"
-authors = ["Parity Technologies "]
-edition = "2021"
-build = "build.rs"
-homepage = "https://substrate.dev"
-repository = "https://github.com/paritytech/parity-bridges-common/"
-license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
-
-[dependencies]
-clap = { version = "3.1", features = ["derive"] }
-jsonrpc-core = "18.0"
-serde_json = "1.0.59"
-
-# Bridge dependencies
-
-bp-millau = { path = "../../../primitives/chain-millau" }
-bp-runtime = { path = "../../../primitives/runtime" }
-millau-runtime = { path = "../runtime" }
-pallet-bridge-messages = { path = "../../../modules/messages" }
-
-# Substrate Dependencies
-
-beefy-gadget = { git = "https://github.com/paritytech/substrate", branch = "master" }
-beefy-gadget-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
-frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
-frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
-node-inspect = { git = "https://github.com/paritytech/substrate", branch = "master" }
-pallet-mmr-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["wasmtime"] }
-sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
-substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-[build-dependencies]
-substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
-frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-[features]
-default = []
-runtime-benchmarks = [
- "millau-runtime/runtime-benchmarks",
-]
diff --git a/bridges/bin/millau/node/build.rs b/bridges/bin/millau/node/build.rs
deleted file mode 100644
index d9b50049e262..000000000000
--- a/bridges/bin/millau/node/build.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
-
-fn main() {
- generate_cargo_keys();
-
- rerun_if_git_head_changed();
-}
diff --git a/bridges/bin/millau/node/src/chain_spec.rs b/bridges/bin/millau/node/src/chain_spec.rs
deleted file mode 100644
index a7e3c7c87718..000000000000
--- a/bridges/bin/millau/node/src/chain_spec.rs
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use beefy_primitives::crypto::AuthorityId as BeefyId;
-use bp_millau::derive_account_from_rialto_id;
-use millau_runtime::{
- AccountId, AuraConfig, BalancesConfig, BeefyConfig, BridgeRialtoMessagesConfig,
- BridgeWestendGrandpaConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys,
- Signature, SudoConfig, SystemConfig, WASM_BINARY,
-};
-use sp_consensus_aura::sr25519::AuthorityId as AuraId;
-use sp_core::{sr25519, Pair, Public};
-use sp_finality_grandpa::AuthorityId as GrandpaId;
-use sp_runtime::traits::{IdentifyAccount, Verify};
-
-/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
-pub type ChainSpec = sc_service::GenericChainSpec;
-
-/// The chain specification option. This is expected to come in from the CLI and
-/// is little more than one of a number of alternatives which can easily be converted
-/// from a string (`--chain=...`) into a `ChainSpec`.
-#[derive(Clone, Debug)]
-pub enum Alternative {
- /// Whatever the current runtime is, with just Alice as an auth.
- Development,
- /// Whatever the current runtime is, with simple Alice/Bob/Charlie/Dave/Eve auths.
- LocalTestnet,
-}
-
-/// Helper function to generate a crypto pair from seed
-pub fn get_from_seed(seed: &str) -> ::Public {
- TPublic::Pair::from_string(&format!("//{}", seed), None)
- .expect("static values are valid; qed")
- .public()
-}
-
-type AccountPublic = ::Signer;
-
-/// Helper function to generate an account ID from seed
-pub fn get_account_id_from_seed(seed: &str) -> AccountId
-where
- AccountPublic: From<::Public>,
-{
- AccountPublic::from(get_from_seed::(seed)).into_account()
-}
-
-/// Helper function to generate an authority key for Aura
-pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, BeefyId, GrandpaId) {
- (
- get_account_id_from_seed::(s),
- get_from_seed::(s),
- get_from_seed::(s),
- get_from_seed::(s),
- )
-}
-
-impl Alternative {
- /// Get an actual chain config from one of the alternatives.
- pub(crate) fn load(self) -> ChainSpec {
- let properties = Some(
- serde_json::json!({
- "tokenDecimals": 9,
- "tokenSymbol": "MLAU"
- })
- .as_object()
- .expect("Map given; qed")
- .clone(),
- );
- match self {
- Alternative::Development => ChainSpec::from_genesis(
- "Millau Development",
- "millau_dev",
- sc_service::ChainType::Development,
- || {
- testnet_genesis(
- vec![get_authority_keys_from_seed("Alice")],
- get_account_id_from_seed::("Alice"),
- endowed_accounts(),
- true,
- )
- },
- vec![],
- None,
- None,
- None,
- properties,
- None,
- ),
- Alternative::LocalTestnet => ChainSpec::from_genesis(
- "Millau Local",
- "millau_local",
- sc_service::ChainType::Local,
- || {
- testnet_genesis(
- vec![
- get_authority_keys_from_seed("Alice"),
- get_authority_keys_from_seed("Bob"),
- get_authority_keys_from_seed("Charlie"),
- get_authority_keys_from_seed("Dave"),
- get_authority_keys_from_seed("Eve"),
- ],
- get_account_id_from_seed::("Alice"),
- endowed_accounts(),
- true,
- )
- },
- vec![],
- None,
- None,
- None,
- properties,
- None,
- ),
- }
- }
-}
-
-/// We're using the same set of endowed accounts on all Millau chains (dev/local) to make
-/// sure that all accounts, required for bridge to be functional (e.g. relayers fund account,
-/// accounts used by relayers in our test deployments, accounts used for demonstration
-/// purposes), are all available on these chains.
-fn endowed_accounts() -> Vec {
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Charlie"),
- get_account_id_from_seed::("Dave"),
- get_account_id_from_seed::("Eve"),
- get_account_id_from_seed::("Ferdie"),
- get_account_id_from_seed::("George"),
- get_account_id_from_seed::("Harry"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- get_account_id_from_seed::("Charlie//stash"),
- get_account_id_from_seed::("Dave//stash"),
- get_account_id_from_seed::("Eve//stash"),
- get_account_id_from_seed::("Ferdie//stash"),
- get_account_id_from_seed::("George//stash"),
- get_account_id_from_seed::("Harry//stash"),
- get_account_id_from_seed::("RialtoMessagesOwner"),
- get_account_id_from_seed::("WithRialtoTokenSwap"),
- pallet_bridge_messages::relayer_fund_account_id::<
- bp_millau::AccountId,
- bp_millau::AccountIdConverter,
- >(),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Alice"),
- )),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Bob"),
- )),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Charlie"),
- )),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Dave"),
- )),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Eve"),
- )),
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
- get_account_id_from_seed::("Ferdie"),
- )),
- ]
-}
-
-fn session_keys(aura: AuraId, beefy: BeefyId, grandpa: GrandpaId) -> SessionKeys {
- SessionKeys { aura, beefy, grandpa }
-}
-
-fn testnet_genesis(
- initial_authorities: Vec<(AccountId, AuraId, BeefyId, GrandpaId)>,
- root_key: AccountId,
- endowed_accounts: Vec,
- _enable_println: bool,
-) -> GenesisConfig {
- GenesisConfig {
- system: SystemConfig {
- code: WASM_BINARY.expect("Millau development WASM not available").to_vec(),
- },
- balances: BalancesConfig {
- balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
- },
- aura: AuraConfig { authorities: Vec::new() },
- beefy: BeefyConfig { authorities: Vec::new() },
- grandpa: GrandpaConfig { authorities: Vec::new() },
- sudo: SudoConfig { key: Some(root_key) },
- session: SessionConfig {
- keys: initial_authorities
- .iter()
- .map(|x| {
- (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone(), x.3.clone()))
- })
- .collect::>(),
- },
- bridge_westend_grandpa: BridgeWestendGrandpaConfig {
- // for our deployments to avoid multiple same-nonces transactions:
- // //Alice is already used to initialize Rialto<->Millau bridge
- // => let's use //George to initialize Westend->Millau bridge
- owner: Some(get_account_id_from_seed::("George")),
- ..Default::default()
- },
- bridge_rialto_messages: BridgeRialtoMessagesConfig {
- owner: Some(get_account_id_from_seed::("RialtoMessagesOwner")),
- ..Default::default()
- },
- }
-}
-
-#[test]
-fn derived_dave_account_is_as_expected() {
- let dave = get_account_id_from_seed::("Dave");
- let derived: AccountId =
- derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(dave));
- assert_eq!(derived.to_string(), "5DNW6UVnb7TN6wX5KwXtDYR3Eccecbdzuw89HqjyNfkzce6J".to_string());
-}
diff --git a/bridges/bin/millau/node/src/cli.rs b/bridges/bin/millau/node/src/cli.rs
deleted file mode 100644
index c3c3d134e341..000000000000
--- a/bridges/bin/millau/node/src/cli.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use clap::Parser;
-use sc_cli::RunCmd;
-
-#[derive(Debug, Parser)]
-pub struct Cli {
- #[structopt(subcommand)]
- pub subcommand: Option,
-
- #[structopt(flatten)]
- pub run: RunCmd,
-}
-
-/// Possible subcommands of the main binary.
-#[derive(Debug, Parser)]
-pub enum Subcommand {
- /// Key management CLI utilities
- #[clap(subcommand)]
- Key(sc_cli::KeySubcommand),
-
- /// Verify a signature for a message, provided on `STDIN`, with a given (public or secret) key.
- Verify(sc_cli::VerifyCmd),
-
- /// Generate a seed that provides a vanity address.
- Vanity(sc_cli::VanityCmd),
-
- /// Sign a message, with a given (secret) key.
- Sign(sc_cli::SignCmd),
-
- /// Build a chain specification.
- BuildSpec(sc_cli::BuildSpecCmd),
-
- /// Validate blocks.
- CheckBlock(sc_cli::CheckBlockCmd),
-
- /// Export blocks.
- ExportBlocks(sc_cli::ExportBlocksCmd),
-
- /// Export the state of a given block into a chain spec.
- ExportState(sc_cli::ExportStateCmd),
-
- /// Import blocks.
- ImportBlocks(sc_cli::ImportBlocksCmd),
-
- /// Remove the whole chain.
- PurgeChain(sc_cli::PurgeChainCmd),
-
- /// Revert the chain to a previous state.
- Revert(sc_cli::RevertCmd),
-
- /// Inspect blocks or extrinsics.
- Inspect(node_inspect::cli::InspectCmd),
-
- /// Benchmark runtime pallets.
- Benchmark(frame_benchmarking_cli::BenchmarkCmd),
-}
diff --git a/bridges/bin/millau/node/src/command.rs b/bridges/bin/millau/node/src/command.rs
deleted file mode 100644
index 4dbf9575dfec..000000000000
--- a/bridges/bin/millau/node/src/command.rs
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use crate::{
- cli::{Cli, Subcommand},
- service,
- service::new_partial,
-};
-use millau_runtime::{Block, RuntimeApi};
-use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
-use sc_service::PartialComponents;
-
-impl SubstrateCli for Cli {
- fn impl_name() -> String {
- "Millau Bridge Node".into()
- }
-
- fn impl_version() -> String {
- env!("CARGO_PKG_VERSION").into()
- }
-
- fn description() -> String {
- "Millau Bridge Node".into()
- }
-
- fn author() -> String {
- "Parity Technologies".into()
- }
-
- fn support_url() -> String {
- "https://github.com/paritytech/parity-bridges-common/".into()
- }
-
- fn copyright_start_year() -> i32 {
- 2019
- }
-
- fn executable_name() -> String {
- "millau-bridge-node".into()
- }
-
- fn native_runtime_version(_: &Box) -> &'static RuntimeVersion {
- &millau_runtime::VERSION
- }
-
- fn load_spec(&self, id: &str) -> Result, String> {
- Ok(Box::new(
- match id {
- "" | "dev" => crate::chain_spec::Alternative::Development,
- "local" => crate::chain_spec::Alternative::LocalTestnet,
- _ => return Err(format!("Unsupported chain specification: {}", id)),
- }
- .load(),
- ))
- }
-}
-
-/// Parse and run command line arguments
-pub fn run() -> sc_cli::Result<()> {
- let cli = Cli::from_args();
- // make sure to set correct crypto version.
- sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::custom(
- millau_runtime::SS58Prefix::get() as u16,
- ));
-
- match &cli.subcommand {
- Some(Subcommand::Benchmark(cmd)) =>
- if cfg!(feature = "runtime-benchmarks") {
- let runner = cli.create_runner(cmd)?;
-
- runner.sync_run(|config| cmd.run::(config))
- } else {
- println!(
- "Benchmarking wasn't enabled when building the node. \
- You can enable it with `--features runtime-benchmarks`."
- );
- Ok(())
- },
- Some(Subcommand::Key(cmd)) => cmd.run(&cli),
- Some(Subcommand::Sign(cmd)) => cmd.run(),
- Some(Subcommand::Verify(cmd)) => cmd.run(),
- Some(Subcommand::Vanity(cmd)) => cmd.run(),
- Some(Subcommand::BuildSpec(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
- },
- Some(Subcommand::CheckBlock(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.async_run(|config| {
- let PartialComponents { client, task_manager, import_queue, .. } =
- new_partial(&config)?;
- Ok((cmd.run(client, import_queue), task_manager))
- })
- },
- Some(Subcommand::ExportBlocks(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.async_run(|config| {
- let PartialComponents { client, task_manager, .. } = new_partial(&config)?;
- Ok((cmd.run(client, config.database), task_manager))
- })
- },
- Some(Subcommand::ExportState(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.async_run(|config| {
- let PartialComponents { client, task_manager, .. } = new_partial(&config)?;
- Ok((cmd.run(client, config.chain_spec), task_manager))
- })
- },
- Some(Subcommand::ImportBlocks(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.async_run(|config| {
- let PartialComponents { client, task_manager, import_queue, .. } =
- new_partial(&config)?;
- Ok((cmd.run(client, import_queue), task_manager))
- })
- },
- Some(Subcommand::PurgeChain(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.sync_run(|config| cmd.run(config.database))
- },
- Some(Subcommand::Revert(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.async_run(|config| {
- let PartialComponents { client, task_manager, backend, .. } = new_partial(&config)?;
- Ok((cmd.run(client, backend), task_manager))
- })
- },
- Some(Subcommand::Inspect(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner
- .sync_run(|config| cmd.run::(config))
- },
- None => {
- let runner = cli.create_runner(&cli.run)?;
- runner.run_node_until_exit(|config| async move {
- service::new_full(config).map_err(sc_cli::Error::Service)
- })
- },
- }
-}
diff --git a/bridges/bin/millau/node/src/lib.rs b/bridges/bin/millau/node/src/lib.rs
deleted file mode 100644
index 382d1c2d7fb1..000000000000
--- a/bridges/bin/millau/node/src/lib.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Substrate Node Template CLI library.
-#![warn(missing_docs)]
-
-mod chain_spec;
-#[macro_use]
-mod service;
-mod cli;
-mod command;
-
-/// Node run result.
-pub type Result = sc_cli::Result<()>;
-
-/// Run node.
-pub fn run() -> Result {
- command::run()
-}
diff --git a/bridges/bin/millau/node/src/main.rs b/bridges/bin/millau/node/src/main.rs
deleted file mode 100644
index cf6dd9f733a1..000000000000
--- a/bridges/bin/millau/node/src/main.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Millau bridge node.
-
-#![warn(missing_docs)]
-
-mod chain_spec;
-#[macro_use]
-mod service;
-mod cli;
-mod command;
-
-/// Run the Millau Node
-fn main() -> sc_cli::Result<()> {
- command::run()
-}
diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs
deleted file mode 100644
index 15f88269aa9c..000000000000
--- a/bridges/bin/millau/node/src/service.rs
+++ /dev/null
@@ -1,453 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
-
-// =====================================================================================
-// =====================================================================================
-// =====================================================================================
-// UPDATE GUIDE:
-// 1) replace everything with node-template/src/service.rs contents (found in main Substrate repo);
-// 2) from old code keep `rpc_extensions_builder` - we use our own custom RPCs;
-// 3) from old code keep the Beefy gadget;
-// 4) fix compilation errors;
-// 5) test :)
-// =====================================================================================
-// =====================================================================================
-// =====================================================================================
-
-use millau_runtime::{self, opaque::Block, RuntimeApi};
-use sc_client_api::{BlockBackend, ExecutorProvider};
-use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
-pub use sc_executor::NativeElseWasmExecutor;
-use sc_finality_grandpa::SharedVoterState;
-use sc_keystore::LocalKeystore;
-use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
-use sc_telemetry::{Telemetry, TelemetryWorker};
-use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
-use std::{sync::Arc, time::Duration};
-
-// Our native executor instance.
-pub struct ExecutorDispatch;
-
-impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
- /// Only enable the benchmarking host functions when we actually want to benchmark.
- #[cfg(feature = "runtime-benchmarks")]
- type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
- /// Otherwise we only use the default Substrate host functions.
- #[cfg(not(feature = "runtime-benchmarks"))]
- type ExtendHostFunctions = ();
-
- fn dispatch(method: &str, data: &[u8]) -> Option> {
- millau_runtime::api::dispatch(method, data)
- }
-
- fn native_version() -> sc_executor::NativeVersion {
- millau_runtime::native_version()
- }
-}
-
-type FullClient =
- sc_service::TFullClient>;
-type FullBackend = sc_service::TFullBackend;
-type FullSelectChain = sc_consensus::LongestChain;
-
-#[allow(clippy::type_complexity)]
-pub fn new_partial(
- config: &Configuration,
-) -> Result<
- sc_service::PartialComponents<
- FullClient,
- FullBackend,
- FullSelectChain,
- sc_consensus::DefaultImportQueue,
- sc_transaction_pool::FullPool,
- (
- sc_finality_grandpa::GrandpaBlockImport<
- FullBackend,
- Block,
- FullClient,
- FullSelectChain,
- >,
- sc_finality_grandpa::LinkHalf,
- Option,
- ),
- >,
- ServiceError,
-> {
- if config.keystore_remote.is_some() {
- return Err(ServiceError::Other("Remote Keystores are not supported.".into()))
- }
-
- let telemetry = config
- .telemetry_endpoints
- .clone()
- .filter(|x| !x.is_empty())
- .map(|endpoints| -> Result<_, sc_telemetry::Error> {
- let worker = TelemetryWorker::new(16)?;
- let telemetry = worker.handle().new_telemetry(endpoints);
- Ok((worker, telemetry))
- })
- .transpose()?;
-
- let executor = NativeElseWasmExecutor::::new(
- config.wasm_method,
- config.default_heap_pages,
- config.max_runtime_instances,
- config.runtime_cache_size,
- );
-
- let (client, backend, keystore_container, task_manager) =
- sc_service::new_full_parts::(
- config,
- telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
- executor,
- )?;
- let client = Arc::new(client);
-
- let telemetry = telemetry.map(|(worker, telemetry)| {
- task_manager.spawn_handle().spawn("telemetry", None, worker.run());
- telemetry
- });
-
- let select_chain = sc_consensus::LongestChain::new(backend.clone());
-
- let transaction_pool = sc_transaction_pool::BasicPool::new_full(
- config.transaction_pool.clone(),
- config.role.is_authority().into(),
- config.prometheus_registry(),
- task_manager.spawn_essential_handle(),
- client.clone(),
- );
-
- let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
- client.clone(),
- &(client.clone() as Arc<_>),
- select_chain.clone(),
- telemetry.as_ref().map(|x| x.handle()),
- )?;
-
- let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
-
- let import_queue =
- sc_consensus_aura::import_queue::(ImportQueueParams {
- block_import: grandpa_block_import.clone(),
- justification_import: Some(Box::new(grandpa_block_import.clone())),
- client: client.clone(),
- create_inherent_data_providers: move |_, ()| async move {
- let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
-
- let slot =
- sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
- *timestamp,
- slot_duration,
- );
-
- Ok((timestamp, slot))
- },
- spawner: &task_manager.spawn_essential_handle(),
- can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(
- client.executor().clone(),
- ),
- registry: config.prometheus_registry(),
- check_for_equivocation: Default::default(),
- telemetry: telemetry.as_ref().map(|x| x.handle()),
- })?;
-
- Ok(sc_service::PartialComponents {
- client,
- backend,
- task_manager,
- import_queue,
- keystore_container,
- select_chain,
- transaction_pool,
- other: (grandpa_block_import, grandpa_link, telemetry),
- })
-}
-
-fn remote_keystore(_url: &str) -> Result, &'static str> {
- // FIXME: here would the concrete keystore be built,
- // must return a concrete type (NOT `LocalKeystore`) that
- // implements `CryptoStore` and `SyncCryptoStore`
- Err("Remote Keystore not supported.")
-}
-
-/// Builds a new service for a full client.
-pub fn new_full(mut config: Configuration) -> Result {
- let sc_service::PartialComponents {
- client,
- backend,
- mut task_manager,
- import_queue,
- mut keystore_container,
- select_chain,
- transaction_pool,
- other: (block_import, grandpa_link, mut telemetry),
- } = new_partial(&config)?;
-
- if let Some(url) = &config.keystore_remote {
- match remote_keystore(url) {
- Ok(k) => keystore_container.set_remote_keystore(k),
- Err(e) =>
- return Err(ServiceError::Other(format!(
- "Error hooking up remote keystore for {}: {}",
- url, e
- ))),
- };
- }
-
- // Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change
- // anything in terms of behaviour, but makes the logs more consistent with the other
- // Substrate nodes.
- let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name(
- &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
- &config.chain_spec,
- );
- config
- .network
- .extra_sets
- .push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
-
- let beefy_protocol_name = beefy_gadget::protocol_standard_name(
- &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
- &config.chain_spec,
- );
- config
- .network
- .extra_sets
- .push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone()));
-
- let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
- backend.clone(),
- grandpa_link.shared_authority_set().clone(),
- Vec::default(),
- ));
-
- let (network, system_rpc_tx, network_starter) =
- sc_service::build_network(sc_service::BuildNetworkParams {
- config: &config,
- client: client.clone(),
- transaction_pool: transaction_pool.clone(),
- spawn_handle: task_manager.spawn_handle(),
- import_queue,
- block_announce_validator_builder: None,
- warp_sync: Some(warp_sync),
- })?;
-
- if config.offchain_worker.enabled {
- sc_service::build_offchain_workers(
- &config,
- task_manager.spawn_handle(),
- client.clone(),
- network.clone(),
- );
- }
-
- let role = config.role.clone();
- let force_authoring = config.force_authoring;
- let backoff_authoring_blocks: Option<()> = None;
- let name = config.network.node_name.clone();
- let enable_grandpa = !config.disable_grandpa;
- let prometheus_registry = config.prometheus_registry().cloned();
- let shared_voter_state = SharedVoterState::empty();
- let (beefy_commitment_link, beefy_commitment_stream) =
- beefy_gadget::notification::BeefySignedCommitmentStream::::channel();
- let (beefy_best_block_link, beefy_best_block_stream) =
- beefy_gadget::notification::BeefyBestBlockStream::::channel();
-
- let rpc_extensions_builder = {
- use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
-
- use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
- use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
- use sc_rpc::DenyUnsafe;
- use substrate_frame_rpc_system::{FullSystem, SystemApi};
-
- let backend = backend.clone();
- let client = client.clone();
- let pool = transaction_pool.clone();
-
- let justification_stream = grandpa_link.justification_stream();
- let shared_authority_set = grandpa_link.shared_authority_set().clone();
- let shared_voter_state = shared_voter_state.clone();
-
- let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(
- backend,
- Some(shared_authority_set.clone()),
- );
-
- Box::new(move |_, subscription_executor: sc_rpc::SubscriptionTaskExecutor| {
- let mut io = jsonrpc_core::IoHandler::default();
- io.extend_with(SystemApi::to_delegate(FullSystem::new(
- client.clone(),
- pool.clone(),
- DenyUnsafe::No,
- )));
- io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(
- client.clone(),
- )));
- io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
- shared_authority_set.clone(),
- shared_voter_state.clone(),
- justification_stream.clone(),
- subscription_executor.clone(),
- finality_proof_provider.clone(),
- )));
- io.extend_with(beefy_gadget_rpc::BeefyApi::to_delegate(
- beefy_gadget_rpc::BeefyRpcHandler::::new(
- beefy_commitment_stream.clone(),
- beefy_best_block_stream.clone(),
- subscription_executor,
- )
- .map_err(|e| sc_service::Error::Other(format!("{}", e)))?,
- ));
- io.extend_with(pallet_mmr_rpc::MmrApi::to_delegate(pallet_mmr_rpc::Mmr::new(
- client.clone(),
- )));
- Ok(io)
- })
- };
-
- let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
- network: network.clone(),
- client: client.clone(),
- keystore: keystore_container.sync_keystore(),
- task_manager: &mut task_manager,
- transaction_pool: transaction_pool.clone(),
- rpc_extensions_builder,
- backend: backend.clone(),
- system_rpc_tx,
- config,
- telemetry: telemetry.as_mut(),
- })?;
-
- if role.is_authority() {
- let proposer_factory = sc_basic_authorship::ProposerFactory::new(
- task_manager.spawn_handle(),
- client.clone(),
- transaction_pool,
- prometheus_registry.as_ref(),
- telemetry.as_ref().map(|x| x.handle()),
- );
-
- let can_author_with =
- sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
-
- let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
-
- let aura = sc_consensus_aura::start_aura::(
- StartAuraParams {
- slot_duration,
- client: client.clone(),
- select_chain,
- block_import,
- proposer_factory,
- create_inherent_data_providers: move |_, ()| async move {
- let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
-
- let slot =
- sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
- *timestamp,
- slot_duration,
- );
-
- Ok((timestamp, slot))
- },
- force_authoring,
- backoff_authoring_blocks,
- keystore: keystore_container.sync_keystore(),
- can_author_with,
- sync_oracle: network.clone(),
- justification_sync_link: network.clone(),
- block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32),
- max_block_proposal_slot_portion: None,
- telemetry: telemetry.as_ref().map(|x| x.handle()),
- },
- )?;
-
- // the AURA authoring task is considered essential, i.e. if it
- // fails we take down the service with it.
- task_manager
- .spawn_essential_handle()
- .spawn_blocking("aura", Some("block-authoring"), aura);
- }
-
- // if the node isn't actively participating in consensus then it doesn't
- // need a keystore, regardless of which protocol we use below.
- let keystore =
- if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
-
- let beefy_params = beefy_gadget::BeefyParams {
- client,
- backend,
- key_store: keystore.clone(),
- network: network.clone(),
- signed_commitment_sender: beefy_commitment_link,
- beefy_best_block_sender: beefy_best_block_link,
- min_block_delta: 4,
- prometheus_registry: prometheus_registry.clone(),
- protocol_name: beefy_protocol_name,
- };
-
- // Start the BEEFY bridge gadget.
- task_manager.spawn_essential_handle().spawn_blocking(
- "beefy-gadget",
- None,
- beefy_gadget::start_beefy_gadget::<_, _, _, _>(beefy_params),
- );
-
- let grandpa_config = sc_finality_grandpa::Config {
- // FIXME #1578 make this available through chainspec
- gossip_duration: Duration::from_millis(333),
- justification_period: 512,
- name: Some(name),
- observer_enabled: false,
- keystore,
- local_role: role,
- telemetry: telemetry.as_ref().map(|x| x.handle()),
- protocol_name: grandpa_protocol_name,
- };
-
- if enable_grandpa {
- // start the full GRANDPA voter
- // NOTE: non-authorities could run the GRANDPA observer protocol, but at
- // this point the full voter should provide better guarantees of block
- // and vote data availability than the observer. The observer has not
- // been tested extensively yet and having most nodes in a network run it
- // could lead to finality stalls.
- let grandpa_config = sc_finality_grandpa::GrandpaParams {
- config: grandpa_config,
- link: grandpa_link,
- network,
- voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
- prometheus_registry,
- shared_voter_state,
- telemetry: telemetry.as_ref().map(|x| x.handle()),
- };
-
- // the GRANDPA voter task is considered infallible, i.e.
- // if it fails we take down the service with it.
- task_manager.spawn_essential_handle().spawn_blocking(
- "grandpa-voter",
- None,
- sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
- );
- }
-
- network_starter.start_network();
- Ok(task_manager)
-}
diff --git a/bridges/bin/millau/runtime/Cargo.toml b/bridges/bin/millau/runtime/Cargo.toml
deleted file mode 100644
index 979417c4cc82..000000000000
--- a/bridges/bin/millau/runtime/Cargo.toml
+++ /dev/null
@@ -1,135 +0,0 @@
-[package]
-name = "millau-runtime"
-version = "0.1.0"
-authors = ["Parity Technologies "]
-edition = "2021"
-homepage = "https://substrate.dev"
-repository = "https://github.com/paritytech/parity-bridges-common/"
-license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
-
-[dependencies]
-hex-literal = "0.3"
-codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
-libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
-scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
-serde = { version = "1.0", optional = true, features = ["derive"] }
-
-# Bridge dependencies
-
-bp-header-chain = { path = "../../../primitives/header-chain", default-features = false }
-bp-message-dispatch = { path = "../../../primitives/message-dispatch", default-features = false }
-bp-messages = { path = "../../../primitives/messages", default-features = false }
-bp-millau = { path = "../../../primitives/chain-millau", default-features = false }
-bp-rialto = { path = "../../../primitives/chain-rialto", default-features = false }
-bp-runtime = { path = "../../../primitives/runtime", default-features = false }
-bp-westend = { path = "../../../primitives/chain-westend", default-features = false }
-bridge-runtime-common = { path = "../../runtime-common", default-features = false }
-pallet-bridge-dispatch = { path = "../../../modules/dispatch", default-features = false }
-pallet-bridge-grandpa = { path = "../../../modules/grandpa", default-features = false }
-pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
-pallet-bridge-token-swap = { path = "../../../modules/token-swap", default-features = false }
-pallet-shift-session-manager = { path = "../../../modules/shift-session-manager", default-features = false }
-
-# Substrate Dependencies
-
-beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
-frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
-
-[dev-dependencies]
-bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test"] }
-static_assertions = "1.1"
-
-[build-dependencies]
-substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-[features]
-default = ["std"]
-std = [
- "beefy-primitives/std",
- "bp-header-chain/std",
- "bp-message-dispatch/std",
- "bp-messages/std",
- "bp-millau/std",
- "bp-rialto/std",
- "bp-runtime/std",
- "bp-westend/std",
- "bridge-runtime-common/std",
- "codec/std",
- "frame-executive/std",
- "frame-support/std",
- "frame-system-rpc-runtime-api/std",
- "frame-system/std",
- "pallet-aura/std",
- "pallet-balances/std",
- "pallet-beefy/std",
- "pallet-beefy-mmr/std",
- "pallet-bridge-dispatch/std",
- "pallet-bridge-grandpa/std",
- "pallet-bridge-messages/std",
- "pallet-bridge-token-swap/std",
- "pallet-grandpa/std",
- "pallet-mmr/std",
- "pallet-randomness-collective-flip/std",
- "pallet-session/std",
- "pallet-shift-session-manager/std",
- "pallet-sudo/std",
- "pallet-timestamp/std",
- "pallet-transaction-payment-rpc-runtime-api/std",
- "pallet-transaction-payment/std",
- "scale-info/std",
- "serde",
- "sp-api/std",
- "sp-block-builder/std",
- "sp-consensus-aura/std",
- "sp-core/std",
- "sp-finality-grandpa/std",
- "sp-inherents/std",
- "sp-mmr-primitives/std",
- "sp-offchain/std",
- "sp-runtime/std",
- "sp-session/std",
- "sp-std/std",
- "sp-transaction-pool/std",
- "sp-trie/std",
- "sp-version/std",
-]
-runtime-benchmarks = [
- "bridge-runtime-common/runtime-benchmarks",
- "frame-benchmarking/runtime-benchmarks",
- "frame-support/runtime-benchmarks",
- "frame-system/runtime-benchmarks",
- "libsecp256k1",
- "pallet-bridge-messages/runtime-benchmarks",
- "pallet-bridge-token-swap/runtime-benchmarks",
- "sp-runtime/runtime-benchmarks",
-]
diff --git a/bridges/bin/millau/runtime/build.rs b/bridges/bin/millau/runtime/build.rs
deleted file mode 100644
index cc865704327d..000000000000
--- a/bridges/bin/millau/runtime/build.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use substrate_wasm_builder::WasmBuilder;
-
-fn main() {
- WasmBuilder::new()
- .with_current_project()
- .import_memory()
- .export_heap_base()
- .build()
-}
diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs
deleted file mode 100644
index 4714dab68a46..000000000000
--- a/bridges/bin/millau/runtime/src/lib.rs
+++ /dev/null
@@ -1,1004 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! The Millau runtime. This can be compiled with `#[no_std]`, ready for Wasm.
-
-#![cfg_attr(not(feature = "std"), no_std)]
-// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
-#![recursion_limit = "256"]
-// Runtime-generated enums
-#![allow(clippy::large_enum_variant)]
-// From construct_runtime macro
-#![allow(clippy::from_over_into)]
-
-// Make the WASM binary available.
-#[cfg(feature = "std")]
-include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
-
-pub mod rialto_messages;
-
-use crate::rialto_messages::{ToRialtoMessagePayload, WithRialtoMessageBridge};
-
-use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::{MmrLeafVersion}, ValidatorSet};
-use bridge_runtime_common::messages::{
- source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
-};
-use pallet_grandpa::{
- fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
-};
-use sp_mmr_primitives::{
- DataOrHash, EncodableOpaqueLeaf, Error as MmrError, LeafDataProvider,
- BatchProof as MmrBatchProof, Proof as MmrProof, LeafIndex as MmrLeafIndex
-};
-use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo};
-use sp_api::impl_runtime_apis;
-use sp_consensus_aura::sr25519::AuthorityId as AuraId;
-use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
-use sp_runtime::{
- create_runtime_str, generic, impl_opaque_keys,
- traits::{Block as BlockT, IdentityLookup, Keccak256, NumberFor, OpaqueKeys},
- transaction_validity::{TransactionSource, TransactionValidity},
- ApplyExtrinsicResult, FixedPointNumber, FixedU128, MultiSignature, MultiSigner, Perquintill,
-};
-use sp_std::prelude::*;
-#[cfg(feature = "std")]
-use sp_version::NativeVersion;
-use sp_version::RuntimeVersion;
-
-// A few exports that help ease life for downstream crates.
-pub use frame_support::{
- construct_runtime, parameter_types,
- traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
- weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, RuntimeDbWeight, Weight},
- StorageValue,
-};
-
-pub use frame_system::Call as SystemCall;
-pub use pallet_balances::Call as BalancesCall;
-pub use pallet_bridge_grandpa::Call as BridgeGrandpaCall;
-pub use pallet_bridge_messages::Call as MessagesCall;
-pub use pallet_sudo::Call as SudoCall;
-pub use pallet_timestamp::Call as TimestampCall;
-
-#[cfg(any(feature = "std", test))]
-pub use sp_runtime::BuildStorage;
-pub use sp_runtime::{Perbill, Permill};
-
-/// An index to a block.
-pub type BlockNumber = bp_millau::BlockNumber;
-
-/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
-pub type Signature = bp_millau::Signature;
-
-/// Some way of identifying an account on the chain. We intentionally make it equivalent
-/// to the public key of our transaction signing scheme.
-pub type AccountId = bp_millau::AccountId;
-
-/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
-/// never know...
-pub type AccountIndex = u32;
-
-/// Balance of an account.
-pub type Balance = bp_millau::Balance;
-
-/// Index of a transaction in the chain.
-pub type Index = bp_millau::Index;
-
-/// A hash of some data used by the chain.
-pub type Hash = bp_millau::Hash;
-
-/// Hashing algorithm used by the chain.
-pub type Hashing = bp_millau::Hasher;
-
-/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
-/// the specifics of the runtime. They can then be made to be agnostic over specific formats
-/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
-/// to even the core data structures.
-pub mod opaque {
- use super::*;
-
- pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
-
- /// Opaque block header type.
- pub type Header = generic::Header;
- /// Opaque block type.
- pub type Block = generic::Block;
- /// Opaque block identifier type.
- pub type BlockId = generic::BlockId;
-}
-
-impl_opaque_keys! {
- pub struct SessionKeys {
- pub aura: Aura,
- pub beefy: Beefy,
- pub grandpa: Grandpa,
- }
-}
-
-/// This runtime version.
-pub const VERSION: RuntimeVersion = RuntimeVersion {
- spec_name: create_runtime_str!("millau-runtime"),
- impl_name: create_runtime_str!("millau-runtime"),
- authoring_version: 1,
- spec_version: 1,
- impl_version: 1,
- apis: RUNTIME_API_VERSIONS,
- transaction_version: 1,
- state_version: 0,
-};
-
-/// The version information used to identify this runtime when compiled natively.
-#[cfg(feature = "std")]
-pub fn native_version() -> NativeVersion {
- NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
-}
-
-parameter_types! {
- pub const BlockHashCount: BlockNumber = 250;
- pub const Version: RuntimeVersion = VERSION;
- pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
- read: 60_000_000, // ~0.06 ms = ~60 µs
- write: 200_000_000, // ~0.2 ms = 200 µs
- };
- pub const SS58Prefix: u8 = 60;
-}
-
-impl frame_system::Config for Runtime {
- /// The basic call filter to use in dispatchable.
- type BaseCallFilter = frame_support::traits::Everything;
- /// The identifier used to distinguish between accounts.
- type AccountId = AccountId;
- /// The aggregated dispatch type that is available for extrinsics.
- type Call = Call;
- /// The lookup mechanism to get account ID from whatever is passed in dispatchers.
- type Lookup = IdentityLookup;
- /// The index type for storing how many extrinsics an account has signed.
- type Index = Index;
- /// The index type for blocks.
- type BlockNumber = BlockNumber;
- /// The type for hashing blocks and tries.
- type Hash = Hash;
- /// The hashing algorithm used.
- type Hashing = Hashing;
- /// The header type.
- type Header = generic::Header;
- /// The ubiquitous event type.
- type Event = Event;
- /// The ubiquitous origin type.
- type Origin = Origin;
- /// Maximum number of block number to block hash mappings to keep (oldest pruned first).
- type BlockHashCount = BlockHashCount;
- /// Version of the runtime.
- type Version = Version;
- /// Provides information about the pallet setup in the runtime.
- type PalletInfo = PalletInfo;
- /// What to do if a new account is created.
- type OnNewAccount = ();
- /// What to do if an account is fully reaped from the system.
- type OnKilledAccount = ();
- /// The data to be stored in an account.
- type AccountData = pallet_balances::AccountData;
- // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
- /// Weight information for the extrinsics of this pallet.
- type SystemWeightInfo = ();
- /// Block and extrinsics weights: base values and limits.
- type BlockWeights = bp_millau::BlockWeights;
- /// The maximum length of a block (in bytes).
- type BlockLength = bp_millau::BlockLength;
- /// The weight of database operations that the runtime can invoke.
- type DbWeight = DbWeight;
- /// The designated `SS58` prefix of this chain.
- type SS58Prefix = SS58Prefix;
- /// The set code logic, just the default since we're not a parachain.
- type OnSetCode = ();
- type MaxConsumers = frame_support::traits::ConstU32<16>;
-}
-
-impl pallet_randomness_collective_flip::Config for Runtime {}
-
-parameter_types! {
- pub const MaxAuthorities: u32 = 10;
-}
-
-impl pallet_aura::Config for Runtime {
- type AuthorityId = AuraId;
- type MaxAuthorities = MaxAuthorities;
- type DisabledValidators = ();
-}
-
-impl pallet_beefy::Config for Runtime {
- type BeefyId = BeefyId;
- type MaxAuthorities = MaxAuthorities;
-}
-
-impl pallet_bridge_dispatch::Config for Runtime {
- type Event = Event;
- type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
- type Call = Call;
- type CallFilter = frame_support::traits::Everything;
- type EncodedCall = crate::rialto_messages::FromRialtoEncodedCall;
- type SourceChainAccountId = bp_rialto::AccountId;
- type TargetChainAccountPublic = MultiSigner;
- type TargetChainSignature = MultiSignature;
- type AccountIdConverter = bp_millau::AccountIdConverter;
-}
-
-impl pallet_grandpa::Config for Runtime {
- type Event = Event;
- type Call = Call;
- type KeyOwnerProofSystem = ();
- type KeyOwnerProof =
- >::Proof;
- type KeyOwnerIdentification = >::IdentificationTuple;
- type HandleEquivocation = ();
- // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
- type WeightInfo = ();
- type MaxAuthorities = MaxAuthorities;
-}
-
-type MmrHash = ::Output;
-
-impl pallet_mmr::Config for Runtime {
- const INDEXING_PREFIX: &'static [u8] = b"mmr";
- type Hashing = Keccak256;
- type Hash = MmrHash;
- type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest;
- type WeightInfo = ();
- type LeafData = pallet_beefy_mmr::Pallet;
-}
-
-parameter_types! {
- /// Version of the produced MMR leaf.
- ///
- /// The version consists of two parts;
- /// - `major` (3 bits)
- /// - `minor` (5 bits)
- ///
- /// `major` should be updated only if decoding the previous MMR Leaf format from the payload
- /// is not possible (i.e. backward incompatible change).
- /// `minor` should be updated if fields are added to the previous MMR Leaf, which given SCALE
- /// encoding does not prevent old leafs from being decoded.
- ///
- /// Hence we expect `major` to be changed really rarely (think never).
- /// See [`MmrLeafVersion`] type documentation for more details.
- pub LeafVersion: MmrLeafVersion = MmrLeafVersion::new(0, 0);
-}
-
-impl pallet_beefy_mmr::Config for Runtime {
- type LeafVersion = LeafVersion;
- type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
- type BeefyDataProvider = ();
-}
-
-parameter_types! {
- pub const MinimumPeriod: u64 = bp_millau::SLOT_DURATION / 2;
-}
-
-impl pallet_timestamp::Config for Runtime {
- /// A timestamp: milliseconds since the UNIX epoch.
- type Moment = u64;
- type OnTimestampSet = Aura;
- type MinimumPeriod = MinimumPeriod;
- // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
- type WeightInfo = ();
-}
-
-parameter_types! {
- pub const ExistentialDeposit: bp_millau::Balance = 500;
- // For weight estimation, we assume that the most locks on an individual account will be 50.
- // This number may need to be adjusted in the future if this assumption no longer holds true.
- pub const MaxLocks: u32 = 50;
- pub const MaxReserves: u32 = 50;
-}
-
-impl pallet_balances::Config for Runtime {
- /// The type for recording an account's balance.
- type Balance = Balance;
- /// The ubiquitous event type.
- type Event = Event;
- type DustRemoval = ();
- type ExistentialDeposit = ExistentialDeposit;
- type AccountStore = System;
- // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
- type WeightInfo = ();
- type MaxLocks = MaxLocks;
- type MaxReserves = MaxReserves;
- type ReserveIdentifier = [u8; 8];
-}
-
-parameter_types! {
- pub const TransactionBaseFee: Balance = 0;
- pub const TransactionByteFee: Balance = 1;
- pub const OperationalFeeMultiplier: u8 = 5;
- // values for following parameters are copied from polkadot repo, but it is fine
- // not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains
- pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
- pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(3, 100_000);
- pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128);
-}
-
-impl pallet_transaction_payment::Config for Runtime {
- type Event = Event;
- type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter;
- type TransactionByteFee = TransactionByteFee;
- type OperationalFeeMultiplier = OperationalFeeMultiplier;
- type WeightToFee = bp_millau::WeightToFee;
- type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
- Runtime,
- TargetBlockFullness,
- AdjustmentVariable,
- MinimumMultiplier,
- >;
-}
-
-impl pallet_sudo::Config for Runtime {
- type Event = Event;
- type Call = Call;
-}
-
-parameter_types! {
- /// Authorities are changing every 5 minutes.
- pub const Period: BlockNumber = bp_millau::SESSION_LENGTH;
- pub const Offset: BlockNumber = 0;
-}
-
-impl pallet_session::Config for Runtime {
- type Event = Event;
- type ValidatorId = ::AccountId;
- type ValidatorIdOf = ();
- type ShouldEndSession = pallet_session::PeriodicSessions;
- type NextSessionRotation = pallet_session::PeriodicSessions;
- type SessionManager = pallet_shift_session_manager::Pallet;
- type SessionHandler = ::KeyTypeIdProviders;
- type Keys = SessionKeys;
- // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
- type WeightInfo = ();
-}
-
-parameter_types! {
- // This is a pretty unscientific cap.
- //
- // Note that once this is hit the pallet will essentially throttle incoming requests down to one
- // call per block.
- pub const MaxRequests: u32 = 50;
-}
-
-#[cfg(feature = "runtime-benchmarks")]
-parameter_types! {
- /// Number of headers to keep in benchmarks.
- ///
- /// In benchmarks we always populate with full number of `HeadersToKeep` to make sure that
- /// pruning is taken into account.
- ///
- /// Note: This is lower than regular value, to speed up benchmarking setup.
- pub const HeadersToKeep: u32 = 1024;
-}
-
-#[cfg(not(feature = "runtime-benchmarks"))]
-parameter_types! {
- /// Number of headers to keep.
- ///
- /// Assuming the worst case of every header being finalized, we will keep headers at least for a
- /// week.
- pub const HeadersToKeep: u32 = 7 * bp_rialto::DAYS as u32;
-}
-
-pub type RialtoGrandpaInstance = ();
-impl pallet_bridge_grandpa::Config for Runtime {
- type BridgedChain = bp_rialto::Rialto;
- type MaxRequests = MaxRequests;
- type HeadersToKeep = HeadersToKeep;
-
- type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight;
-}
-
-pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
-impl pallet_bridge_grandpa::Config for Runtime {
- type BridgedChain = bp_westend::Westend;
- type MaxRequests = MaxRequests;
- type HeadersToKeep = HeadersToKeep;
-
- type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight;
-}
-
-impl pallet_shift_session_manager::Config for Runtime {}
-
-parameter_types! {
- pub const MaxMessagesToPruneAtOnce: bp_messages::MessageNonce = 8;
- pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
- bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
- pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
- bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
- // `IdentityFee` is used by Millau => we may use weight directly
- pub const GetDeliveryConfirmationTransactionFee: Balance =
- bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT as _;
- pub const RootAccountForPayments: Option = None;
- pub const RialtoChainId: bp_runtime::ChainId = bp_runtime::RIALTO_CHAIN_ID;
-}
-
-/// Instance of the messages pallet used to relay messages to/from Rialto chain.
-pub type WithRialtoMessagesInstance = ();
-
-impl pallet_bridge_messages::Config for Runtime {
- type Event = Event;
- type WeightInfo = pallet_bridge_messages::weights::MillauWeight;
- type Parameter = rialto_messages::MillauToRialtoMessagesParameter;
- type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
- type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
- type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
-
- type OutboundPayload = crate::rialto_messages::ToRialtoMessagePayload;
- type OutboundMessageFee = Balance;
-
- type InboundPayload = crate::rialto_messages::FromRialtoMessagePayload;
- type InboundMessageFee = bp_rialto::Balance;
- type InboundRelayer = bp_rialto::AccountId;
-
- type AccountIdConverter = bp_millau::AccountIdConverter;
-
- type TargetHeaderChain = crate::rialto_messages::Rialto;
- type LaneMessageVerifier = crate::rialto_messages::ToRialtoMessageVerifier;
- type MessageDeliveryAndDispatchPayment =
- pallet_bridge_messages::instant_payments::InstantCurrencyPayments<
- Runtime,
- WithRialtoMessagesInstance,
- pallet_balances::Pallet,
- GetDeliveryConfirmationTransactionFee,
- >;
- type OnMessageAccepted = ();
- type OnDeliveryConfirmed =
- pallet_bridge_token_swap::Pallet;
-
- type SourceHeaderChain = crate::rialto_messages::Rialto;
- type MessageDispatch = crate::rialto_messages::FromRialtoMessageDispatch;
- type BridgedChainId = RialtoChainId;
-}
-
-parameter_types! {
- pub const TokenSwapMessagesLane: bp_messages::LaneId = *b"swap";
-}
-
-/// Instance of the with-Rialto token swap pallet.
-pub type WithRialtoTokenSwapInstance = ();
-
-impl pallet_bridge_token_swap::Config for Runtime {
- type Event = Event;
- type WeightInfo = ();
-
- type BridgedChainId = RialtoChainId;
- type OutboundMessageLaneId = TokenSwapMessagesLane;
- #[cfg(not(feature = "runtime-benchmarks"))]
- type MessagesBridge = pallet_bridge_messages::Pallet;
- #[cfg(feature = "runtime-benchmarks")]
- type MessagesBridge = bp_messages::source_chain::NoopMessagesBridge;
- type ThisCurrency = pallet_balances::Pallet;
- type FromSwapToThisAccountIdConverter = bp_rialto::AccountIdConverter;
-
- type BridgedChain = bp_rialto::Rialto;
- type FromBridgedToThisAccountIdConverter = bp_millau::AccountIdConverter;
-}
-
-construct_runtime!(
- pub enum Runtime where
- Block = Block,
- NodeBlock = opaque::Block,
- UncheckedExtrinsic = UncheckedExtrinsic
- {
- System: frame_system::{Pallet, Call, Config, Storage, Event},
- Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event},
-
- // Must be before session.
- Aura: pallet_aura::{Pallet, Config},
-
- Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
- Balances: pallet_balances::{Pallet, Call, Storage, Config, Event},
- TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event},
-
- // Consensus support.
- Session: pallet_session::{Pallet, Call, Storage, Event, Config},
- Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event},
- ShiftSessionManager: pallet_shift_session_manager::{Pallet},
- RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
-
- // BEEFY Bridges support.
- Beefy: pallet_beefy::{Pallet, Storage, Config},
- Mmr: pallet_mmr::{Pallet, Storage},
- MmrLeaf: pallet_beefy_mmr::{Pallet, Storage},
-
- // Rialto bridge modules.
- BridgeRialtoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage},
- BridgeDispatch: pallet_bridge_dispatch::{Pallet, Event},
- BridgeRialtoMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event, Config},
- BridgeRialtoTokenSwap: pallet_bridge_token_swap::{Pallet, Call, Storage, Event, Origin},
-
- // Westend bridge modules.
- BridgeWestendGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Config, Storage},
- }
-);
-
-/// The address format for describing accounts.
-pub type Address = AccountId;
-/// Block header type as expected by this runtime.
-pub type Header = generic::Header;
-/// Block type as expected by this runtime.
-pub type Block = generic::Block;
-/// A Block signed with a Justification
-pub type SignedBlock = generic::SignedBlock;
-/// `BlockId` type as expected by this runtime.
-pub type BlockId = generic::BlockId;
-/// The `SignedExtension` to the basic transaction logic.
-pub type SignedExtra = (
- frame_system::CheckNonZeroSender,
- frame_system::CheckSpecVersion,
- frame_system::CheckTxVersion,
- frame_system::CheckGenesis,
- frame_system::CheckEra,
- frame_system::CheckNonce,
- frame_system::CheckWeight,
- pallet_transaction_payment::ChargeTransactionPayment,
-);
-/// The payload being signed in transactions.
-pub type SignedPayload = generic::SignedPayload;
-/// Unchecked extrinsic type as expected by this runtime.
-pub type UncheckedExtrinsic = generic::UncheckedExtrinsic;
-/// Extrinsic type that has already been checked.
-pub type CheckedExtrinsic = generic::CheckedExtrinsic;
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
- Runtime,
- Block,
- frame_system::ChainContext,
- Runtime,
- AllPalletsWithSystem,
->;
-
-#[cfg(feature = "runtime-benchmarks")]
-#[macro_use]
-extern crate frame_benchmarking;
-
-#[cfg(feature = "runtime-benchmarks")]
-mod benches {
- define_benchmarks!(
- [pallet_bridge_token_swap, BridgeRialtoTokenSwap]
- );
-}
-type MmrHashing = ::Hashing;
-
-impl_runtime_apis! {
- impl sp_api::Core for Runtime {
- fn version() -> RuntimeVersion {
- VERSION
- }
-
- fn execute_block(block: Block) {
- Executive::execute_block(block);
- }
-
- fn initialize_block(header: &::Header) {
- Executive::initialize_block(header)
- }
- }
-
- impl sp_api::Metadata for Runtime {
- fn metadata() -> OpaqueMetadata {
- OpaqueMetadata::new(Runtime::metadata().into())
- }
- }
-
- impl sp_block_builder::BlockBuilder for Runtime {
- fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult {
- Executive::apply_extrinsic(extrinsic)
- }
-
- fn finalize_block() -> ::Header {
- Executive::finalize_block()
- }
-
- fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> {
- data.create_extrinsics()
- }
-
- fn check_inherents(
- block: Block,
- data: sp_inherents::InherentData,
- ) -> sp_inherents::CheckInherentsResult {
- data.check_extrinsics(&block)
- }
- }
-
- impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime {
- fn account_nonce(account: AccountId) -> Index {
- System::account_nonce(account)
- }
- }
-
- impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime {
- fn validate_transaction(
- source: TransactionSource,
- tx: ::Extrinsic,
- block_hash: ::Hash,
- ) -> TransactionValidity {
- Executive::validate_transaction(source, tx, block_hash)
- }
- }
-
- impl sp_offchain::OffchainWorkerApi for Runtime {
- fn offchain_worker(header: &::Header) {
- Executive::offchain_worker(header)
- }
- }
-
- impl sp_consensus_aura::AuraApi for Runtime {
- fn slot_duration() -> sp_consensus_aura::SlotDuration {
- sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
- }
-
- fn authorities() -> Vec {
- Aura::authorities().to_vec()
- }
- }
-
- impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
- Block,
- Balance,
- > for Runtime {
- fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo {
- TransactionPayment::query_info(uxt, len)
- }
- fn query_fee_details(uxt: ::Extrinsic, len: u32) -> FeeDetails {
- TransactionPayment::query_fee_details(uxt, len)
- }
- }
-
- impl sp_session::SessionKeys for Runtime {
- fn generate_session_keys(seed: Option>) -> Vec {
- SessionKeys::generate(seed)
- }
-
- fn decode_session_keys(
- encoded: Vec,
- ) -> Option, sp_core::crypto::KeyTypeId)>> {
- SessionKeys::decode_into_raw_public_keys(&encoded)
- }
- }
-
- impl beefy_primitives::BeefyApi for Runtime {
- fn validator_set() -> Option> {
- Beefy::validator_set()
- }
- }
-
- impl sp_mmr_primitives::MmrApi for Runtime {
- fn generate_proof(leaf_index: MmrLeafIndex)
- -> Result<(EncodableOpaqueLeaf, MmrProof), MmrError>
- {
- Mmr::generate_batch_proof(vec![leaf_index])
- .and_then(|(leaves, proof)| Ok((
- EncodableOpaqueLeaf::from_leaf(&leaves[0]),
- MmrBatchProof::into_single_leaf_proof(proof)?
- )))
-
- }
-
- fn verify_proof(leaf: EncodableOpaqueLeaf, proof: MmrProof)
- -> Result<(), MmrError>
- {
-
- type MmrLeaf = <::LeafData as LeafDataProvider>::LeafData;
- let leaf: MmrLeaf = leaf
- .into_opaque_leaf()
- .try_decode()
- .ok_or(MmrError::Verify)?;
- Mmr::verify_leaves(vec![leaf], MmrProof::into_batch_proof(proof))
- }
-
- fn verify_proof_stateless(
- root: MmrHash,
- leaf: EncodableOpaqueLeaf,
- proof: MmrProof
- ) -> Result<(), MmrError> {
- let node = DataOrHash::Data(leaf.into_opaque_leaf());
- pallet_mmr::verify_leaves_proof::(root, vec![node], MmrProof::into_batch_proof(proof))
- }
-
- fn generate_batch_proof(leaf_indices: Vec)
- -> Result<(Vec, MmrBatchProof), MmrError>
- {
- Mmr::generate_batch_proof(leaf_indices)
- .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof))
- }
-
- fn verify_batch_proof(leaves: Vec, proof: MmrBatchProof)
- -> Result<(), MmrError>
- {
- type MmrLeaf = <::LeafData as LeafDataProvider>::LeafData;
- let leaves = leaves.into_iter().map(|leaf|
- leaf.into_opaque_leaf()
- .try_decode()
- .ok_or(MmrError::Verify)).collect::, MmrError>>()?;
- Mmr::verify_leaves(leaves, proof)
- }
-
- fn verify_batch_proof_stateless(
- root: MmrHash,
- leaves: Vec,
- proof: MmrBatchProof
- ) -> Result<(), MmrError> {
- let nodes = leaves.into_iter().map(|leaf|DataOrHash::Data(leaf.into_opaque_leaf())).collect();
- pallet_mmr::verify_leaves_proof::(root, nodes, proof)
- }
- }
-
- impl fg_primitives::GrandpaApi for Runtime {
- fn current_set_id() -> fg_primitives::SetId {
- Grandpa::current_set_id()
- }
-
- fn grandpa_authorities() -> GrandpaAuthorityList {
- Grandpa::grandpa_authorities()
- }
-
- fn submit_report_equivocation_unsigned_extrinsic(
- equivocation_proof: fg_primitives::EquivocationProof<
- ::Hash,
- NumberFor,
- >,
- key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
- ) -> Option<()> {
- let key_owner_proof = key_owner_proof.decode()?;
-
- Grandpa::submit_unsigned_equivocation_report(
- equivocation_proof,
- key_owner_proof,
- )
- }
-
- fn generate_key_ownership_proof(
- _set_id: fg_primitives::SetId,
- _authority_id: GrandpaId,
- ) -> Option {
- // NOTE: this is the only implementation possible since we've
- // defined our key owner proof type as a bottom type (i.e. a type
- // with no values).
- None
- }
- }
-
- impl bp_rialto::RialtoFinalityApi for Runtime {
- fn best_finalized() -> (bp_rialto::BlockNumber, bp_rialto::Hash) {
- let header = BridgeRialtoGrandpa::best_finalized();
- (header.number, header.hash())
- }
- }
-
- impl bp_westend::WestendFinalityApi for Runtime {
- fn best_finalized() -> (bp_westend::BlockNumber, bp_westend::Hash) {
- let header = BridgeWestendGrandpa::best_finalized();
- (header.number, header.hash())
- }
- }
-
- impl bp_rialto::ToRialtoOutboundLaneApi for Runtime {
- fn estimate_message_delivery_and_dispatch_fee(
- _lane_id: bp_messages::LaneId,
- payload: ToRialtoMessagePayload,
- rialto_to_this_conversion_rate: Option,
- ) -> Option {
- estimate_message_dispatch_and_delivery_fee::(
- &payload,
- WithRialtoMessageBridge::RELAYER_FEE_PERCENT,
- rialto_to_this_conversion_rate,
- ).ok()
- }
-
- fn message_details(
- lane: bp_messages::LaneId,
- begin: bp_messages::MessageNonce,
- end: bp_messages::MessageNonce,
- ) -> Vec> {
- bridge_runtime_common::messages_api::outbound_message_details::<
- Runtime,
- WithRialtoMessagesInstance,
- WithRialtoMessageBridge,
- >(lane, begin, end)
- }
- }
-
- #[cfg(feature = "runtime-benchmarks")]
- impl frame_benchmarking::Benchmark for Runtime {
- fn benchmark_metadata(extra: bool) -> (
- Vec,
- Vec,
- ) {
- use frame_benchmarking::{Benchmarking, BenchmarkList};
- use frame_support::traits::StorageInfoTrait;
-
- use pallet_bridge_messages::benchmarking::Pallet as MessagesBench;
-
- let mut list = Vec::::new();
-
- list_benchmark!(list, extra, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
- list_benchmark!(list, extra, pallet_bridge_messages, MessagesBench::);
- list_benchmark!(list, extra, pallet_bridge_grandpa, BridgeRialtoGrandpa);
-
- let storage_info = AllPalletsWithSystem::storage_info();
- return (list, storage_info)
- }
-
- fn dispatch_benchmark(
- config: frame_benchmarking::BenchmarkConfig,
- ) -> Result, sp_runtime::RuntimeString> {
- use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
-
- let whitelist: Vec = vec![
- // Block Number
- hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
- // Execution Phase
- hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
- // Event Count
- hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
- // System Events
- hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
- // Caller 0 Account
- hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec().into(),
- ];
-
- let mut batches = Vec::::new();
- let params = (&config, &whitelist);
-
- use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof, prepare_message_proof, prepare_outbound_message};
- use bridge_runtime_common::messages;
- use pallet_bridge_messages::benchmarking::{
- Pallet as MessagesBench,
- Config as MessagesConfig,
- MessageDeliveryProofParams,
- MessageParams,
- MessageProofParams,
- };
- use rialto_messages::WithRialtoMessageBridge;
-
- impl MessagesConfig for Runtime {
- fn maximal_message_size() -> u32 {
- messages::source::maximal_message_size::()
- }
-
- fn bridged_relayer_id() -> Self::InboundRelayer {
- [0u8; 32].into()
- }
-
- fn account_balance(account: &Self::AccountId) -> Self::OutboundMessageFee {
- pallet_balances::Pallet::::free_balance(account)
- }
-
- fn endow_account(account: &Self::AccountId) {
- pallet_balances::Pallet::::make_free_balance_be(
- account,
- Balance::MAX / 100,
- );
- }
-
- fn prepare_outbound_message(
- params: MessageParams,
- ) -> (rialto_messages::ToRialtoMessagePayload, Balance) {
- (prepare_outbound_message::(params), Self::message_fee())
- }
-
- fn prepare_message_proof(
- params: MessageProofParams,
- ) -> (rialto_messages::FromRialtoMessagesProof, Weight) {
- prepare_message_proof::(
- params,
- &VERSION,
- Balance::MAX / 100,
- )
- }
-
- fn prepare_message_delivery_proof(
- params: MessageDeliveryProofParams,
- ) -> rialto_messages::ToRialtoMessagesDeliveryProof {
- prepare_message_delivery_proof::(
- params,
- )
- }
-
- fn is_message_dispatched(nonce: bp_messages::MessageNonce) -> bool {
- frame_system::Pallet::::events()
- .into_iter()
- .map(|event_record| event_record.event)
- .any(|event| matches!(
- event,
- Event::BridgeDispatch(pallet_bridge_dispatch::Event::::MessageDispatched(
- _, ([0, 0, 0, 0], nonce_from_event), _,
- )) if nonce_from_event == nonce
- ))
- }
- }
-
- use pallet_bridge_token_swap::benchmarking::Config as TokenSwapConfig;
-
- impl TokenSwapConfig for Runtime {
- fn initialize_environment() {
- let relayers_fund_account = pallet_bridge_messages::relayer_fund_account_id::<
- bp_millau::AccountId,
- bp_millau::AccountIdConverter,
- >();
- pallet_balances::Pallet::::make_free_balance_be(
- &relayers_fund_account,
- Balance::MAX / 100,
- );
- }
- }
-
- add_benchmark!(
- params,
- batches,
- pallet_bridge_messages,
- MessagesBench::
- );
- add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa);
- add_benchmark!(params, batches, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
-
- Ok(batches)
- }
- }
-}
-
-/// Rialto account ownership digest from Millau.
-///
-/// The byte vector returned by this function should be signed with a Rialto account private key.
-/// This way, the owner of `millau_account_id` on Millau proves that the Rialto account private key
-/// is also under his control.
-pub fn millau_to_rialto_account_ownership_digest(
- rialto_call: &Call,
- millau_account_id: AccountId,
- rialto_spec_version: SpecVersion,
-) -> sp_std::vec::Vec
-where
- Call: codec::Encode,
- AccountId: codec::Encode,
- SpecVersion: codec::Encode,
-{
- pallet_bridge_dispatch::account_ownership_digest(
- rialto_call,
- millau_account_id,
- rialto_spec_version,
- bp_runtime::MILLAU_CHAIN_ID,
- bp_runtime::RIALTO_CHAIN_ID,
- )
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn call_size() {
- const BRIDGES_PALLETS_MAX_CALL_SIZE: usize = 200;
- assert!(
- core::mem::size_of::>() <=
- BRIDGES_PALLETS_MAX_CALL_SIZE
- );
- assert!(
- core::mem::size_of::>() <=
- BRIDGES_PALLETS_MAX_CALL_SIZE
- );
- const MAX_CALL_SIZE: usize = 230; // value from polkadot-runtime tests
- assert!(core::mem::size_of::() <= MAX_CALL_SIZE);
- }
-}
diff --git a/bridges/bin/millau/runtime/src/rialto_messages.rs b/bridges/bin/millau/runtime/src/rialto_messages.rs
deleted file mode 100644
index d925d805dd04..000000000000
--- a/bridges/bin/millau/runtime/src/rialto_messages.rs
+++ /dev/null
@@ -1,428 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Everything required to serve Millau <-> Rialto messages.
-
-use crate::Runtime;
-
-use bp_messages::{
- source_chain::{SenderOrigin, TargetHeaderChain},
- target_chain::{ProvedMessages, SourceHeaderChain},
- InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
-};
-use bp_runtime::{Chain, ChainId, MILLAU_CHAIN_ID, RIALTO_CHAIN_ID};
-use bridge_runtime_common::messages::{self, MessageBridge, MessageTransaction};
-use codec::{Decode, Encode};
-use frame_support::{
- parameter_types,
- weights::{DispatchClass, Weight},
- RuntimeDebug,
-};
-use scale_info::TypeInfo;
-use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128};
-use sp_std::{convert::TryFrom, ops::RangeInclusive};
-
-/// Initial value of `RialtoToMillauConversionRate` parameter.
-pub const INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE: FixedU128 =
- FixedU128::from_inner(FixedU128::DIV);
-/// Initial value of `RialtoFeeMultiplier` parameter.
-pub const INITIAL_RIALTO_FEE_MULTIPLIER: FixedU128 = FixedU128::from_inner(FixedU128::DIV);
-
-parameter_types! {
- /// Rialto to Millau conversion rate. Initially we treat both tokens as equal.
- pub storage RialtoToMillauConversionRate: FixedU128 = INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE;
- /// Fee multiplier value at Rialto chain.
- pub storage RialtoFeeMultiplier: FixedU128 = INITIAL_RIALTO_FEE_MULTIPLIER;
-}
-
-/// Message payload for Millau -> Rialto messages.
-pub type ToRialtoMessagePayload =
- messages::source::FromThisChainMessagePayload;
-
-/// Message verifier for Millau -> Rialto messages.
-pub type ToRialtoMessageVerifier =
- messages::source::FromThisChainMessageVerifier;
-
-/// Message payload for Rialto -> Millau messages.
-pub type FromRialtoMessagePayload =
- messages::target::FromBridgedChainMessagePayload;
-
-/// Encoded Millau Call as it comes from Rialto.
-pub type FromRialtoEncodedCall = messages::target::FromBridgedChainEncodedMessageCall;
-
-/// Messages proof for Rialto -> Millau messages.
-pub type FromRialtoMessagesProof = messages::target::FromBridgedChainMessagesProof;
-
-/// Messages delivery proof for Millau -> Rialto messages.
-pub type ToRialtoMessagesDeliveryProof =
- messages::source::FromBridgedChainMessagesDeliveryProof;
-
-/// Call-dispatch based message dispatch for Rialto -> Millau messages.
-pub type FromRialtoMessageDispatch = messages::target::FromBridgedChainMessageDispatch<
- WithRialtoMessageBridge,
- crate::Runtime,
- pallet_balances::Pallet,
- (),
->;
-
-/// Millau <-> Rialto message bridge.
-#[derive(RuntimeDebug, Clone, Copy)]
-pub struct WithRialtoMessageBridge;
-
-impl MessageBridge for WithRialtoMessageBridge {
- const RELAYER_FEE_PERCENT: u32 = 10;
- const THIS_CHAIN_ID: ChainId = MILLAU_CHAIN_ID;
- const BRIDGED_CHAIN_ID: ChainId = RIALTO_CHAIN_ID;
- const BRIDGED_MESSAGES_PALLET_NAME: &'static str = bp_millau::WITH_MILLAU_MESSAGES_PALLET_NAME;
-
- type ThisChain = Millau;
- type BridgedChain = Rialto;
-
- fn bridged_balance_to_this_balance(
- bridged_balance: bp_rialto::Balance,
- bridged_to_this_conversion_rate_override: Option,
- ) -> bp_millau::Balance {
- let conversion_rate = bridged_to_this_conversion_rate_override
- .unwrap_or_else(|| RialtoToMillauConversionRate::get());
- bp_millau::Balance::try_from(conversion_rate.saturating_mul_int(bridged_balance))
- .unwrap_or(bp_millau::Balance::MAX)
- }
-}
-
-/// Millau chain from message lane point of view.
-#[derive(RuntimeDebug, Clone, Copy)]
-pub struct Millau;
-
-impl messages::ChainWithMessages for Millau {
- type Hash = bp_millau::Hash;
- type AccountId = bp_millau::AccountId;
- type Signer = bp_millau::AccountSigner;
- type Signature = bp_millau::Signature;
- type Weight = Weight;
- type Balance = bp_millau::Balance;
-}
-
-impl messages::ThisChainWithMessages for Millau {
- type Origin = crate::Origin;
- type Call = crate::Call;
-
- fn is_message_accepted(send_origin: &Self::Origin, lane: &LaneId) -> bool {
- // lanes 0x00000000 && 0x00000001 are accepting any paid messages, while
- // `TokenSwapMessageLane` only accepts messages from token swap pallet
- let token_swap_dedicated_lane = crate::TokenSwapMessagesLane::get();
- match *lane {
- [0, 0, 0, 0] | [0, 0, 0, 1] => send_origin.linked_account().is_some(),
- _ if *lane == token_swap_dedicated_lane => matches!(
- send_origin.caller,
- crate::OriginCaller::BridgeRialtoTokenSwap(
- pallet_bridge_token_swap::RawOrigin::TokenSwap { .. }
- )
- ),
- _ => false,
- }
- }
-
- fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
- MessageNonce::MAX
- }
-
- fn estimate_delivery_confirmation_transaction() -> MessageTransaction {
- let inbound_data_size = InboundLaneData::::encoded_size_hint(
- bp_millau::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
- 1,
- 1,
- )
- .unwrap_or(u32::MAX);
-
- MessageTransaction {
- dispatch_weight: bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
- size: inbound_data_size
- .saturating_add(bp_rialto::EXTRA_STORAGE_PROOF_SIZE)
- .saturating_add(bp_millau::TX_EXTRA_BYTES),
- }
- }
-
- fn transaction_payment(transaction: MessageTransaction) -> bp_millau::Balance {
- // `transaction` may represent transaction from the future, when multiplier value will
- // be larger, so let's use slightly increased value
- let multiplier = FixedU128::saturating_from_rational(110, 100)
- .saturating_mul(pallet_transaction_payment::Pallet::::next_fee_multiplier());
- // in our testnets, both per-byte fee and weight-to-fee are 1:1
- messages::transaction_payment(
- bp_millau::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
- 1,
- multiplier,
- |weight| weight as _,
- transaction,
- )
- }
-}
-
-/// Rialto chain from message lane point of view.
-#[derive(RuntimeDebug, Clone, Copy)]
-pub struct Rialto;
-
-impl messages::ChainWithMessages for Rialto {
- type Hash = bp_rialto::Hash;
- type AccountId = bp_rialto::AccountId;
- type Signer = bp_rialto::AccountSigner;
- type Signature = bp_rialto::Signature;
- type Weight = Weight;
- type Balance = bp_rialto::Balance;
-}
-
-impl messages::BridgedChainWithMessages for Rialto {
- fn maximal_extrinsic_size() -> u32 {
- bp_rialto::Rialto::max_extrinsic_size()
- }
-
- fn message_weight_limits(_message_payload: &[u8]) -> RangeInclusive {
- // we don't want to relay too large messages + keep reserve for future upgrades
- let upper_limit = messages::target::maximal_incoming_message_dispatch_weight(
- bp_rialto::Rialto::max_extrinsic_weight(),
- );
-
- // we're charging for payload bytes in `WithRialtoMessageBridge::transaction_payment`
- // function
- //
- // this bridge may be used to deliver all kind of messages, so we're not making any
- // assumptions about minimal dispatch weight here
-
- 0..=upper_limit
- }
-
- fn estimate_delivery_transaction(
- message_payload: &[u8],
- include_pay_dispatch_fee_cost: bool,
- message_dispatch_weight: Weight,
- ) -> MessageTransaction {
- let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX);
- let extra_bytes_in_payload = Weight::from(message_payload_len)
- .saturating_sub(pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH.into());
-
- MessageTransaction {
- dispatch_weight: extra_bytes_in_payload
- .saturating_mul(bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
- .saturating_add(bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT)
- .saturating_sub(if include_pay_dispatch_fee_cost {
- 0
- } else {
- bp_rialto::PAY_INBOUND_DISPATCH_FEE_WEIGHT
- })
- .saturating_add(message_dispatch_weight),
- size: message_payload_len
- .saturating_add(bp_millau::EXTRA_STORAGE_PROOF_SIZE)
- .saturating_add(bp_rialto::TX_EXTRA_BYTES),
- }
- }
-
- fn transaction_payment(transaction: MessageTransaction) -> bp_rialto::Balance {
- // we don't have a direct access to the value of multiplier at Rialto chain
- // => it is a messages module parameter
- let multiplier = RialtoFeeMultiplier::get();
- // in our testnets, both per-byte fee and weight-to-fee are 1:1
- messages::transaction_payment(
- bp_rialto::BlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
- 1,
- multiplier,
- |weight| weight as _,
- transaction,
- )
- }
-}
-
-impl TargetHeaderChain for Rialto {
- type Error = &'static str;
- // The proof is:
- // - hash of the header this proof has been created with;
- // - the storage proof or one or several keys;
- // - id of the lane we prove state of.
- type MessagesDeliveryProof = ToRialtoMessagesDeliveryProof;
-
- fn verify_message(payload: &ToRialtoMessagePayload) -> Result<(), Self::Error> {
- messages::source::verify_chain_message::(payload)
- }
-
- fn verify_messages_delivery_proof(
- proof: Self::MessagesDeliveryProof,
- ) -> Result<(LaneId, InboundLaneData), Self::Error> {
- messages::source::verify_messages_delivery_proof::<
- WithRialtoMessageBridge,
- Runtime,
- crate::RialtoGrandpaInstance,
- >(proof)
- }
-}
-
-impl SourceHeaderChain for Rialto {
- type Error = &'static str;
- // The proof is:
- // - hash of the header this proof has been created with;
- // - the storage proof or one or several keys;
- // - id of the lane we prove messages for;
- // - inclusive range of messages nonces that are proved.
- type MessagesProof = FromRialtoMessagesProof;
-
- fn verify_messages_proof(
- proof: Self::MessagesProof,
- messages_count: u32,
- ) -> Result>, Self::Error> {
- messages::target::verify_messages_proof::<
- WithRialtoMessageBridge,
- Runtime,
- crate::RialtoGrandpaInstance,
- >(proof, messages_count)
- }
-}
-
-impl SenderOrigin for crate::Origin {
- fn linked_account(&self) -> Option {
- match self.caller {
- crate::OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) =>
- Some(submitter.clone()),
- crate::OriginCaller::system(frame_system::RawOrigin::Root) |
- crate::OriginCaller::system(frame_system::RawOrigin::None) =>
- crate::RootAccountForPayments::get(),
- crate::OriginCaller::BridgeRialtoTokenSwap(
- pallet_bridge_token_swap::RawOrigin::TokenSwap {
- ref swap_account_at_this_chain,
- ..
- },
- ) => Some(swap_account_at_this_chain.clone()),
- _ => None,
- }
- }
-}
-
-/// Millau -> Rialto message lane pallet parameters.
-#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
-pub enum MillauToRialtoMessagesParameter {
- /// The conversion formula we use is: `MillauTokens = RialtoTokens * conversion_rate`.
- RialtoToMillauConversionRate(FixedU128),
-}
-
-impl MessagesParameter for MillauToRialtoMessagesParameter {
- fn save(&self) {
- match *self {
- MillauToRialtoMessagesParameter::RialtoToMillauConversionRate(ref conversion_rate) =>
- RialtoToMillauConversionRate::set(conversion_rate),
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::{DbWeight, RialtoGrandpaInstance, Runtime, WithRialtoMessagesInstance};
-
- use bp_runtime::Chain;
- use bridge_runtime_common::{
- assert_complete_bridge_types,
- integrity::{
- assert_complete_bridge_constants, AssertBridgeMessagesPalletConstants,
- AssertBridgePalletNames, AssertChainConstants, AssertCompleteBridgeConstants,
- },
- messages,
- };
-
- #[test]
- fn ensure_millau_message_lane_weights_are_correct() {
- type Weights = pallet_bridge_messages::weights::MillauWeight;
-
- pallet_bridge_messages::ensure_weights_are_correct::(
- bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,
- bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT,
- bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
- bp_millau::PAY_INBOUND_DISPATCH_FEE_WEIGHT,
- DbWeight::get(),
- );
-
- let max_incoming_message_proof_size = bp_rialto::EXTRA_STORAGE_PROOF_SIZE.saturating_add(
- messages::target::maximal_incoming_message_size(bp_millau::Millau::max_extrinsic_size()),
- );
- pallet_bridge_messages::ensure_able_to_receive_message::(
- bp_millau::Millau::max_extrinsic_size(),
- bp_millau::Millau::max_extrinsic_weight(),
- max_incoming_message_proof_size,
- messages::target::maximal_incoming_message_dispatch_weight(
- bp_millau::Millau::max_extrinsic_weight(),
- ),
- );
-
- let max_incoming_inbound_lane_data_proof_size =
- bp_messages::InboundLaneData::<()>::encoded_size_hint(
- bp_millau::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
- bp_millau::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX as _,
- bp_millau::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX as _,
- )
- .unwrap_or(u32::MAX);
- pallet_bridge_messages::ensure_able_to_receive_confirmation::(
- bp_millau::Millau::max_extrinsic_size(),
- bp_millau::Millau::max_extrinsic_weight(),
- max_incoming_inbound_lane_data_proof_size,
- bp_millau::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
- bp_millau::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
- DbWeight::get(),
- );
- }
-
- #[test]
- fn ensure_bridge_integrity() {
- assert_complete_bridge_types!(
- runtime: Runtime,
- with_bridged_chain_grandpa_instance: RialtoGrandpaInstance,
- with_bridged_chain_messages_instance: WithRialtoMessagesInstance,
- bridge: WithRialtoMessageBridge,
- this_chain: bp_millau::Millau,
- bridged_chain: bp_rialto::Rialto,
- this_chain_account_id_converter: bp_millau::AccountIdConverter
- );
-
- assert_complete_bridge_constants::<
- Runtime,
- RialtoGrandpaInstance,
- WithRialtoMessagesInstance,
- WithRialtoMessageBridge,
- bp_millau::Millau,
- >(AssertCompleteBridgeConstants {
- this_chain_constants: AssertChainConstants {
- block_length: bp_millau::BlockLength::get(),
- block_weights: bp_millau::BlockWeights::get(),
- },
- messages_pallet_constants: AssertBridgeMessagesPalletConstants {
- max_unrewarded_relayers_in_bridged_confirmation_tx:
- bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
- max_unconfirmed_messages_in_bridged_confirmation_tx:
- bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
- bridged_chain_id: bp_runtime::RIALTO_CHAIN_ID,
- },
- pallet_names: AssertBridgePalletNames {
- with_this_chain_messages_pallet_name: bp_millau::WITH_MILLAU_MESSAGES_PALLET_NAME,
- with_bridged_chain_grandpa_pallet_name: bp_rialto::WITH_RIALTO_GRANDPA_PALLET_NAME,
- with_bridged_chain_messages_pallet_name:
- bp_rialto::WITH_RIALTO_MESSAGES_PALLET_NAME,
- },
- });
-
- assert_eq!(
- RialtoToMillauConversionRate::key().to_vec(),
- bp_runtime::storage_parameter_key(
- bp_millau::RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME
- )
- .0,
- );
- }
-}
diff --git a/bridges/bin/rialto-parachain/node/Cargo.toml b/bridges/bin/rialto-parachain/node/Cargo.toml
deleted file mode 100644
index 41021a35ed2b..000000000000
--- a/bridges/bin/rialto-parachain/node/Cargo.toml
+++ /dev/null
@@ -1,91 +0,0 @@
-[package]
-name = "rialto-parachain-collator"
-version = "0.1.0"
-authors = ["Parity Technologies "]
-edition = "2021"
-homepage = "https://substrate.dev"
-repository = "https://github.com/paritytech/parity-bridges-common/"
-license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
-
-[build-dependencies]
-substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-[[bin]]
-name = 'rialto-parachain-collator'
-
-[features]
-default = []
-runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
-
-[dependencies]
-clap = { version = "3.1", features = ["derive"] }
-derive_more = '0.99.2'
-log = '0.4.14'
-codec = { package = 'parity-scale-codec', version = '3.0.0' }
-serde = { version = '1.0', features = ['derive'] }
-hex-literal = '0.3.1'
-
-# RPC related Dependencies
-jsonrpc-core = '18.0'
-
-# Local Dependencies
-rialto-parachain-runtime = { path = '../runtime' }
-
-# Substrate Dependencies
-frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
-frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
-substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-## Substrate Client Dependencies
-sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ['wasmtime'] }
-sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-## Substrate Primitive Dependencies
-sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
-sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
-
-# Cumulus dependencies
-cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-client-collator = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
-
-# Polkadot dependencies
-polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
-polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
-polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
-polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
-polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
\ No newline at end of file
diff --git a/bridges/bin/rialto-parachain/node/build.rs b/bridges/bin/rialto-parachain/node/build.rs
deleted file mode 100644
index 8ba8a31e9a79..000000000000
--- a/bridges/bin/rialto-parachain/node/build.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2019-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
-
-fn main() {
- generate_cargo_keys();
- rerun_if_git_head_changed();
-}
diff --git a/bridges/bin/rialto-parachain/node/src/chain_spec.rs b/bridges/bin/rialto-parachain/node/src/chain_spec.rs
deleted file mode 100644
index 6a8e751677df..000000000000
--- a/bridges/bin/rialto-parachain/node/src/chain_spec.rs
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2020-2021 Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-use cumulus_primitives_core::ParaId;
-use rialto_parachain_runtime::{AccountId, AuraId, Signature};
-use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
-use sc_service::ChainType;
-use serde::{Deserialize, Serialize};
-use sp_core::{sr25519, Pair, Public};
-use sp_runtime::traits::{IdentifyAccount, Verify};
-
-/// Specialized `ChainSpec` for the normal parachain runtime.
-pub type ChainSpec =
- sc_service::GenericChainSpec;
-
-/// Helper function to generate a crypto pair from seed
-pub fn get_from_seed(seed: &str) -> ::Public {
- TPublic::Pair::from_string(&format!("//{}", seed), None)
- .expect("static values are valid; qed")
- .public()
-}
-
-/// The extensions for the [`ChainSpec`].
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
-#[serde(deny_unknown_fields)]
-pub struct Extensions {
- /// The relay chain of the Parachain.
- pub relay_chain: String,
- /// The id of the Parachain.
- pub para_id: u32,
-}
-
-impl Extensions {
- /// Try to get the extension from the given `ChainSpec`.
- pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {
- sc_chain_spec::get_extension(chain_spec.extensions())
- }
-}
-
-type AccountPublic = ::Signer;
-
-/// Helper function to generate an account ID from seed
-pub fn get_account_id_from_seed(seed: &str) -> AccountId
-where
- AccountPublic: From<::Public>,
-{
- AccountPublic::from(get_from_seed::(seed)).into_account()
-}
-
-pub fn development_config(id: ParaId) -> ChainSpec {
- // Give your base currency a unit name and decimal places
- let mut properties = sc_chain_spec::Properties::new();
- properties.insert("tokenSymbol".into(), "UNIT".into());
- properties.insert("tokenDecimals".into(), 12.into());
-
- ChainSpec::from_genesis(
- // Name
- "Development",
- // ID
- "dev",
- ChainType::Local,
- move || {
- testnet_genesis(
- get_account_id_from_seed::("Alice"),
- vec![get_from_seed::("Alice"), get_from_seed::("Bob")],
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- ],
- id,
- )
- },
- vec![],
- None,
- None,
- None,
- None,
- Extensions {
- relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
- para_id: id.into(),
- },
- )
-}
-
-pub fn local_testnet_config(id: ParaId) -> ChainSpec {
- // Give your base currency a unit name and decimal places
- let mut properties = sc_chain_spec::Properties::new();
- properties.insert("tokenSymbol".into(), "UNIT".into());
- properties.insert("tokenDecimals".into(), 12.into());
-
- ChainSpec::from_genesis(
- // Name
- "Local Testnet",
- // ID
- "local_testnet",
- ChainType::Local,
- move || {
- testnet_genesis(
- get_account_id_from_seed::