mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-14 22:35:43 +00:00
Squashed 'bridges/' changes from 23dda62482..407bf44a8a
407bf44a8a add missing license header (#1204) 9babb19810 Custom relay strategy (#1198) c287872a11 fix clippy things (#1200) 3a40e62789 Expose some const value and type (#1186) 32b61476d1 increase sleep before connectingMillau (#1195) aabe7041fa revert messages transactions mortality (#1194) 3651f4f909 Message transactions mortality (#1191) 364d6e155d Bump dependencies (#1180) f0389acc08 cargo +nightly fmt --all (#1192) b270b6a016 Unify error enums in substrate and ethereum clients with `thiserror` (#1094) 58c4946f74 Limit max call size of Rialto/Millau runtimes (#1187) fd56a8cd56 Add UI to the deployment (#1047) 16f01dc736 Westend -> Millau alerts are pending before notifications are sent (#1184) 5628c11ece replace collective flip with babe randomness in Rialto (#1188) 1094a63b00 ignore another (pretty bad) RUSTSEC (#1185) 379fe323ea fix/ignore cargo deny issues (#1183) 92af5e6e64 additional log in finality relay + rephrase "failed" (#1182) b996a3b681 Rialto parachain in test deployments (#1178) 28d9332b44 Resubmit transactions strategy for Polkadot/Kusama (#1175) d0172c6847 Playing with CI (#1179) fb6f42456d fix checks order when registering parachain (#1177) ee828c005a Register-parachain subcommand of substrate-relay (#1170) 8cd2b1a112 Token swap pallet benchmarks (#1174) bb811accb1 fix collision with westend bridge (#1172) 8d2fba70ed add token swaps to test deployments (#1169) b6d1bdfe2c publish rialto parachain collator image (#1171) 834ae4a10a Fix OutboundLaneData types (#1159) 5ee0ea1626 copypasted -> copied (#1168) c3bb835f18 fix spelling (#1167) f90d041dc9 Upgrade `jsonrpsee` to v0.3 (#1051) 598c9b6d0d add some basic tests for swap tokens (#1164) 05e88c61f5 publish images when tag of specific format(e.g. v2021-09-27 + v2021-09-27-1) is published (#1166) 7f3f94a6e0 Fix CI again (#1165) ff37de332f Move calculation relayer reward into `MessageDeliveryAndDispatchPayment` (#1153) 36fbba839b fix clippy warning (#1163) 16da44d018 explicit wasm build (#1158) c9c8226449 Match substrate's fmt (#1148) 2fdd7f3e5e Fix/ignore clippy warnings (#1157) 43dfcc2686 Adding LookupAddress (#1156) 951eaa5582 Add rialto-parachain runtime and node (#1142) 803d266d61 Rename MessageId -> BridgeMessageId (#1152) 5f234484fc Box large arguments of GRANDPA pallet (#1154) cf9abc1011 Fix spelling (#1150) ab83ba2e58 Relay subcommand that performs token RLT <> MLAU token swap (#1141) 832536caf0 Polkadot <> Kusama relayers (#1122) 6d0daa8975 Add `OnMessageAccepted` callback (#1134) 5d03a20b3e Integrate token swap pallet into Millau runtime (#1099) ea4cfa833e Adding MultiAddress type and ValidationCodeHash (#1139) c20325a784 Add tests for `Raw` and `BridgeSendMessage` enum `Call` variants (#1125) 6d802416e2 increase pause before pining Rialto nodes (#1137) b54fa56b62 calculate fee using full message payload (#1132) ca5d8178f5 Add parachain pallets to rialto runtime (#1053) 9eaae4142e fix transaction resubmitter limits for Millau -> Rialto transactions (#1135) 9d4e17783c add --mandatory-headers-only cli option to complex relay (#1129) 1c5e0ec1cb Add local CI info to README (#1131) a8e0929e14 chore: spellchecker fixes (#1130) 3b8e2118e3 set fee for importing mandatory headers to zero (#1127) 49bba9aa52 another bunch of words for spellchecker (#1128) 8a72eafef6 Increase pause before messages generation start (#1126) 1f0ba9a191 Move some associated types from relay_substrate_client::Chain to bp_runtime::Chain (#1087) 74bc1a5b54 Transactions resubmitter (#1083) 21ba001f26 log max balance drop when sending message (#1117) 638a7ddffa Code Cleaning (#1124) be6555c51b Fix buildah logout (#1120) 87539c4a98 Format code work (#1116) 526fe7fdd7 fix spelling (#1119) bd4ce7f241 Fix spelling (#1118) 3c1147858e added missing constants to Kusama/Polkadot primitives (#1114) 52093b22ab Fix delivery transaction estimation used by rational relayer (#1109) 77a2f2fbed Remove fund account checks from upgrade. (#1111) 824334802b Rename param and update comment (#1108) d7784bfe06 Fix spellcheck (#1110) 0b18f5906a Refactor substrate messages source and substrate messages target (#1105) b27240bbff fix compilation (#1107) 9697da4fe8 Emit mortal transactions from relay (#1073) b29396c077 Change vault vars type to env vars (#1084) 35e0bbdc0c Make clippy mandatory. (#1103) a517e8541f Remove unused deps (#1102) 873dae608a Remove unnessary deps (#1101) 13450b74ee Stored conversion rate updater (#1005) 74389829f3 [BREAKING] Migrate messages pallet to frame v2 (#1088) 424da938dd README fix (#1100) 865744c909 upgrade currency exchange pallet to frame v2 (#1097) b5038148b3 Add missing docs (#1095) 0791e911c1 Common crate for substrate-relay (#1082) 3834c9d880 Update high-level-overview.md (#1093) c93553face Increase the time window for messaging alerts. (#1092) 8b9cc3cecd migrate pallet-shift-session-manager to frame v2 (#1090) dc91813c22 migrate eth PoA pallet to frame v2 (#1091) f16bb098cc Migrate dispatch pallet to frame v2 (#1089) 19f4325348 Bridge/This Chain Ids should be exposed as constants on pallet level. (#1085) 6381122df7 Change ChainSpec::from_genesis for Rialto and Millau chains to reflect the chain names. (#1079) 0f1d33e973 Make CI happy again (#1086) 238e65d96f fix typo (#1080) fc008457b6 Token-swap-over-bridge pallet (#944) 3fb97fa5ef Fix full spellcheck (#1076) eae4ed7170 fixed wrong trace (#1075) 219a0fad04 merge two weight-related loops in messages pallet (#1071) fc85632fdb increase_message_fee depends on stored mesage size (#1066) 530f37a23b companion for https://github.com/paritytech/polkadot/pull/3507 (#1067) 53b8cba683 sc_basic_authorship=trace for millau nodes (#1074) 9874e05e98 Improve traces of message generator scripts (#1069) 7b5ee84fbb extract message_details impl into runtime common (#1070) 5a4aed5a8b refund weight for mot pruning messages (#1062) 90e3d1e111 Fix Westend -> Millau sync (#1064) 427d30ddfc When restarting client, also "restart" tokio runtime (#1065) d47c05eeef Change get pipeline sensitive variables from Vault instead of GitLab settings (#1063) d775a85415 use tokio reactor to execute jsonrpsee futures (#1061) 15c8cd61cb Use BABE to author blocks on Rialto (previously: Aura) (#1050) 5186293500 Allow reading suri && password override from file (#1059) b506298262 Update jsonrpsee reference (#1049) 1734d00517 enable weight fee adjustent in Rialto/Millau (#1044) 607265afae Pay dispatch fee at target chain cli option (#1043) ce79ef91be bump dependencies before start referencing polkadot repo (#1048) 924fa24f6d Cli option for greedy relayer + run no-losses relayer by default (#1042) e21eba7b59 Yrong README Fixup + M1 Fixes (#1045) 20d08204a2 Confirm delivery detects when more than expected messages are confirmed (#1039) 994b846b52 pre and post dispatch weights of OnDeliveryConfirmed callback (#1040) 1dd5297e84 give real value to Rialto and Millau tokens (#1038) 035bee8715 Use real conversion rate in greedy relayer strategy (#1035) 9cfaecd0f7 fixed metrics prefix (#1037) 1d8d224937 Use kebab-case for bridge arguments (#1036) f30a4c79a6 Shared reference to conversion rate metric value (#1034) c34d7a5cbb estimate transaction fee (#1015) 93404b18bb change alert period from 2m to 10m for Westend -> Millau (GRANDPA or public node itself is lagging sometimes) (#1032) git-subtree-dir: bridges git-subtree-split: 407bf44a8a5f4e60aceef2dc755cd9ff09929ac3
This commit is contained in:
Executable
+22
@@ -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
|
||||
@@ -1,191 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Run a two node local net with adder-collator.
|
||||
|
||||
set -e
|
||||
|
||||
chainspec="rococo-local"
|
||||
|
||||
# disabled until we can actually successfully register the chain with polkadot-js-api
|
||||
# if ! command -v polkadot-js-api > /dev/null; then
|
||||
# echo "polkadot-js-api required; try"
|
||||
# echo " sudo yarn global add @polkadot/api-cli"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
# shellcheck disable=SC1090
|
||||
source "$(dirname "$0")"/common.sh
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
last_modified_rust_file=$(
|
||||
find . -path ./target -prune -o -type f -name '*.rs' -printf '%T@ %p\n' |
|
||||
sort -nr |
|
||||
head -1 |
|
||||
cut -d' ' -f2-
|
||||
)
|
||||
|
||||
polkadot="target/release/polkadot"
|
||||
adder_collator="target/release/adder-collator"
|
||||
|
||||
# ensure the polkadot binary exists and is up to date
|
||||
if [ ! -x "$polkadot" ] || [ "$polkadot" -ot "$last_modified_rust_file" ]; then
|
||||
cargo build --release
|
||||
fi
|
||||
# likewise for the adder collator
|
||||
if [ ! -x "$adder_collator" ] || [ "$adder_collator" -ot "$last_modified_rust_file" ]; then
|
||||
cargo build --release -p test-parachain-adder-collator
|
||||
fi
|
||||
|
||||
genesis="$(mktemp --directory)"
|
||||
genesis_state="$genesis/state"
|
||||
validation_code="$genesis/validation_code"
|
||||
|
||||
"$adder_collator" export-genesis-state > "$genesis_state"
|
||||
"$adder_collator" export-genesis-wasm > "$validation_code"
|
||||
|
||||
|
||||
# setup variables
|
||||
node_offset=0
|
||||
declare -a node_pids
|
||||
declare -a node_pipes
|
||||
|
||||
# create a sed expression which injects the node name and stream type into each line
|
||||
function make_sed_expr() {
|
||||
name="$1"
|
||||
type="$2"
|
||||
|
||||
printf "s/^/%16s %s: /" "$name" "$type"
|
||||
}
|
||||
|
||||
# turn a string into a flag
|
||||
function flagify() {
|
||||
printf -- '--%s' "$(tr '[:upper:]' '[:lower:]' <<< "$1")"
|
||||
}
|
||||
|
||||
# start a node and label its output
|
||||
#
|
||||
# This function takes a single argument, the node name.
|
||||
# The name must be one of those which can be passed to the polkadot binary, in un-flagged form,
|
||||
# one of:
|
||||
# alice, bob, charlie, dave, eve, ferdie, one, two
|
||||
function run_node() {
|
||||
name="$1"
|
||||
# create a named pipe so we can get the node's PID while also sedding its output
|
||||
local stdout
|
||||
local stderr
|
||||
stdout=$(mktemp --dry-run --tmpdir)
|
||||
stderr=$(mktemp --dry-run --tmpdir)
|
||||
mkfifo "$stdout"
|
||||
mkfifo "$stderr"
|
||||
node_pipes+=("$stdout")
|
||||
node_pipes+=("$stderr")
|
||||
|
||||
# compute ports from offset
|
||||
local port=$((30333+node_offset))
|
||||
local rpc_port=$((9933+node_offset))
|
||||
local ws_port=$((9944+node_offset))
|
||||
local prometheus_port=$((9615+node_offset))
|
||||
node_offset=$((node_offset+1))
|
||||
|
||||
# start the node
|
||||
"$polkadot" \
|
||||
--chain "$chainspec" \
|
||||
--tmp \
|
||||
--port "$port" \
|
||||
--rpc-port "$rpc_port" \
|
||||
--ws-port "$ws_port" \
|
||||
--prometheus-port "$prometheus_port" \
|
||||
--rpc-cors all \
|
||||
"$(flagify "$name")" \
|
||||
> "$stdout" \
|
||||
2> "$stderr" \
|
||||
&
|
||||
local pid=$!
|
||||
node_pids+=("$pid")
|
||||
|
||||
# send output from the stdout pipe to stdout, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "OUT")" "$stdout" >&1 &
|
||||
# send output from the stderr pipe to stderr, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "ERR")" "$stderr" >&2 &
|
||||
}
|
||||
|
||||
# start an adder collator and label its output
|
||||
#
|
||||
# This function takes a single argument, the node name. This affects only the tagging.
|
||||
function run_adder_collator() {
|
||||
name="$1"
|
||||
# create a named pipe so we can get the node's PID while also sedding its output
|
||||
local stdout
|
||||
local stderr
|
||||
stdout=$(mktemp --dry-run --tmpdir)
|
||||
stderr=$(mktemp --dry-run --tmpdir)
|
||||
mkfifo "$stdout"
|
||||
mkfifo "$stderr"
|
||||
node_pipes+=("$stdout")
|
||||
node_pipes+=("$stderr")
|
||||
|
||||
# compute ports from offset
|
||||
local port=$((30333+node_offset))
|
||||
local rpc_port=$((9933+node_offset))
|
||||
local ws_port=$((9944+node_offset))
|
||||
local prometheus_port=$((9615+node_offset))
|
||||
node_offset=$((node_offset+1))
|
||||
|
||||
# start the node
|
||||
"$adder_collator" \
|
||||
--chain "$chainspec" \
|
||||
--tmp \
|
||||
--port "$port" \
|
||||
--rpc-port "$rpc_port" \
|
||||
--ws-port "$ws_port" \
|
||||
--prometheus-port "$prometheus_port" \
|
||||
--rpc-cors all \
|
||||
> "$stdout" \
|
||||
2> "$stderr" \
|
||||
&
|
||||
local pid=$!
|
||||
node_pids+=("$pid")
|
||||
|
||||
# send output from the stdout pipe to stdout, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "OUT")" "$stdout" >&1 &
|
||||
# send output from the stderr pipe to stderr, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "ERR")" "$stderr" >&2 &
|
||||
}
|
||||
|
||||
|
||||
# clean up the nodes when this script exits
|
||||
function finish {
|
||||
for node_pid in "${node_pids[@]}"; do
|
||||
kill -9 "$node_pid"
|
||||
done
|
||||
for node_pipe in "${node_pipes[@]}"; do
|
||||
rm "$node_pipe"
|
||||
done
|
||||
rm -rf "$genesis"
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
# start the nodes
|
||||
run_node Alice
|
||||
run_node Bob
|
||||
run_adder_collator AdderCollator
|
||||
|
||||
# register the adder collator
|
||||
# doesn't work yet due to https://github.com/polkadot-js/tools/issues/185
|
||||
# polkadot-js-api \
|
||||
# --ws ws://localhost:9944 \
|
||||
# --sudo \
|
||||
# --seed "//Alice" \
|
||||
# tx.registrar.registerPara \
|
||||
# 100 \
|
||||
# '{"scheduling":"Always"}' \
|
||||
# "@$validation_code" \
|
||||
# "@$genesis_state"
|
||||
|
||||
# now wait; this will exit on its own only if both subprocesses exit
|
||||
# the practical implication, as both subprocesses are supposed to run forever, is that
|
||||
# this script will also run forever, until killed, at which point the exit trap should kill
|
||||
# the subprocesses
|
||||
wait
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script assumes that all pre-requisites are installed.
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT=`git rev-parse --show-toplevel`
|
||||
source `dirname "$0"`/common.sh
|
||||
|
||||
export CARGO_INCREMENTAL=0
|
||||
|
||||
# Save current directory.
|
||||
pushd .
|
||||
|
||||
cd $ROOT
|
||||
|
||||
for DEMO in "${DEMOS[@]}"
|
||||
do
|
||||
echo "*** Building wasm binaries in $DEMO"
|
||||
cd "$PROJECT_ROOT/$DEMO"
|
||||
|
||||
./build.sh
|
||||
|
||||
cd - >> /dev/null
|
||||
done
|
||||
|
||||
# Restore initial directory.
|
||||
popd
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Script for building only the WASM binary of the given project.
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT=`git rev-parse --show-toplevel`
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "You need to pass the name of the crate you want to compile!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WASM_BUILDER_RUNNER="$PROJECT_ROOT/target/release/wbuild-runner/$1"
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
export WASM_TARGET_DIRECTORY=$(pwd)
|
||||
else
|
||||
export WASM_TARGET_DIRECTORY=$2
|
||||
fi
|
||||
|
||||
if [ -d $WASM_BUILDER_RUNNER ]; then
|
||||
export DEBUG=false
|
||||
export OUT_DIR="$PROJECT_ROOT/target/release/build"
|
||||
cargo run --release --manifest-path="$WASM_BUILDER_RUNNER/Cargo.toml" \
|
||||
| grep -vE "cargo:rerun-if-|Executing build command"
|
||||
else
|
||||
cargo build --release -p $1
|
||||
fi
|
||||
Executable
+19
@@ -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
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ROOT=`dirname "$0"`
|
||||
|
||||
# A list of directories which contain wasm projects.
|
||||
SRCS=(
|
||||
"runtime/wasm"
|
||||
)
|
||||
|
||||
DEMOS=(
|
||||
"test-parachains/"
|
||||
)
|
||||
|
||||
# Make pushd/popd silent.
|
||||
|
||||
pushd () {
|
||||
command pushd "$@" > /dev/null
|
||||
}
|
||||
|
||||
popd () {
|
||||
command popd "$@" > /dev/null
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
api_base="https://api.github.com/repos"
|
||||
|
||||
# Function to take 2 git tags/commits and get any lines from commit messages
|
||||
# that contain something that looks like a PR reference: e.g., (#1234)
|
||||
sanitised_git_logs(){
|
||||
git --no-pager log --pretty=format:"%s" "$1...$2" |
|
||||
# Only find messages referencing a PR
|
||||
grep -E '\(#[0-9]+\)' |
|
||||
# Strip any asterisks
|
||||
sed 's/^* //g'
|
||||
}
|
||||
|
||||
# Checks whether a tag on github has been verified
|
||||
# repo: 'organization/repo'
|
||||
# tagver: 'v1.2.3'
|
||||
# Usage: check_tag $repo $tagver
|
||||
check_tag () {
|
||||
repo=$1
|
||||
tagver=$2
|
||||
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
||||
echo '[+] Fetching tag using privileged token'
|
||||
tag_out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/git/refs/tags/$tagver")
|
||||
else
|
||||
echo '[+] Fetching tag using unprivileged token'
|
||||
tag_out=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/git/refs/tags/$tagver")
|
||||
fi
|
||||
tag_sha=$(echo "$tag_out" | jq -r .object.sha)
|
||||
object_url=$(echo "$tag_out" | jq -r .object.url)
|
||||
if [ "$tag_sha" = "null" ]; then
|
||||
return 2
|
||||
fi
|
||||
echo "[+] Tag object SHA: $tag_sha"
|
||||
verified_str=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$object_url" | jq -r .verification.verified)
|
||||
if [ "$verified_str" = "true" ]; then
|
||||
# Verified, everything is good
|
||||
return 0
|
||||
else
|
||||
# Not verified. Bad juju.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether a given PR has a given label.
|
||||
# repo: 'organization/repo'
|
||||
# pr_id: 12345
|
||||
# label: B1-silent
|
||||
# Usage: has_label $repo $pr_id $label
|
||||
has_label(){
|
||||
repo="$1"
|
||||
pr_id="$2"
|
||||
label="$3"
|
||||
|
||||
# These will exist if the function is called in Gitlab.
|
||||
# If the function's called in Github, we should have GITHUB_ACCESS_TOKEN set
|
||||
# already.
|
||||
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
||||
GITHUB_TOKEN="$GITHUB_RELEASE_TOKEN"
|
||||
elif [ -n "$GITHUB_PR_TOKEN" ]; then
|
||||
GITHUB_TOKEN="$GITHUB_PR_TOKEN"
|
||||
fi
|
||||
|
||||
out=$(curl -H "Authorization: token $GITHUB_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
||||
[ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
||||
}
|
||||
|
||||
github_label () {
|
||||
echo
|
||||
echo "# run github-api job for labeling it ${1}"
|
||||
curl -sS -X POST \
|
||||
-F "token=${CI_JOB_TOKEN}" \
|
||||
-F "ref=master" \
|
||||
-F "variables[LABEL]=${1}" \
|
||||
-F "variables[PRNO]=${CI_COMMIT_REF_NAME}" \
|
||||
-F "variables[PROJECT]=paritytech/polkadot" \
|
||||
"${GITLAB_API}/projects/${GITHUB_API_PROJECT}/trigger/pipeline"
|
||||
}
|
||||
|
||||
# Formats a message into a JSON string for posting to Matrix
|
||||
# message: 'any plaintext message'
|
||||
# formatted_message: '<strong>optional message formatted in <em>html</em></strong>'
|
||||
# Usage: structure_message $content $formatted_content (optional)
|
||||
structure_message() {
|
||||
if [ -z "$2" ]; then
|
||||
body=$(jq -Rs --arg body "$1" '{"msgtype": "m.text", $body}' < /dev/null)
|
||||
else
|
||||
body=$(jq -Rs --arg body "$1" --arg formatted_body "$2" '{"msgtype": "m.text", $body, "format": "org.matrix.custom.html", $formatted_body}' < /dev/null)
|
||||
fi
|
||||
echo "$body"
|
||||
}
|
||||
|
||||
# Post a message to a matrix room
|
||||
# body: '{body: "JSON string produced by structure_message"}'
|
||||
# room_id: !fsfSRjgjBWEWffws:matrix.parity.io
|
||||
# access_token: see https://matrix.org/docs/guides/client-server-api/
|
||||
# Usage: send_message $body (json formatted) $room_id $access_token
|
||||
send_message() {
|
||||
curl -XPOST -d "$1" "https://matrix.parity.io/_matrix/client/r0/rooms/$2/send/m.room.message?access_token=$3"
|
||||
}
|
||||
|
||||
# Pretty-printing functions
|
||||
boldprint () { printf "|\n| \033[1m%s\033[0m\n|\n" "${@}"; }
|
||||
boldcat () { printf "|\n"; while read -r l; do printf "| \033[1m%s\033[0m\n" "${l}"; done; printf "|\n" ; }
|
||||
|
||||
skip_if_companion_pr() {
|
||||
url="https://api.github.com/repos/paritytech/polkadot/pulls/${CI_COMMIT_REF_NAME}"
|
||||
echo "[+] API URL: $url"
|
||||
|
||||
pr_title=$(curl -sSL -H "Authorization: token ${GITHUB_PR_TOKEN}" "$url" | jq -r .title)
|
||||
echo "[+] PR title: $pr_title"
|
||||
|
||||
if echo "$pr_title" | grep -qi '^companion'; then
|
||||
echo "[!] PR is a companion PR. Build is already done in substrate"
|
||||
exit 0
|
||||
else
|
||||
echo "[+] PR is not a companion PR. Proceeding test"
|
||||
fi
|
||||
}
|
||||
|
||||
# Fetches the tag name of the latest release from a repository
|
||||
# repo: 'organisation/repo'
|
||||
# Usage: latest_release 'paritytech/polkadot'
|
||||
latest_release() {
|
||||
curl -s "$api_base/$1/releases/latest" | jq -r '.tag_name'
|
||||
}
|
||||
|
||||
# Check for runtime changes between two commits. This is defined as any changes
|
||||
# to /primitives/src/* and any *production* chains under /runtime
|
||||
has_runtime_changes() {
|
||||
from=$1
|
||||
to=$2
|
||||
|
||||
if git diff --name-only "${from}...${to}" \
|
||||
| grep -q -e '^runtime/polkadot' -e '^runtime/kusama' -e '^primitives/src/' -e '^runtime/common'
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
# metadata
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
ARG IMAGE_NAME
|
||||
|
||||
LABEL io.parity.image.authors="devops-team@parity.io" \
|
||||
io.parity.image.vendor="Parity Technologies" \
|
||||
io.parity.image.title="${IMAGE_NAME}" \
|
||||
io.parity.image.description="polkadot: a platform for web3" \
|
||||
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
|
||||
io.parity.image.revision="${VCS_REF}" \
|
||||
io.parity.image.created="${BUILD_DATE}" \
|
||||
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libssl1.1 \
|
||||
ca-certificates \
|
||||
curl && \
|
||||
# apt cleanup
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
|
||||
# add user and link ~/.local/share/polkadot to /data
|
||||
useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot && \
|
||||
mkdir -p /data /polkadot/.local/share && \
|
||||
chown -R polkadot:polkadot /data && \
|
||||
ln -s /data /polkadot/.local/share/polkadot
|
||||
|
||||
# add polkadot binary to docker image
|
||||
COPY ./polkadot /usr/local/bin
|
||||
|
||||
USER polkadot
|
||||
|
||||
# check if executable works in this container
|
||||
RUN /usr/local/bin/polkadot --version
|
||||
|
||||
EXPOSE 30333 9933 9944
|
||||
VOLUME ["/polkadot"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/polkadot"]
|
||||
@@ -1,47 +0,0 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
# metadata
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
ARG IMAGE_NAME
|
||||
|
||||
LABEL io.parity.image.authors="devops-team@parity.io" \
|
||||
io.parity.image.vendor="Parity Technologies" \
|
||||
io.parity.image.title="${IMAGE_NAME}" \
|
||||
io.parity.image.description="polkadot: a platform for web3" \
|
||||
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
|
||||
io.parity.image.revision="${VCS_REF}" \
|
||||
io.parity.image.created="${BUILD_DATE}" \
|
||||
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libssl1.1 \
|
||||
ca-certificates \
|
||||
curl && \
|
||||
# apt cleanup
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
|
||||
# add user and link ~/.local/share/adder-collator to /data
|
||||
useradd -m -u 1000 -U -s /bin/sh -d /adder-collator adder-collator && \
|
||||
mkdir -p /data /adder-collator/.local/share && \
|
||||
chown -R adder-collator:adder-collator /data && \
|
||||
ln -s /data /adder-collator/.local/share/polkadot
|
||||
|
||||
# add adder-collator binary to docker image
|
||||
COPY ./adder-collator /usr/local/bin
|
||||
|
||||
USER adder-collator
|
||||
|
||||
# check if executable works in this container
|
||||
RUN /usr/local/bin/adder-collator --version
|
||||
|
||||
EXPOSE 30333 9933 9944
|
||||
VOLUME ["/adder-collator"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/adder-collator"]
|
||||
@@ -1,50 +0,0 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
# metadata
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
ARG POLKADOT_VERSION
|
||||
|
||||
LABEL io.parity.image.authors="devops-team@parity.io" \
|
||||
io.parity.image.vendor="Parity Technologies" \
|
||||
io.parity.image.title="parity/polkadot" \
|
||||
io.parity.image.description="polkadot: a platform for web3" \
|
||||
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
|
||||
io.parity.image.revision="${VCS_REF}" \
|
||||
io.parity.image.created="${BUILD_DATE}" \
|
||||
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
libssl1.1 \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg && \
|
||||
useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot && \
|
||||
gpg --recv-keys --keyserver hkps://keys.mailvelope.com 9D4B2B6EB8F97156D19669A9FF0812D491B96798 && \
|
||||
gpg --export 9D4B2B6EB8F97156D19669A9FF0812D491B96798 > /usr/share/keyrings/parity.gpg && \
|
||||
echo 'deb [signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main' > /etc/apt/sources.list.d/parity.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends polkadot=${POLKADOT_VERSION#?} && \
|
||||
# apt cleanup
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* ; \
|
||||
mkdir -p /data /polkadot/.local/share && \
|
||||
chown -R polkadot:polkadot /data && \
|
||||
ln -s /data /polkadot/.local/share/polkadot
|
||||
|
||||
USER polkadot
|
||||
|
||||
# check if executable works in this container
|
||||
RUN /usr/bin/polkadot --version
|
||||
|
||||
EXPOSE 30333 9933 9944
|
||||
VOLUME ["/polkadot"]
|
||||
|
||||
ENTRYPOINT ["/usr/bin/polkadot"]
|
||||
|
||||
@@ -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-lane-00000001_1 \
|
||||
deployments_relay-messages-rialto-to-millau-lane-00000001_1 \
|
||||
deployments_relay-millau-rialto_1 \
|
||||
deployments_relay-headers-westend-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
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
repo="$GITHUB_REPOSITORY"
|
||||
pr="$GITHUB_PR"
|
||||
|
||||
ensure_labels() {
|
||||
for label in "$@"; do
|
||||
if has_label "$repo" "$pr" "$label"; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Must have one of the following labels
|
||||
releasenotes_labels=(
|
||||
'B0-silent'
|
||||
'B1-releasenotes'
|
||||
'B7-runtimenoteworthy'
|
||||
)
|
||||
|
||||
# Must be an ordered list of priorities, lowest first
|
||||
priority_labels=(
|
||||
'C1-low 📌'
|
||||
'C3-medium 📣'
|
||||
'C7-high ❗️'
|
||||
'C9-critical ‼️'
|
||||
)
|
||||
|
||||
audit_labels=(
|
||||
'D1-audited 👍'
|
||||
'D2-notlive 💤'
|
||||
'D3-trivial 🧸'
|
||||
'D5-nicetohaveaudit ⚠️'
|
||||
'D9-needsaudit 👮'
|
||||
)
|
||||
|
||||
echo "[+] Checking release notes (B) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${releasenotes_labels[@]}"; then
|
||||
echo "[+] Release notes label detected. All is well."
|
||||
else
|
||||
echo "[!] Release notes label not detected. Please add one of: ${releasenotes_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[+] Checking release priority (C) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${priority_labels[@]}"; then
|
||||
echo "[+] Release priority label detected. All is well."
|
||||
else
|
||||
echo "[!] Release priority label not detected. Please add one of: ${priority_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if has_runtime_changes "${BASE_SHA}" "${HEAD_SHA}"; then
|
||||
echo "[+] Runtime changes detected. Checking audit (D) labels"
|
||||
if ensure_labels "${audit_labels[@]}"; then
|
||||
echo "[+] Release audit label detected. All is well."
|
||||
else
|
||||
echo "[!] Release audit label not detected. Please add one of: ${audit_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If the priority is anything other than the lowest, we *must not* have a B0-silent
|
||||
# label
|
||||
if has_label "$repo" "$GITHUB_PR" 'B0-silent' &&
|
||||
! has_label "$repo" "$GITHUB_PR" "${priority_labels[0]}"; then
|
||||
echo "[!] Changes with a priority higher than C1-low *MUST* have a B- label that is not B0-Silent"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,118 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'base64'
|
||||
require 'changelogerator'
|
||||
require 'erb'
|
||||
require 'git'
|
||||
require 'json'
|
||||
require 'octokit'
|
||||
require 'toml'
|
||||
require_relative './lib.rb'
|
||||
|
||||
current_ref = ENV['GITHUB_REF']
|
||||
token = ENV['GITHUB_TOKEN']
|
||||
github_client = Octokit::Client.new(
|
||||
access_token: token
|
||||
)
|
||||
|
||||
polkadot_path = ENV['GITHUB_WORKSPACE'] + '/polkadot/'
|
||||
|
||||
# Generate an ERB renderer based on the template .erb file
|
||||
renderer = ERB.new(
|
||||
File.read(ENV['GITHUB_WORKSPACE'] + '/polkadot/scripts/github/polkadot_release.erb'),
|
||||
trim_mode: '<>'
|
||||
)
|
||||
|
||||
# get ref of last polkadot release
|
||||
last_ref = 'refs/tags/' + github_client.latest_release(ENV['GITHUB_REPOSITORY']).tag_name
|
||||
|
||||
polkadot_cl = Changelog.new(
|
||||
'paritytech/polkadot', last_ref, current_ref, token: token
|
||||
)
|
||||
|
||||
# Gets the substrate commit hash used for a given polkadot ref
|
||||
def get_substrate_commit(client, ref)
|
||||
cargo = TOML::Parser.new(
|
||||
Base64.decode64(
|
||||
client.contents(
|
||||
ENV['GITHUB_REPOSITORY'],
|
||||
path: 'Cargo.lock',
|
||||
query: { ref: ref.to_s }
|
||||
).content
|
||||
)
|
||||
).parsed
|
||||
cargo['package'].find { |p| p['name'] == 'sc-cli' }['source'].split('#').last
|
||||
end
|
||||
|
||||
substrate_prev_sha = get_substrate_commit(github_client, last_ref)
|
||||
substrate_cur_sha = get_substrate_commit(github_client, current_ref)
|
||||
|
||||
substrate_cl = Changelog.new(
|
||||
'paritytech/substrate', substrate_prev_sha, substrate_cur_sha,
|
||||
token: token,
|
||||
prefix: true
|
||||
)
|
||||
|
||||
# Combine all changes into a single array and filter out companions
|
||||
all_changes = (polkadot_cl.changes + substrate_cl.changes).reject do |c|
|
||||
c[:title] =~ /[Cc]ompanion/
|
||||
end
|
||||
|
||||
# Set all the variables needed for a release
|
||||
|
||||
misc_changes = Changelog.changes_with_label(all_changes, 'B1-releasenotes')
|
||||
client_changes = Changelog.changes_with_label(all_changes, 'B5-clientnoteworthy')
|
||||
runtime_changes = Changelog.changes_with_label(all_changes, 'B7-runtimenoteworthy')
|
||||
|
||||
# Add the audit status for runtime changes
|
||||
runtime_changes.each do |c|
|
||||
if c[:labels].any? { |l| l[:name] == 'D1-audited 👍' }
|
||||
c[:pretty_title] = "✅ `audited` #{c[:pretty_title]}"
|
||||
next
|
||||
end
|
||||
if c[:labels].any? { |l| l[:name] == 'D2-notlive 💤' }
|
||||
c[:pretty_title] = "✅ `not live` #{c[:pretty_title]}"
|
||||
next
|
||||
end
|
||||
if c[:labels].any? { |l| l[:name] == 'D3-trivial 🧸' }
|
||||
c[:pretty_title] = "✅ `trivial` #{c[:pretty_title]}"
|
||||
next
|
||||
end
|
||||
if c[:labels].any? { |l| l[:name] == 'D5-nicetohaveaudit ⚠️' }
|
||||
c[:pretty_title] = "⏳ `pending non-critical audit` #{c[:pretty_title]}"
|
||||
next
|
||||
end
|
||||
if c[:labels].any? { |l| l[:name] == 'D9-needsaudit 👮' }
|
||||
c[:pretty_title] = "❌ `AWAITING AUDIT` #{c[:pretty_title]}"
|
||||
next
|
||||
end
|
||||
c[:pretty_title] = "⭕️ `unknown audit requirements` #{c[:pretty_title]}"
|
||||
end
|
||||
|
||||
# The priority of users upgraded is determined by the highest-priority
|
||||
# *Client* change
|
||||
release_priority = Changelog.highest_priority_for_changes(client_changes)
|
||||
|
||||
# Pulled from the previous Github step
|
||||
rustc_stable = ENV['RUSTC_STABLE']
|
||||
rustc_nightly = ENV['RUSTC_NIGHTLY']
|
||||
polkadot_runtime = get_runtime('polkadot', polkadot_path)
|
||||
kusama_runtime = get_runtime('kusama', polkadot_path)
|
||||
westend_runtime = get_runtime('westend', polkadot_path)
|
||||
|
||||
# These json files should have been downloaded as part of the build-runtimes
|
||||
# github action
|
||||
|
||||
polkadot_json = JSON.parse(
|
||||
File.read(
|
||||
"#{ENV['GITHUB_WORKSPACE']}/polkadot-srtool-json/polkadot_srtool_output.json"
|
||||
)
|
||||
)
|
||||
|
||||
kusama_json = JSON.parse(
|
||||
File.read(
|
||||
"#{ENV['GITHUB_WORKSPACE']}/kusama-srtool-json/kusama_srtool_output.json"
|
||||
)
|
||||
)
|
||||
|
||||
puts renderer.result
|
||||
@@ -1,12 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# A collection of helper functions that might be useful for various scripts
|
||||
|
||||
# Gets the runtime version for a given runtime.
|
||||
# Optionally accepts a path that is the root of the project which defaults to
|
||||
# the current working directory
|
||||
def get_runtime(runtime, path = '.')
|
||||
File.open(path + "/runtime/#{runtime}/src/lib.rs") do |f|
|
||||
f.find { |l| l =~ /spec_version/ }.match(/[0-9]+/)[0]
|
||||
end
|
||||
end
|
||||
@@ -1,42 +0,0 @@
|
||||
<%= print release_priority[:text] %> <%= puts " due to changes: *#{Changelog.changes_with_label(all_changes, release_priority[:label]).map(&:pretty_title).join(", ")}*" if release_priority[:priority] > 1 %>
|
||||
|
||||
Native runtimes:
|
||||
|
||||
- Polkadot: **<%= polkadot_runtime %>**
|
||||
- Kusama: **<%= kusama_runtime %>**
|
||||
- Westend: **<%= westend_runtime %>**
|
||||
|
||||
This release was tested against the following versions of `rustc`. Other versions may work.
|
||||
|
||||
- <%= rustc_stable %>
|
||||
- <%= rustc_nightly %>
|
||||
|
||||
WASM runtimes built with [srtool](https://github.com/paritytech/srtool) using `<%= polkadot_json['rustc'] %>`.
|
||||
|
||||
Proposal hashes:
|
||||
* `polkadot_runtime-v<%= polkadot_runtime %>.compact.wasm - <%= polkadot_json['prop'] %>`
|
||||
* `kusama_runtime-v<%= kusama_runtime %>.compact.wasm - <%= kusama_json['prop'] %>`
|
||||
|
||||
<% unless misc_changes.empty? %>
|
||||
## Changes
|
||||
|
||||
<% misc_changes.each do |c| %>
|
||||
* <%= c[:pretty_title] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% unless client_changes.empty? %>
|
||||
## Client
|
||||
|
||||
<% client_changes.each do |c| %>
|
||||
* <%= c[:pretty_title] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% unless runtime_changes.empty? %>
|
||||
## Runtime
|
||||
|
||||
<% runtime_changes.each do |c| %>
|
||||
* <%= c[:pretty_title] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
timeout --signal INT 5h cargo hfuzz run $1
|
||||
status=$?
|
||||
|
||||
if [ $status -ne 124 ]; then
|
||||
echo "Found a panic!"
|
||||
# TODO: provide Minimal Reproducible Input
|
||||
# TODO: message on Matrix
|
||||
exit 1
|
||||
else
|
||||
echo "Didn't find any problem in 5 hours of fuzzing"
|
||||
fi
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Include the common functions library
|
||||
#shellcheck source=../common/lib.sh
|
||||
. "$(dirname "${0}")/../common/lib.sh"
|
||||
|
||||
HEAD_BIN=./artifacts/polkadot
|
||||
HEAD_WS=ws://localhost:9944
|
||||
RELEASE_WS=ws://localhost:9945
|
||||
|
||||
runtimes=(
|
||||
"westend"
|
||||
"kusama"
|
||||
"polkadot"
|
||||
)
|
||||
|
||||
# First we fetch the latest released binary
|
||||
latest_release=$(latest_release 'paritytech/polkadot')
|
||||
RELEASE_BIN="./polkadot-$latest_release"
|
||||
echo "[+] Fetching binary for Polkadot version $latest_release"
|
||||
curl -L "https://github.com/paritytech/polkadot/releases/download/$latest_release/polkadot" > "$RELEASE_BIN" || exit 1
|
||||
chmod +x "$RELEASE_BIN"
|
||||
|
||||
|
||||
for RUNTIME in "${runtimes[@]}"; do
|
||||
echo "[+] Checking runtime: ${RUNTIME}"
|
||||
|
||||
release_transaction_version=$(
|
||||
git show "origin/release:runtime/${RUNTIME}/src/lib.rs" | \
|
||||
grep 'transaction_version'
|
||||
)
|
||||
|
||||
current_transaction_version=$(
|
||||
grep 'transaction_version' "./runtime/${RUNTIME}/src/lib.rs"
|
||||
)
|
||||
|
||||
echo "[+] Release: ${release_transaction_version}"
|
||||
echo "[+] Ours: ${current_transaction_version}"
|
||||
|
||||
if [ ! "$release_transaction_version" = "$current_transaction_version" ]; then
|
||||
echo "[+] Transaction version for ${RUNTIME} has been bumped since last release."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Start running the nodes in the background
|
||||
$HEAD_BIN --chain="$RUNTIME-local" --tmp &
|
||||
$RELEASE_BIN --chain="$RUNTIME-local" --ws-port 9945 --tmp &
|
||||
jobs
|
||||
|
||||
# Sleep a little to allow the nodes to spin up and start listening
|
||||
TIMEOUT=5
|
||||
for i in $(seq $TIMEOUT); do
|
||||
sleep 1
|
||||
if [ "$(lsof -nP -iTCP -sTCP:LISTEN | grep -c '994[45]')" == 2 ]; then
|
||||
echo "[+] Both nodes listening"
|
||||
break
|
||||
fi
|
||||
if [ "$i" == $TIMEOUT ]; then
|
||||
echo "[!] Both nodes not listening after $i seconds. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
sleep 5
|
||||
|
||||
changed_extrinsics=$(
|
||||
polkadot-js-metadata-cmp "$RELEASE_WS" "$HEAD_WS" \
|
||||
| sed 's/^ \+//g' | grep -e 'idx: [0-9]\+ -> [0-9]\+' || true
|
||||
)
|
||||
|
||||
if [ -n "$changed_extrinsics" ]; then
|
||||
echo "[!] Extrinsics indexing/ordering has changed in the ${RUNTIME} runtime! If this change is intentional, please bump transaction_version in lib.rs. Changed extrinsics:"
|
||||
echo "$changed_extrinsics"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[+] No change in extrinsics ordering for the ${RUNTIME} runtime"
|
||||
jobs -p | xargs kill; sleep 5
|
||||
done
|
||||
|
||||
# Sleep a little to let the jobs die properly
|
||||
sleep 5
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# check if line width of rust source files is not beyond x characters
|
||||
#
|
||||
set -e
|
||||
|
||||
BASE_BRANCH="origin/master"
|
||||
LINE_WIDTH="121"
|
||||
GOOD_LINE_WIDTH="101"
|
||||
|
||||
git diff --name-only "${BASE_BRANCH}...${CI_COMMIT_SHA}" -- \*.rs | ( while read -r file
|
||||
do
|
||||
if [ ! -f "${file}" ];
|
||||
then
|
||||
echo "Skipping removed file."
|
||||
elif git diff "${BASE_BRANCH}...${CI_COMMIT_SHA}" -- "${file}" | grep -q "^+.\{${LINE_WIDTH}\}"
|
||||
then
|
||||
if [ -z "${FAIL}" ]
|
||||
then
|
||||
echo "| warning!"
|
||||
echo "| Lines should not be longer than 120 characters."
|
||||
echo "| "
|
||||
echo "| see more https://wiki.parity.io/Substrate-Style-Guide"
|
||||
echo "|"
|
||||
FAIL="true"
|
||||
fi
|
||||
echo "| file: ${file}"
|
||||
git diff "${BASE_BRANCH}...${CI_COMMIT_SHA}" -- "${file}" \
|
||||
| grep -n "^+.\{${LINE_WIDTH}\}"
|
||||
echo "|"
|
||||
else
|
||||
if git diff "${BASE_BRANCH}...${CI_COMMIT_SHA}" -- "${file}" | grep -q "^+.\{${GOOD_LINE_WIDTH}\}"
|
||||
then
|
||||
if [ -z "${FAIL}" ]
|
||||
then
|
||||
echo "| warning!"
|
||||
echo "| Lines should be longer than 100 characters only in exceptional circumstances!"
|
||||
echo "| "
|
||||
echo "| see more https://wiki.parity.io/Substrate-Style-Guide"
|
||||
echo "|"
|
||||
fi
|
||||
echo "| file: ${file}"
|
||||
git diff "${BASE_BRANCH}...${CI_COMMIT_SHA}" -- "${file}" \
|
||||
| grep -n "^+.\{${LINE_WIDTH}\}"
|
||||
echo "|"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
test -z "${FAIL}"
|
||||
)
|
||||
@@ -1,203 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Check for any changes in any runtime directories (e.g., ^runtime/polkadot) as
|
||||
# well as directories common to all runtimes (e.g., ^runtime/common). If there
|
||||
# are no changes, check if the Substrate git SHA in Cargo.lock has been
|
||||
# changed. If so, pull the repo and verify if {spec,impl}_versions have been
|
||||
# altered since the previous Substrate version used.
|
||||
#
|
||||
# If there were changes to any runtimes or common dirs, we iterate over each
|
||||
# runtime (defined in the $runtimes() array), and check if {spec,impl}_version
|
||||
# have been changed since the last release.
|
||||
|
||||
set -e # fail on any error
|
||||
|
||||
#Include the common functions library
|
||||
#shellcheck source=../common/lib.sh
|
||||
. "$(dirname "${0}")/../common/lib.sh"
|
||||
|
||||
SUBSTRATE_REPO="https://github.com/paritytech/substrate"
|
||||
SUBSTRATE_REPO_CARGO="git\+${SUBSTRATE_REPO}"
|
||||
SUBSTRATE_VERSIONS_FILE="bin/node/runtime/src/lib.rs"
|
||||
|
||||
# figure out the latest release tag
|
||||
boldprint "make sure we have all tags (including those from the release branch)"
|
||||
git fetch --depth="${GIT_DEPTH:-100}" origin release
|
||||
git fetch --depth="${GIT_DEPTH:-100}" origin 'refs/tags/*:refs/tags/*'
|
||||
LATEST_TAG="$(git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-?[0-9]*$' | sort -V | tail -n 1)"
|
||||
boldprint "latest release tag ${LATEST_TAG}"
|
||||
|
||||
boldprint "latest 10 commits of ${CI_COMMIT_REF_NAME}"
|
||||
git --no-pager log --graph --oneline --decorate=short -n 10
|
||||
|
||||
boldprint "make sure the master branch is available in shallow clones"
|
||||
git fetch --depth="${GIT_DEPTH:-100}" origin master
|
||||
|
||||
|
||||
runtimes=(
|
||||
"kusama"
|
||||
"polkadot"
|
||||
"westend"
|
||||
)
|
||||
|
||||
common_dirs=(
|
||||
"common"
|
||||
)
|
||||
|
||||
# Helper function to join elements in an array with a multi-char delimiter
|
||||
# https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash
|
||||
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
||||
|
||||
boldprint "check if the wasm sources changed since ${LATEST_TAG}"
|
||||
if ! has_runtime_changes "${LATEST_TAG}" "${CI_COMMIT_SHA}"; then
|
||||
boldprint "no changes to any runtime source code detected"
|
||||
# continue checking if Cargo.lock was updated with a new substrate reference
|
||||
# and if that change includes a {spec|impl}_version update.
|
||||
|
||||
SUBSTRATE_REFS_CHANGED="$(
|
||||
git diff "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" Cargo.lock \
|
||||
| sed -n -r "s~^[\+\-]source = \"${SUBSTRATE_REPO_CARGO}#([a-f0-9]+)\".*$~\1~p" | sort -u | wc -l
|
||||
)"
|
||||
|
||||
# check Cargo.lock for substrate ref change
|
||||
case "${SUBSTRATE_REFS_CHANGED}" in
|
||||
(0)
|
||||
boldprint "substrate refs not changed in Cargo.lock"
|
||||
exit 0
|
||||
;;
|
||||
(2)
|
||||
boldprint "substrate refs updated since ${LATEST_TAG}"
|
||||
;;
|
||||
(*)
|
||||
boldprint "check unsupported: more than one commit targeted in repo ${SUBSTRATE_REPO_CARGO}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
||||
SUBSTRATE_PREV_REF="$(
|
||||
git diff "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" Cargo.lock \
|
||||
| sed -n -r "s~^\-source = \"${SUBSTRATE_REPO_CARGO}#([a-f0-9]+)\".*$~\1~p" | sort -u | head -n 1
|
||||
)"
|
||||
|
||||
SUBSTRATE_NEW_REF="$(
|
||||
git diff "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" Cargo.lock \
|
||||
| sed -n -r "s~^\+source = \"${SUBSTRATE_REPO_CARGO}#([a-f0-9]+)\".*$~\1~p" | sort -u | head -n 1
|
||||
)"
|
||||
|
||||
|
||||
boldcat <<EOT
|
||||
previous substrate commit id ${SUBSTRATE_PREV_REF}
|
||||
new substrate commit id ${SUBSTRATE_NEW_REF}
|
||||
EOT
|
||||
|
||||
# okay so now need to fetch the substrate repository and check whether spec_version or impl_version has changed there
|
||||
SUBSTRATE_CLONE_DIR="$(mktemp -t -d substrate-XXXXXX)"
|
||||
trap 'rm -rf "${SUBSTRATE_CLONE_DIR}"' INT QUIT TERM ABRT EXIT
|
||||
|
||||
git clone --depth="${GIT_DEPTH:-100}" --no-tags \
|
||||
"${SUBSTRATE_REPO}" "${SUBSTRATE_CLONE_DIR}"
|
||||
|
||||
# check if there are changes to the spec|impl versions
|
||||
git -C "${SUBSTRATE_CLONE_DIR}" diff \
|
||||
"${SUBSTRATE_PREV_REF}..${SUBSTRATE_NEW_REF}" "${SUBSTRATE_VERSIONS_FILE}" \
|
||||
| grep -E '^[\+\-][[:space:]]+(spec|impl)_version: +([0-9]+),$' || exit 0
|
||||
|
||||
boldcat <<EOT
|
||||
spec_version or or impl_version have changed in substrate after updating Cargo.lock
|
||||
please make sure versions are bumped in polkadot accordingly
|
||||
EOT
|
||||
|
||||
fi
|
||||
|
||||
failed_runtime_checks=()
|
||||
|
||||
# Iterate over each runtime defined at the start of the script
|
||||
for RUNTIME in "${runtimes[@]}"
|
||||
do
|
||||
|
||||
# Check if there were changes to this specific runtime or common directories.
|
||||
# If not, we can skip to the next runtime
|
||||
regex="^runtime/$(join_by '|^runtime/' "$RUNTIME" "${common_dirs[@]}")"
|
||||
if ! git diff --name-only "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" \
|
||||
| grep -E -q -e "$regex"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# check for spec_version updates: if the spec versions changed, then there is
|
||||
# consensus-critical logic that has changed. the runtime wasm blobs must be
|
||||
# rebuilt.
|
||||
|
||||
add_spec_version="$(
|
||||
git diff "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" "runtime/${RUNTIME}/src/lib.rs" \
|
||||
| sed -n -r "s/^\+[[:space:]]+spec_version: +([0-9]+),$/\1/p"
|
||||
)"
|
||||
sub_spec_version="$(
|
||||
git diff "refs/tags/${LATEST_TAG}...${CI_COMMIT_SHA}" "runtime/${RUNTIME}/src/lib.rs" \
|
||||
| sed -n -r "s/^\-[[:space:]]+spec_version: +([0-9]+),$/\1/p"
|
||||
)"
|
||||
|
||||
|
||||
# see if the version and the binary blob changed
|
||||
if [ "${add_spec_version}" != "${sub_spec_version}" ]
|
||||
then
|
||||
|
||||
boldcat <<EOT
|
||||
## RUNTIME: ${RUNTIME} ##
|
||||
|
||||
changes to the ${RUNTIME} runtime sources and changes in the spec version.
|
||||
|
||||
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
||||
|
||||
EOT
|
||||
continue
|
||||
|
||||
else
|
||||
# check for impl_version updates: if only the impl versions changed, we assume
|
||||
# there is no consensus-critical logic that has changed.
|
||||
|
||||
add_impl_version="$(
|
||||
git diff refs/tags/"${LATEST_TAG}...${CI_COMMIT_SHA}" "runtime/${RUNTIME}/src/lib.rs" \
|
||||
| sed -n -r 's/^\+[[:space:]]+impl_version: +([0-9]+),$/\1/p'
|
||||
)"
|
||||
sub_impl_version="$(
|
||||
git diff refs/tags/"${LATEST_TAG}...${CI_COMMIT_SHA}" "runtime/${RUNTIME}/src/lib.rs" \
|
||||
| sed -n -r 's/^\-[[:space:]]+impl_version: +([0-9]+),$/\1/p'
|
||||
)"
|
||||
|
||||
|
||||
# see if the impl version changed
|
||||
if [ "${add_impl_version}" != "${sub_impl_version}" ]
|
||||
then
|
||||
boldcat <<EOT
|
||||
|
||||
## RUNTIME: ${RUNTIME} ##
|
||||
|
||||
changes to the ${RUNTIME} runtime sources and changes in the impl version.
|
||||
|
||||
impl_version: ${sub_impl_version} -> ${add_impl_version}
|
||||
|
||||
EOT
|
||||
continue
|
||||
fi
|
||||
|
||||
failed_runtime_checks+=("$RUNTIME")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#failed_runtime_checks} -gt 0 ]; then
|
||||
boldcat <<EOT
|
||||
wasm source files changed or the spec version in the substrate reference in
|
||||
the Cargo.lock but not the spec/impl version. If changes made do not alter
|
||||
logic, just bump 'impl_version'. If they do change logic, bump
|
||||
'spec_version'.
|
||||
|
||||
source file directories:
|
||||
- runtime
|
||||
|
||||
version files: ${failed_runtime_checks[@]}
|
||||
EOT
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
time cargo check --features runtime-benchmarks
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path cli/Cargo.toml --no-default-features --features browser
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
# build runtime
|
||||
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
|
||||
# make checksum
|
||||
sha256sum target/release/wbuild/*-runtime/target/wasm32-unknown-unknown/release/*.wasm > checksum.sha256
|
||||
# clean up - FIXME: can we reuse some of the artifacts?
|
||||
cargo clean
|
||||
# build again
|
||||
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
|
||||
# confirm checksum
|
||||
sha256sum -c checksum.sha256
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
time cargo test --workspace --release --verbose --locked --features=runtime-benchmarks
|
||||
@@ -1,202 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
# This script is to trigger Simnet pipeline.
|
||||
# See help article for more details.
|
||||
|
||||
SCRIPT_NAME="$0"
|
||||
SCRIPT_PATH=$(dirname "$0") # relative
|
||||
SCRIPT_PATH=$(cd "${SCRIPT_PATH}" && pwd) # absolutized and normalized
|
||||
SIMNET_VERSION=""
|
||||
|
||||
function usage {
|
||||
cat << EOF
|
||||
This script is to trigger Simnet pipeline.
|
||||
It's designed to be launched locally and from CI.
|
||||
The required argumants for both cases are listed below.
|
||||
|
||||
Usage: ${SCRIPT_NAME} OPTION
|
||||
|
||||
OPTIONS
|
||||
|
||||
-h, --help Print this help message.
|
||||
|
||||
Mandatory in both cases:
|
||||
|
||||
-s, --simnet-version Simnet version to trigger.
|
||||
E.g.: v4
|
||||
|
||||
-u, --upstream-project Triggering project.
|
||||
E.g.: polkadot
|
||||
|
||||
-r, --upstream-ref The branch or tag name for which project is built.
|
||||
E.g.: master
|
||||
|
||||
-d, --downstream-id Downstream project's ID to trigger.
|
||||
E.g.: 332 (simnet project id)
|
||||
|
||||
-n, --image-name Name of image to test.
|
||||
E.g.: docker.io/paritypr/synth-wave
|
||||
|
||||
-i, --image-tag Tag of the image to test.
|
||||
E.g.: master
|
||||
|
||||
-c, --collator-image-tag Tag of collator image. Image name is hardcoded.
|
||||
E.g.: master
|
||||
|
||||
Required for local launch:
|
||||
|
||||
-g, --ci-server-fqdn FQDN of your gitlab server.
|
||||
E.g.: gitlab.parity.io
|
||||
|
||||
-t, --trigger-token Gitlab trigger token. This must be defined in
|
||||
project -> settings -> CI/CD -> Pipeline triggers
|
||||
Defaults to CI_JOB_TOKEN
|
||||
https://stackoverflow.com/questions/42746634/gitlab-trigger-api-returns-404
|
||||
|
||||
-a, --access-token Gitlab peronal access token or it defaults to
|
||||
PIPELINE_TOKEN (gitlab variable)
|
||||
https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
|
||||
|
||||
EXAMPLES
|
||||
${SCRIPT_NAME} -s v4
|
||||
${SCRIPT_NAME} --simnet-version=v4
|
||||
|
||||
Local test example. You need to set the 2 vars before running: TR_TOKEN and PERS_TOKEN
|
||||
${SCRIPT_NAME} --simnet-version=v4 \\
|
||||
--upstream-project=polkadot \\
|
||||
--upstream-ref=master \\
|
||||
--image-name=docker.io/paritypr/synth-wave \\
|
||||
--image-tag=master \\
|
||||
--collator-image-tag=master \\
|
||||
--ci-server-fqdn=gitlab.parity.io \\
|
||||
--downstream-id=332 \\
|
||||
--trigger-token="\${TR_TOKEN}" \\
|
||||
--access-token="\${PERS_TOKEN}"
|
||||
EOF
|
||||
}
|
||||
|
||||
function main {
|
||||
# Main entry point for the script.
|
||||
parse_args "$@"
|
||||
check_args
|
||||
trigger_pipeline
|
||||
check_pipeline
|
||||
poll_pipeline
|
||||
}
|
||||
|
||||
function parse_args {
|
||||
# shellcheck disable=SC2214
|
||||
while getopts c:u:r:i:n:g:t:r:a:s:h-: OPT; do
|
||||
# support long options: https://stackoverflow.com/a/28466267/519360
|
||||
if [ "${OPT}" = "-" ]; then # long option: reformulate OPT and OPTARG
|
||||
OPT="${OPTARG%%=*}" # extract long option name
|
||||
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
|
||||
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
|
||||
fi
|
||||
case "${OPT}" in
|
||||
h | help ) usage ; exit 0 ;;
|
||||
s | simnet-version ) needs_arg ; SIMNET_VERSION="${OPTARG}" ;;
|
||||
u | upstream-project ) needs_arg ; TRGR_PROJECT="${OPTARG}" ;;
|
||||
r | upstream-ref ) needs_arg ; TRGR_REF="${OPTARG}" ;;
|
||||
n | image-name ) needs_arg ; IMAGE_NAME="${OPTARG}" ;;
|
||||
i | image-tag ) needs_arg ; IMAGE_TAG="${OPTARG}" ;;
|
||||
c | collator-image-tag ) needs_arg ; COLLATOR_IMAGE_TAG="${OPTARG}" ;;
|
||||
g | ci-server-fqdn ) needs_arg ; CI_SERVER_HOST="${OPTARG}" ;;
|
||||
d | downstream-id ) needs_arg ; DWNSTRM_ID="${OPTARG}" ;;
|
||||
t | trigger-token ) needs_arg ; CI_JOB_TOKEN="${OPTARG}" ;;
|
||||
a | access-token ) needs_arg ; PIPELINE_TOKEN="${OPTARG}" ;;
|
||||
??* ) log DIE "Illegal option --${OPT}" ;; # bad long option
|
||||
? ) exit 2 ;; # bad short option (error reported via getopts)
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1)) # remove parsed options and args from $@ list
|
||||
|
||||
}
|
||||
|
||||
function check_args {
|
||||
if [[ -z "${SIMNET_VERSION}" ]] ; then
|
||||
log DIE "Must specify value for mandatory argument -s,--simnet-version
|
||||
|
||||
$(usage)"
|
||||
fi
|
||||
}
|
||||
|
||||
function needs_arg {
|
||||
if [ -z "${OPTARG}" ]; then
|
||||
log DIE "No arg for --${OPT} option"
|
||||
fi
|
||||
}
|
||||
|
||||
function trigger_pipeline {
|
||||
# API trigger another project's pipeline.
|
||||
log INFO "Triggering Simnet pipeline."
|
||||
|
||||
curl --silent \
|
||||
-X POST \
|
||||
-F "token=${CI_JOB_TOKEN}" \
|
||||
-F "ref=${SIMNET_VERSION}" \
|
||||
-F "variables[TRGR_PROJECT]=${TRGR_PROJECT}" \
|
||||
-F "variables[TRGR_REF]=${TRGR_REF}" \
|
||||
-F "variables[IMAGE_NAME]=${IMAGE_NAME}" \
|
||||
-F "variables[IMAGE_TAG]=${IMAGE_TAG}" \
|
||||
-F "variables[COLLATOR_IMAGE_TAG]=${COLLATOR_IMAGE_TAG}" \
|
||||
"https://${CI_SERVER_HOST}/api/v4/projects/${DWNSTRM_ID}/trigger/pipeline" | \
|
||||
tee pipeline;
|
||||
}
|
||||
|
||||
function check_pipeline {
|
||||
PIPELINE_ID=$(jq ".id" pipeline)
|
||||
PIPELINE_URL=$(jq ".web_url" pipeline)
|
||||
echo
|
||||
log INFO "Simnet pipeline ${PIPELINE_URL} was successfully triggered."
|
||||
log INFO "Now we're polling it to obtain the distinguished status."
|
||||
}
|
||||
|
||||
function poll_pipeline {
|
||||
# This is a workaround for a Gitlab bug, waits here until
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/326137 gets fixed.
|
||||
# The timeout is 360 curls with 8 sec interval, roughly an hour.
|
||||
log INFO "Waiting on ${PIPELINE_ID} status..."
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
for i in {1..360}; do
|
||||
STATUS=$(get_status);
|
||||
log INFO "Triggered pipeline status is ${STATUS}";
|
||||
if [[ ${STATUS} =~ ^(pending|running|created)$ ]]; then
|
||||
echo;
|
||||
elif [[ ${STATUS} =~ ^(failed|canceled|skipped|manual)$ ]]; then
|
||||
log DIE "Something's broken in: ${PIPELINE_URL}";
|
||||
elif [[ ${STATUS} =~ ^(success)$ ]]; then
|
||||
log INFO "Look how green it is: ${PIPELINE_URL}"
|
||||
exit 0
|
||||
else
|
||||
log DIE "Something else has happened in ${PIPELINE_URL}"
|
||||
fi
|
||||
sleep 8;
|
||||
done
|
||||
}
|
||||
|
||||
function get_status() {
|
||||
curl --silent \
|
||||
--header "PRIVATE-TOKEN: ${PIPELINE_TOKEN}" \
|
||||
"https://${CI_SERVER_HOST}/api/v4/projects/${DWNSTRM_ID}/pipelines/${PIPELINE_ID}" | \
|
||||
jq --raw-output ".status";
|
||||
}
|
||||
|
||||
function log {
|
||||
local lvl msg fmt
|
||||
lvl=$1 msg=$2
|
||||
fmt='+%Y-%m-%d %H:%M:%S'
|
||||
lg_date=$(date "${fmt}")
|
||||
if [[ "${lvl}" = "DIE" ]] ; then
|
||||
lvl="ERROR"
|
||||
echo "${lg_date} - ${lvl} - ${msg}"
|
||||
exit 1
|
||||
else
|
||||
echo "${lg_date} - ${lvl} - ${msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "*** Initializing WASM build environment"
|
||||
|
||||
if [ -z $CI_PROJECT_NAME ] ; then
|
||||
rustup update nightly
|
||||
rustup update stable
|
||||
fi
|
||||
|
||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
|
||||
# Install wasm-gc. It's useful for stripping slimming down wasm binaries.
|
||||
command -v wasm-gc || \
|
||||
cargo +nightly install --git https://github.com/alexcrichton/wasm-gc --force
|
||||
@@ -1,12 +0,0 @@
|
||||
name: polkadot
|
||||
version: 0.2
|
||||
appVersion: 0.2.0
|
||||
description: Polkadot Node Implementation
|
||||
home: https://polkadot.network/
|
||||
icon: https://polkadot.network/favicon.ico
|
||||
sources:
|
||||
- https://github.com/paritytech/polkadot/
|
||||
maintainers:
|
||||
- name: Paritytech Devops Team
|
||||
email: devops-team@parity.io
|
||||
tillerVersion: ">=2.8.0"
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
|
||||
# Polkadot Kubernetes Helm Chart
|
||||
|
||||
This [Helm Chart](https://helm.sh/) can be used for deploying containerized
|
||||
**Polkadot** to a [Kubernetes](https://kubernetes.io/) cluster.
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Tested on Kubernetes 1.10.7-gke.6
|
||||
|
||||
## Installation
|
||||
|
||||
To install the chart with the release name `my-release` into namespace
|
||||
`my-namespace` from within this directory:
|
||||
|
||||
```console
|
||||
$ helm install --namespace my-namespace --name my-release --values values.yaml ./
|
||||
```
|
||||
|
||||
The command deploys Polkadot on the Kubernetes cluster in the configuration
|
||||
given in `values.yaml`. When the namespace is omitted it'll be installed in
|
||||
the default one.
|
||||
|
||||
|
||||
## Removal of the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete --namespace my-namespace my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
|
||||
## Upgrading
|
||||
|
||||
Once the chart is installed and a new version should be deployed helm takes
|
||||
care of this by
|
||||
|
||||
```console
|
||||
$ helm upgrade --namespace my-namespace --values values.yaml my-release ./
|
||||
```
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
maxUnavailable: 1
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# see:
|
||||
# https://kubernetes.io/docs/tutorials/services/
|
||||
# https://kubernetes.io/docs/concepts/services-networking/service/
|
||||
# headless service for rpc
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.app }}-rpc
|
||||
spec:
|
||||
ports:
|
||||
- port: 9933
|
||||
name: http-rpc
|
||||
- port: 9944
|
||||
name: websocket-rpc
|
||||
selector:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
sessionAffinity: None
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
---
|
||||
{{- if .Values.listen_node_port }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.app }}
|
||||
spec:
|
||||
ports:
|
||||
- port: 30333
|
||||
name: p2p
|
||||
nodePort: 30333
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
sessionAffinity: None
|
||||
type: NodePort
|
||||
# don't route exteral traffic to non-local pods
|
||||
externalTrafficPolicy: Local
|
||||
{{- else if .Values.validator.keys }}
|
||||
{{- $root := . -}}
|
||||
{{- range until (int .Values.nodes.replicas) }}
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ $root.Values.app }}-{{ . }}
|
||||
spec:
|
||||
selector:
|
||||
statefulset.kubernetes.io/pod-name: {{ $root.Values.app }}-{{ . }}
|
||||
ports:
|
||||
- port: 30333
|
||||
targetPort: 30333
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,10 +0,0 @@
|
||||
{{- if .Values.rbac.enable }}
|
||||
# service account for polkadot pods themselves
|
||||
# no permissions for the api are required
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
name: {{ .Values.rbac.name }}
|
||||
{{- end }}
|
||||
@@ -1,139 +0,0 @@
|
||||
# https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/
|
||||
# https://cloud.google.com/kubernetes-engine/docs/concepts/statefulset
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ .Values.app }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
serviceName: {{ .Values.app }}
|
||||
replicas: {{ .Values.nodes.replicas }}
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
podManagementPolicy: Parallel
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
|
||||
spec:
|
||||
{{- if .Values.rbac.enable }}
|
||||
serviceAccountName: {{ .Values.rbac.name }}
|
||||
{{- else }}
|
||||
serviceAccountName: default
|
||||
{{- end }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.node_group }}
|
||||
{{- if .Values.listen_node_port }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Values.app }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: 300
|
||||
{{- if .Values.validator.keys }}
|
||||
volumes:
|
||||
- name: {{ .Values.app }}-validator-secrets
|
||||
secret:
|
||||
secretName: {{ .Values.app }}-secrets
|
||||
initContainers:
|
||||
- name: prepare-secrets
|
||||
image: busybox
|
||||
command: [ "/bin/sh" ]
|
||||
args:
|
||||
- -c
|
||||
- sed -n -r "s/^${POD_NAME}-key ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/key;
|
||||
sed -n -r "s/^${POD_NAME}-node-key ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/node-key;
|
||||
sed -n -r "s/^${POD_NAME}-name ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/name;
|
||||
test -s {{ .Values.image.basepath }}/name || echo "${POD_NAME}" > {{ .Values.image.basepath }}/name
|
||||
env:
|
||||
# from (workaround for hostname)
|
||||
# https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
volumeMounts:
|
||||
- name: {{ .Values.app }}-validator-secrets
|
||||
readOnly: true
|
||||
mountPath: "/etc/validator"
|
||||
- name: {{ .Values.app }}dir
|
||||
mountPath: {{ .Values.image.basepath }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Values.app }}
|
||||
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
{{- if .Values.resources }}
|
||||
resources:
|
||||
requests:
|
||||
memory: {{ .Values.resources.memory }}
|
||||
cpu: {{ .Values.resources.cpu }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: 30333
|
||||
name: p2p
|
||||
- containerPort: 9933
|
||||
name: http-rpc
|
||||
- containerPort: 9944
|
||||
name: websocket-rpc
|
||||
command: ["/bin/sh"]
|
||||
args:
|
||||
- -c
|
||||
- exec {{ .Values.image.executable }}
|
||||
--base-path {{ .Values.image.basepath }}
|
||||
{{- if .Values.validator.keys }}
|
||||
--validator
|
||||
--name $(cat {{ .Values.image.basepath }}/name)
|
||||
--key $(cat {{ .Values.image.basepath }}/key)
|
||||
--node-key $(cat {{ .Values.image.basepath }}/node-key)
|
||||
{{- else }}
|
||||
--name $(POD_NAME)
|
||||
{{- end }}
|
||||
{{- range .Values.nodes.args }} {{ . }} {{- end }}
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
volumeMounts:
|
||||
- name: {{ .Values.app }}dir
|
||||
mountPath: {{ .Values.image.basepath }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http-rpc
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http-rpc
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: {{ .Values.app }}dir
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
storageClassName: ssd
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# set tag manually --set image.tag=latest
|
||||
image:
|
||||
repository: parity/polkadot
|
||||
tag: latest
|
||||
pullPolicy: Always
|
||||
basepath: /polkadot
|
||||
executable: /usr/local/bin/polkadot
|
||||
|
||||
|
||||
# if set to true a service account for polkadot will be created
|
||||
rbac:
|
||||
enable: true
|
||||
name: polkadot
|
||||
|
||||
# name of the statefulset
|
||||
app: polkadot
|
||||
node_group: polkadot
|
||||
listen_node_port: true
|
||||
|
||||
nodes:
|
||||
replicas: 2
|
||||
args:
|
||||
- --chain
|
||||
- alexander
|
||||
# serve rpc within the local network
|
||||
# - fenced off the world via firewall
|
||||
# - used for health checks
|
||||
- --rpc-external
|
||||
- --ws-external
|
||||
# - --log
|
||||
# - sub-libp2p=trace
|
||||
|
||||
|
||||
validator: {}
|
||||
# providing 'keys' string via --set commandline parameter will run the nodes
|
||||
# in validator mode (--validator).
|
||||
|
||||
# maybe adopt resource limits here to the nodes of the pool
|
||||
# resources:
|
||||
# memory: "5Gi"
|
||||
# cpu: "1.5"
|
||||
|
||||
@@ -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/>.
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
action="$1"
|
||||
config_file="/etc/default/polkadot"
|
||||
|
||||
if [ "$action" = "configure" ]; then
|
||||
# Make user and group
|
||||
getent group polkadot >/dev/null 2>&1 || addgroup --system polkadot
|
||||
getent passwd polkadot >/dev/null 2>&1 ||
|
||||
adduser --system --home /home/polkadot --disabled-password \
|
||||
--ingroup polkadot polkadot
|
||||
if [ ! -e "$config_file" ]; then
|
||||
echo 'POLKADOT_CLI_ARGS=""' > /etc/default/polkadot
|
||||
fi
|
||||
fi
|
||||
@@ -1,36 +0,0 @@
|
||||
[Unit]
|
||||
Description=Polkadot Node
|
||||
After=network.target
|
||||
Documentation=https://github.com/paritytech/polkadot
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/polkadot
|
||||
ExecStart=/usr/bin/polkadot $POLKADOT_CLI_ARGS
|
||||
User=polkadot
|
||||
Group=polkadot
|
||||
Restart=always
|
||||
RestartSec=120
|
||||
CapabilityBoundingSet=
|
||||
LockPersonality=true
|
||||
NoNewPrivileges=true
|
||||
PrivateDevices=true
|
||||
PrivateMounts=true
|
||||
PrivateTmp=true
|
||||
PrivateUsers=true
|
||||
ProtectClock=true
|
||||
ProtectControlGroups=true
|
||||
ProtectHostname=true
|
||||
ProtectKernelModules=true
|
||||
ProtectKernelTunables=true
|
||||
ProtectSystem=strict
|
||||
RemoveIPC=true
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX
|
||||
RestrictNamespaces=true
|
||||
RestrictSUIDSGID=true
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallFilter=~@clock @module @mount @reboot @swap @privileged
|
||||
UMask=0027
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Please provide the number of initial validators!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
generate_account_id() {
|
||||
subkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "Account ID" | awk '{ print $3 }'
|
||||
}
|
||||
|
||||
generate_address() {
|
||||
subkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "SS58 Address" | awk '{ print $3 }'
|
||||
}
|
||||
|
||||
generate_public_key() {
|
||||
subkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "Public" | awk '{ print $4 }'
|
||||
}
|
||||
|
||||
generate_address_and_public_key() {
|
||||
ADDRESS=$(generate_address $1 $2 $3)
|
||||
PUBLIC_KEY=$(generate_public_key $1 $2 $3)
|
||||
|
||||
printf "//$ADDRESS\nhex![\"${PUBLIC_KEY#'0x'}\"].unchecked_into(),"
|
||||
}
|
||||
|
||||
generate_address_and_account_id() {
|
||||
ACCOUNT=$(generate_account_id $1 $2 $3)
|
||||
ADDRESS=$(generate_address $1 $2 $3)
|
||||
if ${4:-false}; then
|
||||
INTO="unchecked_into"
|
||||
else
|
||||
INTO="into"
|
||||
fi
|
||||
|
||||
printf "//$ADDRESS\nhex![\"${ACCOUNT#'0x'}\"].$INTO(),"
|
||||
}
|
||||
|
||||
V_NUM=$1
|
||||
|
||||
AUTHORITIES=""
|
||||
|
||||
for i in $(seq 1 $V_NUM); do
|
||||
AUTHORITIES+="(\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i stash)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i controller)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i babe '--scheme sr25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i grandpa '--scheme ed25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i im_online '--scheme sr25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i para_validator '--scheme sr25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i para_assignment '--scheme sr25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_account_id $i authority_discovery '--scheme sr25519' true)\n"
|
||||
AUTHORITIES+="$(generate_address_and_public_key $i beefy '--scheme ecdsa' true)\n"
|
||||
AUTHORITIES+="),\n"
|
||||
done
|
||||
|
||||
printf "$AUTHORITIES"
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# This script is to be run when we are happy with a release candidate.
|
||||
# It accepts a single argument: version, in the format 'v1.2.3'
|
||||
|
||||
version="$1"
|
||||
if [ -z "$version" ]; then
|
||||
echo "No version specified, cannot continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Version should be in the format v1.2.3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '[+] Checking out the release branch'
|
||||
git checkout release
|
||||
echo '[+] Pulling latest version of the release branch from github'
|
||||
git pull
|
||||
echo '[+] Attempting to merge the release-candidate branch to the release branch'
|
||||
git merge "$version"
|
||||
echo '[+] Tagging the release'
|
||||
git tag -s -m "$version" "$version"
|
||||
echo '[+] Pushing the release branch and tag to Github. A new release will be created shortly'
|
||||
git push origin release
|
||||
git push origin "refs/tags/$version"
|
||||
Executable
+6
@@ -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
|
||||
Executable
+11
@@ -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
@@ -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 millau-to-rialto \
|
||||
--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 millau-to-rialto \
|
||||
--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
@@ -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 rialto-to-millau \
|
||||
--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 rialto-to-millau \
|
||||
--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
|
||||
@@ -1,116 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Run a two node local net.
|
||||
# Unlike the docker-compose script in the /docker folder, this version builds the nodes based
|
||||
# on the current state of the code, instead of depending on a published version.
|
||||
|
||||
set -e
|
||||
|
||||
# chainspec defaults to polkadot-local if no arguments are passed to this script;
|
||||
# if arguments are passed in, the first is the chainspec
|
||||
chainspec="${1:-polkadot-local}"
|
||||
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
# shellcheck disable=SC1090
|
||||
source "$(dirname "$0")"/common.sh
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
last_modified_rust_file=$(
|
||||
find . -path ./target -prune -o -type f -name '*.rs' -printf '%T@ %p\n' |
|
||||
sort -nr |
|
||||
head -1 |
|
||||
cut -d' ' -f2-
|
||||
)
|
||||
|
||||
polkadot="target/release/polkadot"
|
||||
|
||||
# ensure the polkadot binary exists and is up to date
|
||||
if [ ! -x "$polkadot" ] || [ "$polkadot" -ot "$last_modified_rust_file" ]; then
|
||||
cargo build --release
|
||||
fi
|
||||
|
||||
# setup variables
|
||||
node_offset=0
|
||||
declare -a node_pids
|
||||
declare -a node_pipes
|
||||
|
||||
# create a sed expression which injects the node name and stream type into each line
|
||||
function make_sed_expr() {
|
||||
name="$1"
|
||||
type="$2"
|
||||
|
||||
printf "s/^/%8s %s: /" "$name" "$type"
|
||||
}
|
||||
|
||||
# turn a string into a flag
|
||||
function flagify() {
|
||||
printf -- '--%s' "$(tr '[:upper:]' '[:lower:]' <<< "$1")"
|
||||
}
|
||||
|
||||
# start a node and label its output
|
||||
#
|
||||
# This function takes a single argument, the node name.
|
||||
# The name must be one of those which can be passed to the polkadot binary, in un-flagged form,
|
||||
# one of:
|
||||
# alice, bob, charlie, dave, eve, ferdie, one, two
|
||||
function run_node() {
|
||||
name="$1"
|
||||
# create a named pipe so we can get the node's PID while also sedding its output
|
||||
local stdout
|
||||
local stderr
|
||||
stdout=$(mktemp --dry-run --tmpdir)
|
||||
stderr=$(mktemp --dry-run --tmpdir)
|
||||
mkfifo "$stdout"
|
||||
mkfifo "$stderr"
|
||||
node_pipes+=("$stdout")
|
||||
node_pipes+=("$stderr")
|
||||
|
||||
# compute ports from offset
|
||||
local port=$((30333+node_offset))
|
||||
local rpc_port=$((9933+node_offset))
|
||||
local ws_port=$((9944+node_offset))
|
||||
node_offset=$((node_offset+1))
|
||||
|
||||
# start the node
|
||||
"$polkadot" \
|
||||
--chain "$chainspec" \
|
||||
--tmp \
|
||||
--port "$port" \
|
||||
--rpc-port "$rpc_port" \
|
||||
--ws-port "$ws_port" \
|
||||
--rpc-cors all \
|
||||
"$(flagify "$name")" \
|
||||
> "$stdout" \
|
||||
2> "$stderr" \
|
||||
&
|
||||
local pid=$!
|
||||
node_pids+=("$pid")
|
||||
|
||||
# send output from the stdout pipe to stdout, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "OUT")" "$stdout" >&1 &
|
||||
# send output from the stderr pipe to stderr, prepending the node name
|
||||
sed -e "$(make_sed_expr "$name" "ERR")" "$stderr" >&2 &
|
||||
}
|
||||
|
||||
|
||||
# clean up the nodes when this script exits
|
||||
function finish {
|
||||
for node_pid in "${node_pids[@]}"; do
|
||||
kill -9 "$node_pid"
|
||||
done
|
||||
for node_pipe in "${node_pipes[@]}"; do
|
||||
rm "$node_pipe"
|
||||
done
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
# start the nodes
|
||||
run_node Alice
|
||||
run_node Bob
|
||||
|
||||
# now wait; this will exit on its own only if both subprocesses exit
|
||||
# the practical implication, as both subprocesses are supposed to run forever, is that
|
||||
# this script will also run forever, until killed, at which point the exit trap should kill
|
||||
# the subprocesses
|
||||
wait
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exu
|
||||
|
||||
# Set up the standardized machine and run `update-weights.sh` script.
|
||||
# The system is assumed to be pristine Ubuntu 20.04 and we install
|
||||
# all required dependencies.
|
||||
|
||||
# To avoid interruptions you might want to run this script in `screen` cause it will take a while
|
||||
# to finish.
|
||||
|
||||
# We start off with upgrading the system
|
||||
apt update && apt dist-upgrade
|
||||
|
||||
# and installing `git` and other required deps.
|
||||
apt install -y git clang curl libssl-dev llvm libudev-dev screen
|
||||
|
||||
# Now we clone the repository
|
||||
git clone https://github.com/paritytech/parity-bridges-common.git
|
||||
cd parity-bridges-common
|
||||
|
||||
# Install rustup & toolchain
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
|
||||
|
||||
# Source config
|
||||
source ~/.cargo/env
|
||||
|
||||
# Add nightly and WASM
|
||||
rustup install nightly
|
||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
|
||||
# Update the weights
|
||||
./scripts/update-weights.sh
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/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
|
||||
|
||||
time cargo run --release -p millau-bridge-node --features=runtime-benchmarks -- benchmark \
|
||||
--chain=dev \
|
||||
--steps=50 \
|
||||
--repeat=20 \
|
||||
--pallet=pallet_bridge_token_swap \
|
||||
--extrinsic=* \
|
||||
--execution=wasm \
|
||||
--wasm-execution=Compiled \
|
||||
--heap-pages=4096 \
|
||||
--output=./modules/token-swap/src/weights.rs \
|
||||
--template=./.maintain/millau-weight-template.hbs
|
||||
Executable
+10
@@ -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" {} \;
|
||||
Reference in New Issue
Block a user