Commit 9781c79a authored by Hernando Castano's avatar Hernando Castano
Browse files

Squashed 'bridges/' content from commit 89a76998f

git-subtree-dir: bridges
git-subtree-split: 89a76998f93c8219e9b1f785dcce73d4891e7068
parents
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-*"
- match:
dependency_name: "node-inspect"
automerged_updates:
- match:
update_type: "all"
version_requirement_updates: "auto"
**/target/
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:
- '**.md'
- diagrams/*
- docs/*
jobs:
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing CI:
continue-on-error: ${{ matrix.checks == 'advisories' }}
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 ${{ matrix.checks }}
name: Check style
on:
pull_request:
push:
branches:
- master
tags:
- v*
paths-ignore:
- '**.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:
- '**.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@v2
with:
fetch-depth: 5
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=paritytech/bridge-dependencies
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
fi
TAGS=${DOCKER_IMAGE}:${VERSION}
TAGS=$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}
echo ::set-output name=TAGS::${TAGS}
echo ::set-output name=DATE::$(date +%d-%m-%Y)
- name: Build and push
uses: docker/build-push-action@v2
with:
file: deployments/BridgeDeps.Dockerfile
push: true
cache-from: type=registry,ref=paritytech/bridge-dependencies:latest
cache-to: type=inline
tags: ${{ steps.prep.outputs.TAGS }}
labels: |
org.opencontainers.image.title=bridge-dependencies
org.opencontainers.image.description=bridge-dependencies - component of Parity Bridges Common
org.opencontainers.image.source=${{ github.event.repository.html_url }}
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.created=${{ steps.prep.outputs.DATE }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.authors=devops-team@parity.io
org.opencontainers.image.vendor=Parity Technologies
org.opencontainers.image.licenses=GPL-3.0 License
name: Publish images to Docker hub
on:
push:
tags:
- v*
paths-ignore:
- '**.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
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@v2
with:
fetch-depth: 5
submodules: recursive
- name: Prepare
id: prep
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
fi
TAGS="${VERSION} sha-${GITHUB_SHA::8} latest"
echo ::set-output name=TAGS::${VERSION}
echo ::set-output name=TAGS::${TAGS}
echo ::set-output name=DATE::$(date +%d-%m-%Y)
- name: Workaround rootless build
run: |
sudo apt-get install fuse-overlayfs
mkdir -vp ~/.config/containers
printf "[storage.options]\nmount_program=\"/usr/bin/fuse-overlayfs\"" > ~/.config/containers/storage.conf
- name: Build image for ${{ matrix.project }}
uses: redhat-actions/buildah-build@v2.2
with:
image: ${{ matrix.project }}
tags: ${{ steps.prep.outputs.TAGS }}
dockerfiles: ./Dockerfile
build-args: |
PROJECT=${{ matrix.project }}
HEALTH=${{ matrix.healthcheck }}
VCS_REF=sha-${GITHUB_SHA::8}
BUILD_DATE=${{ steps.prep.outputs.DATE }}
VERSION=${{ steps.prep.outputs.VERSION }}
- name: Push ${{ matrix.project }} image to docker.io
id: push-to-dockerhub
uses: redhat-actions/push-to-registry@v2.1.1
with:
registry: docker.io/paritytech
image: ${{ matrix.project }}
tags: ${{ steps.prep.outputs.TAGS }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Check the image
run: |
echo "New image has been pushed to ${{ steps.push-to-dockerhub.outputs.registry-path }}"
name: Compilation and Testing Suite
on:
pull_request:
push:
branches:
- master
tags:
- v*
paths-ignore:
- '**.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-2021-04-10
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
NIGHTLY: nightly-2021-04-10 #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: 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: -p rialto-runtime --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: -p millau-runtime --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-2021-04-10 #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: 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-2021-04-10 #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-2021-04-10 #if necessary, specify the version, nightly-2020-10-04, etc.
args: --all-targets -- -D warnings
**/target/
**/.env
**/.env2
**/rust-toolchain
hfuzz_target
hfuzz_workspace
**/Cargo.lock
**/*.rs.bk
*.o
*.so
*.rlib
*.dll
.gdb_history
*.exe
.DS_Store
.idea
.vscode
*.iml
*.swp
*.swo
// 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 <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}}
}
# 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