mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#!/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
|
||||
|
||||
Reference in New Issue
Block a user