Squashed 'bridges/' content from commit 89a76998f

git-subtree-dir: bridges
git-subtree-split: 89a76998f93c8219e9b1f785dcce73d4891e7068
This commit is contained in:
Hernando Castano
2021-04-21 11:56:23 -04:00
commit e5bed7ac38
339 changed files with 71658 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
PAT_GPL="^// Copyright.*If not, see <http://www.gnu.org/licenses/>\.$"
PAT_OTHER="^// Copyright"
SCRIPTS_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
for f in $(find . -type f | egrep '\.(c|cpp|rs)$'); do
HEADER=$(head -16 $f)
if [[ $HEADER =~ $PAT_GPL ]]; then
BODY=$(tail -n +17 $f)
cat $SCRIPTS_DIR/license_header > temp
echo "$BODY" >> temp
mv temp $f
elif [[ $HEADER =~ $PAT_OTHER ]]; then
echo "Other license was found do nothing"
else
echo "$f was missing header"
cat $SCRIPTS_DIR/license_header $f > temp
mv temp $f
fi
done
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
set -xeu
echo $CARGO_TARGET_DIR;
mkdir -p $CARGO_TARGET_DIR;
echo "Current Rust nightly version:";
rustc +nightly --version;
echo "Cached Rust nightly version:";
if [ ! -f $CARGO_TARGET_DIR/check_nightly_rust ]; then
echo "" > $CARGO_TARGET_DIR/check_nightly_rust;
fi
cat $CARGO_TARGET_DIR/check_nightly_rust;
if [[ $(cat $CARGO_TARGET_DIR/check_nightly_rust) == $(rustc +nightly --version) ]]; then
echo "The Rust nightly version has not changed";
else
echo "The Rust nightly version has changed. Clearing the cache";
rm -rf $CARGO_TARGET_DIR/*;
fi
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# A script to dump logs from selected important docker containers
# to make it easier to analyze locally.
set -xeu
DATE=$(date +"%Y-%m-%d-%T")
LOGS_DIR="${DATE//:/-}-logs"
mkdir $LOGS_DIR
cd $LOGS_DIR
# From $ docker ps --format '{{.Names}}'
SERVICES=(\
deployments_relay-messages-millau-to-rialto-generator_1 \
deployments_relay-messages-rialto-to-millau-generator_1 \
deployments_relay-messages-millau-to-rialto_1 \
deployments_relay-messages-rialto-to-millau_1 \
deployments_relay-headers-millau-to-rialto_1 \
deployments_relay-headers-rialto-to-millau_1 \
deployments_rialto-node-alice_1 \
deployments_rialto-node-bob_1 \
deployments_millau-node-alice_1 \
deployments_millau-node-bob_1 \
)
for SVC in ${SERVICES[*]}
do
SHORT_NAME="${SVC//deployments_/}"
docker logs $SVC &> $SHORT_NAME.log
done
cd -
tar cvjf $LOGS_DIR.tar.bz2 $LOGS_DIR
+16
View File
@@ -0,0 +1,16 @@
// 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/>.
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
# Run a development instance of the Ethereum to Substrate relay. Needs running
# Substrate and Ethereum nodes in order to work.
RUST_LOG=rpc=trace,bridge=trace ./target/debug/ethereum-poa-relay eth-to-sub
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# This script assumes that an OpenEthereum build is available. The repo
# should be at the same level as the `parity-bridges-common` repo.
RUST_LOG=rpc=trace,txqueue=trace,bridge-builtin=trace \
../openethereum/target/debug/openethereum \
--config="$(pwd)"/deployments/dev/poa-config/poa-node-config \
--node-key=arthur \
--engine-signer=0x005e714f896a8b7cede9d38688c1a81de72a58e4 \
--base-path=/tmp/oe-dev-node \
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Used for manually sending a message to a running network.
#
# You could for example spin up a full network using the Docker Compose files
# we have (to make sure the message relays are running), but remove the message
# generator service. From there you may submit messages manually using this script.
MILLAU_PORT="${RIALTO_PORT:-9945}"
case "$1" in
remark)
RUST_LOG=runtime=trace,substrate-relay=trace,bridge=trace \
./target/debug/substrate-relay send-message MillauToRialto \
--source-host localhost \
--source-port $MILLAU_PORT \
--source-signer //Alice \
--target-signer //Bob \
--lane 00000000 \
--origin Target \
remark \
;;
transfer)
RUST_LOG=runtime=trace,substrate-relay=trace,bridge=trace \
./target/debug/substrate-relay send-message MillauToRialto \
--source-host localhost \
--source-port $MILLAU_PORT \
--source-signer //Alice \
--target-signer //Bob \
--lane 00000000 \
--origin Target \
transfer \
--amount 100000000000000 \
--recipient 5DZvVvd1udr61vL7Xks17TFQ4fi9NiagYLaBobnbPCP14ewA \
;;
*) echo "A message type is require. Supported messages: remark, transfer."; exit 1;;
esac
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Used for manually sending a message to a running network.
#
# You could for example spin up a full network using the Docker Compose files
# we have (to make sure the message relays are running), but remove the message
# generator service. From there you may submit messages manually using this script.
RIALTO_PORT="${RIALTO_PORT:-9944}"
case "$1" in
remark)
RUST_LOG=runtime=trace,substrate-relay=trace,bridge=trace \
./target/debug/substrate-relay send-message RialtoToMillau \
--source-host localhost \
--source-port $RIALTO_PORT \
--target-signer //Alice \
--source-signer //Bob \
--lane 00000000 \
--origin Target \
remark \
;;
transfer)
RUST_LOG=runtime=trace,substrate-relay=trace,bridge=trace \
./target/debug/substrate-relay send-message RialtoToMillau \
--source-host localhost \
--source-port $RIALTO_PORT \
--target-signer //Alice \
--source-signer //Bob \
--lane 00000000 \
--origin Target \
transfer \
--amount 100000000000000 \
--recipient 5DZvVvd1udr61vL7Xks17TFQ4fi9NiagYLaBobnbPCP14ewA \
;;
*) echo "A message type is require. Supported messages: remark, transfer."; exit 1;;
esac
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
#
# Runtime benchmarks for the `pallet-bridge-messages` and `pallet-bridge-grandpa` pallets.
#
# Run this script from root of the repo.
set -eux
time cargo run --release -p rialto-bridge-node --features=runtime-benchmarks -- benchmark \
--chain=dev \
--steps=50 \
--repeat=20 \
--pallet=pallet_bridge_messages \
--extrinsic=* \
--execution=wasm \
--wasm-execution=Compiled \
--heap-pages=4096 \
--output=./modules/messages/src/weights.rs \
--template=./.maintain/rialto-weight-template.hbs
time cargo run --release -p rialto-bridge-node --features=runtime-benchmarks -- benchmark \
--chain=dev \
--steps=50 \
--repeat=20 \
--pallet=pallet_bridge_grandpa \
--extrinsic=* \
--execution=wasm \
--wasm-execution=Compiled \
--heap-pages=4096 \
--output=./modules/grandpa/src/weights.rs \
--template=./.maintain/rialto-weight-template.hbs
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
# One-liner to update between Substrate releases
# Usage: ./update_substrate.sh 2.0.0-rc6 2.0.0
set -xeu
OLD_VERSION=$1
NEW_VERSION=$2
find . -type f -name 'Cargo.toml' -exec sed -i '' -e "s/$OLD_VERSION/$NEW_VERSION/g" {} \;