Skip to content
Snippets Groups Projects
Commit 0ab81c90 authored by Martin Pugh's avatar Martin Pugh Committed by GitHub
Browse files

Add CI job to verify extrinsic ordering (#1950)

* WIP: add initial check_extrinsics_ordering.sh script

* iterate through runtimes, add gitlab job

* move job to publish

* temp force build-linux-release to run

* update check_extrinsics_ordering.sh

* maybe we have to fetch release

* use node docker image

* revert before opening pr: force bad extrinsic ordering

* revert commits to prepare for PR

* move job to build stage, use bin from test-linux-release

* remove FIXME

* fix PR nags
parent b1cd13fd
No related merge requests found
......@@ -116,6 +116,9 @@ test-linux-stable: &test
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
TARGET: native
artifacts:
paths:
- ./target/release/polkadot
script:
- ./scripts/gitlab/test_linux_stable.sh
- sccache -s
......@@ -141,6 +144,16 @@ check-runtime-benchmarks: &test
- ./scripts/gitlab/check_runtime_benchmarks.sh
- sccache -s
check-transaction-versions:
image: node:15
stage: build
needs:
- job: test-linux-stable
before_script:
- npm install -g @polkadot/metadata-cmp
- git fetch origin release
script: "scripts/gitlab/check_extrinsics_ordering.sh"
build-wasm-release:
stage: build
<<: *collect-artifacts
......
#!/bin/bash
BIN=./target/release/polkadot
LIVE_WS=wss://rpc.polkadot.io
LOCAL_WS=ws://localhost:9944
# Kill the polkadot client before exiting
trap 'kill "$(jobs -p)"' EXIT
runtimes=(
"westend"
"kusama"
"polkadot"
)
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
if [ "$RUNTIME" = 'polkadot' ]; then
LIVE_WS="wss://rpc.polkadot.io"
else
LIVE_WS="wss://${RUNTIME}-rpc.polkadot.io"
fi
# Start running the local polkadot node in the background
$BIN --chain="$RUNTIME-local" &
jobs
changed_extrinsics=$(
polkadot-js-metadata-cmp "$LIVE_WS" "$LOCAL_WS" \
| sed 's/^ \+//g' | grep -e 'idx: [0-9]\+ -> [0-9]\+'
)
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"
kill "$(jobs -p)"; sleep 5
done
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment