Unverified Commit 265eb897 authored by Hernando Castano's avatar Hernando Castano
Browse files

Remove messed up bridges subtree

parent 89e7b9c4
version: 1
update_configs:
- package_manager: "rust:cargo"
directory: "/"
update_schedule: "weekly"
ignored_updates:
- match:
dependency_name: "sp-*"
- match:
dependency_name: "sc-*"
- match:
dependency_name: "substrate-*"
- match:
dependency_name: "frame-*"
- match:
dependency_name: "pallet-*"
automerged_updates:
- match:
update_type: "all"
version_requirement_updates: "auto"
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
name: Cargo deny
on:
pull_request:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
tags:
- v*
paths-ignore:
- '**/README.md'
- diagrams/*
- docs/*
jobs:
cargo-deny:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Cargo deny
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: "check --hide-inclusion-graph"
name: Check style
on:
pull_request:
push:
branches:
- master
tags:
- v*
paths-ignore:
- '**/README.md'
- diagrams/*
- docs/*
schedule: # Weekly build
- cron: '0 0 * * 0'
jobs:
## Check stage
check-fmt:
name: Check RustFmt
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Add rustfmt
run: rustup component add rustfmt
- name: rust-fmt check
uses: actions-rs/cargo@master
with:
command: fmt
args: --all -- --check
name: Publish Dependencies to Docker hub
on:
push:
tags:
- v*
paths-ignore:
- '**/README.md'
- diagrams/*
- docs/*
schedule: # Weekly build
- cron: '0 0 * * 0'
jobs:
## Publish to Docker hub
publish:
name: Publishing
runs-on: ubuntu-latest
container:
image: docker:git
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Build and push dependencies
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: paritytech/bridge-dependencies
dockerfile: deployments/BridgeDeps.Dockerfile
tag_with_ref: true
tag_with_sha: true
labels:
org.opencontainers.image.source="https://github.com/paritytech/parity-bridges-common",
org.opencontainers.image.authors="devops-team@parity.io",
org.opencontainers.image.vendor="Parity Technologies",
org.opencontainers.image.url="https://github.com/paritytech/parity-bridges-common",
org.opencontainers.image.documentation="https://github.com/paritytech/parity-bridges-common/README.md",
org.opencontainers.image.title=${{ matrix.project }},
org.opencontainers.image.description="${{ matrix.project }} - component of Parity Bridges Common",
org.opencontainers.image.licenses="GPL-3.0 License"
add_git_labels: true
name: Publish images to Docker hub
on:
push:
tags:
- v*
paths-ignore:
- '**/README.md'
- diagrams/*
- docs/*
schedule: # Nightly build
- cron: '0 1 * * *'
jobs:
## Publish to Docker hub
publish:
name: Publishing
strategy:
matrix:
project:
- rialto-bridge-node
- millau-bridge-node
- ethereum-poa-relay
- substrate-relay
include:
- project: rialto-bridge-node
healthcheck: http://localhost:9933/health
- project: millau-bridge-node
healthcheck: http://localhost:9933/health
- project: ethereum-poa-relay
healthcheck: http://localhost:9616/metrics
- project: substrate-relay
healthcheck: http://localhost:9616/metrics
runs-on: ubuntu-latest
container:
image: docker:git
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Set vars
id: vars
run: |
echo ::set-output name=DATE::$(date +%d-%m-%Y)
if [[ ${GITHUB_REF} = refs/tags/* ]]
then
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
else
echo ::set-output name=TAG::nightly-$(date +%d-%m-%Y)
fi
- name: Build and push ${{ matrix.project }}
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: paritytech/${{ matrix.project }}
build_args: PROJECT=${{ matrix.project }}, HEALTH=${{ matrix.healthcheck }}
tags: ${{ steps.vars.outputs.TAG }}, latest
labels:
org.opencontainers.image.created=${{ steps.vars.outputs.DATE }},
org.opencontainers.image.source="https://github.com/paritytech/parity-bridges-common",
org.opencontainers.image.authors="devops-team@parity.io",
org.opencontainers.image.vendor="Parity Technologies",
org.opencontainers.image.url="https://github.com/paritytech/parity-bridges-common",
org.opencontainers.image.documentation="https://github.com/paritytech/parity-bridges-common/README.md",
org.opencontainers.image.version=${{ steps.vars.outputs.TAG }},
org.opencontainers.image.title=${{ matrix.project }},
org.opencontainers.image.description="${{ matrix.project }} - component of Parity Bridges Common",
org.opencontainers.image.licenses="GPL-3.0 License"
add_git_labels: true
name: Compilation and Testing Suite
on:
pull_request:
push:
branches:
- master
tags:
- v*
paths-ignore:
- '**/README.md'
- diagrams/*
- docs/*
schedule: # Weekly build
- cron: '0 0 * * 0'
jobs:
## Check Stage
check-test:
name: Check and test
strategy:
matrix:
toolchain:
- stable
#- beta
- nightly
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
NIGHTLY: nightly #if necessary, specify the version, nightly-2020-10-04, etc.
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Install Toolchain
run: rustup toolchain add $NIGHTLY
- name: Add WASM Utilities
run: rustup target add wasm32-unknown-unknown --toolchain $NIGHTLY
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
- name: Checking rust-${{ matrix.toolchain }}
uses: actions-rs/cargo@master
with:
command: check
toolchain: ${{ matrix.toolchain }}
args: --all --verbose
## Test Stage
- name: Testing rust-${{ matrix.toolchain }}
uses: actions-rs/cargo@master
if: matrix.toolchain == 'stable'
with:
command: test
toolchain: ${{ matrix.toolchain }}
args: --all --verbose
## Check Node Benchmarks
- name: Check Rialto benchmarks runtime ${{ matrix.platform }} rust-${{ matrix.toolchain }}
uses: actions-rs/cargo@master
with:
command: check
toolchain: ${{ matrix.toolchain }}
args: --manifest-path ./bin/rialto/node/Cargo.toml --no-default-features --features runtime-benchmarks --verbose
- name: Check Millau benchmarks runtime ${{ matrix.platform }} rust-${{ matrix.toolchain }}
uses: actions-rs/cargo@master
with:
command: check
toolchain: ${{ matrix.toolchain }}
args: --manifest-path ./bin/millau/node/Cargo.toml --no-default-features --features runtime-benchmarks --verbose
## Build Stage
build:
name: Build
strategy:
matrix:
toolchain:
- stable
#- beta
- nightly
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
NIGHTLY: nightly #if necessary, specify the version, nightly-2020-10-04, etc.
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Install Toolchain
run: rustup toolchain add $NIGHTLY
- name: Add WASM Utilities
run: rustup target add wasm32-unknown-unknown --toolchain $NIGHTLY
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
- name: Building rust-${{ matrix.toolchain }}
uses: actions-rs/cargo@master
if: github.ref == 'refs/heads/master'
with:
command: build
toolchain: ${{ matrix.toolchain }}
args: --all --verbose
- name: Prepare artifacts
if: github.ref == 'refs/heads/master'
run: |
mkdir -p ./artifacts;
mv -v target/debug/rialto-bridge-node ./artifacts/;
mv -v target/debug/millau-bridge-node ./artifacts/;
mv -v target/debug/ethereum-poa-relay ./artifacts/;
mv -v target/debug/substrate-relay ./artifacts/;
shell: bash
- name: Upload artifacts
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.toolchain }}.zip
path: artifacts/
## Linting Stage
clippy:
name: Clippy
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
NIGHTLY: nightly #if necessary, specify the version, nightly-2020-10-04, etc.
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 5
submodules: recursive
- name: Install Toolchain
run: rustup toolchain add $NIGHTLY
- name: Add WASM Utilities
run: rustup target add wasm32-unknown-unknown --toolchain $NIGHTLY
- name: Add clippy
run: rustup component add clippy --toolchain $NIGHTLY
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
- name: Clippy
uses: actions-rs/cargo@master
with:
command: clippy
toolchain: nightly #if necessary, specify the version, nightly-2020-10-04, etc.
args: --all-targets -- -D warnings
**/target/
**/.env
**/.env2
**/rust-toolchain
**/*.rs.bk
*.o
*.so
*.rlib
*.dll
.gdb_history
*.exe
.DS_Store
.idea
.vscode
*.iml
*.swp
*.swo
// Copyright 2019-2020 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 <http://www.gnu.org/licenses/>.
//! 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 Rialto node and recommended hardware.
pub struct RialtoWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
{{~#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}}
}
This diff is collapsed.
# 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.
# This first stage prepares our dependencies to be built by `cargo-chef`.
FROM rust as planner
WORKDIR /parity-bridges-common
RUN cargo install cargo-chef --version 0.1.13
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# This second stage is where the dependencies actually get built.
# The reason we split it from the first stage is so that the `COPY . .`
# step doesn't blow our cache.
FROM paritytech/bridge-dependencies AS cacher
WORKDIR /parity-bridges-common
RUN cargo install cargo-chef --version 0.1.13
COPY --from=planner /parity-bridges-common/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# In this third stage we go ahead and build the actual binary we want.
# This should be fairly quick since the dependencies are being built and
# cached in the previous stage.
FROM paritytech/bridge-dependencies as builder
WORKDIR /parity-bridges-common
RUN cargo install cargo-chef --version 0.1.13
COPY . .
COPY --from=cacher /parity-bridges-common/target target
COPY --from=cacher $CARGO_HOME $CARGO_HOME
ARG PROJECT=ethereum-poa-relay
RUN cargo build --release --verbose -p ${PROJECT}
RUN 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 ubuntu:xenial as runtime
# show backtraces
ENV RUST_BACKTRACE 1
RUN set -eux; \
apt-get update && \
apt-get install -y libssl-dev curl
RUN groupadd -g 1000 user \
&& useradd -u 1000 -g user -s /bin/sh -m user
# switch to non-root user
USER user
WORKDIR /home/user
ARG PROJECT=ethereum-poa-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"]
This diff is collapsed.
# Parity Bridges Common
This is a collection of components for building bridges.
These components include Substrate pallets for syncing headers, passing arbitrary messages, as well
as libraries for building relayers to provide cross-chain communication capabilities.
Three bridge nodes are also available. The nodes can be used to run test networks which bridge other
Substrate chains or Ethereum Proof-of-Authority chains.