Skip to content

fix(ethexe): Fix critical bug of prefix iterating RocksDB ( #4285 ) #693

fix(ethexe): Fix critical bug of prefix iterating RocksDB ( #4285 )

fix(ethexe): Fix critical bug of prefix iterating RocksDB ( #4285 ) #693

Workflow file for this run

name: Build
on:
workflow_call:
inputs:
macos:
type: boolean
default: false
win-native:
type: boolean
default: false
release:
type: boolean
default: false
production:
type: boolean
default: false
workflow_dispatch:
inputs:
title:
type: string
description: "Pull request title that triggers this workflow."
number:
type: string
description: "Pull request number that triggers this workflow"
release:
type: boolean
default: false
production:
type: boolean
default: false
run-name: ${{ inputs.title }} ( ${{ format('#{0}', inputs.number) }} )
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
BINARYEN_VERSION: version_111
jobs:
dynamic-profiles:
runs-on: ubuntu-latest
outputs:
profiles: ${{ steps.set-matrix.outputs.profiles }}
steps:
- id: set-matrix
run: |
profiles='{"name": "debug", "flags": ""}'
if [ "${{ inputs.release }}" = "true" ]; then
profiles+=', {"name": "release", "flags": "--release"}'
fi
profiles="[${profiles}]"
echo "Profiles: ${profiles}"
echo "profiles=${profiles}" >> $GITHUB_OUTPUT
linux:
runs-on: [kuberunner, github-runner-02]
needs: dynamic-profiles
strategy:
matrix:
profiles: ${{ fromJson(needs.dynamic-profiles.outputs.profiles) }}
fail-fast: false
name: linux (${{ matrix.profiles.name }})
env:
LLVM_PROFILE_FILE: "gear-%p-%m.profraw"
RUSTUP_HOME: /tmp/rustup_home
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Set cargo path"
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH
- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1
- name: "Install: Foundry"
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: "Show: Versioning"
run: |
./scripts/gear.sh show
forge --version
- name: "Build: Init"
run: ./scripts/gear.sh init cargo
- name: "Build: Node"
run: ./scripts/gear.sh build node --release --locked
- name: "Build: Gear"
run: ./scripts/gear.sh build gear --locked ${{ matrix.profiles.flags }}
- name: "Build fuzzer"
run: ./scripts/gear.sh build fuzz --locked ${{ matrix.profiles.flags }}
- name: "Check: Vara runtime imports"
run: ./target/${{ matrix.profiles.name }}/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm
- name: "Check: Stack height limit"
# no need to run check twice
if: ${{ matrix.profiles.flags == 'release' }}
run: cargo run -p calc-stack-height --release --locked
- name: "Test: Gear workspace"
run: ./scripts/gear.sh test gear --locked ${{ matrix.profiles.flags }}
- name: "Test: gsdk tests"
run: ./scripts/gear.sh test gsdk ${{ matrix.profiles.flags }}
- name: "Test: `gcli`"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/gear.sh test gcli --locked --retries 3 ${{ matrix.profiles.flags }}
- name: "Test: Client tests"
run: ./scripts/gear.sh test client ${{ matrix.profiles.flags }}
- name: "Test: Benchmarks in native"
run: |
# fast benchmark tests before long run
cargo test -p "pallet-*" --features runtime-benchmarks,runtime-benchmarks-checkers --locked ${{ matrix.profiles.flags }} bench
- name: "Test: Benchmarks in WASM"
# unoptimized benchmarks take a few hours to run
if: ${{ matrix.profile == 'release' }}
run: |
cargo build -p gear-cli --features=runtime-benchmarks,runtime-benchmarks-checkers ${{ matrix.profiles.flags }}
# check that perf benchmarks works. `--steps=5` need to test, that benchmarks works for different input number.
./target/${{ matrix.profiles.name }}/gear benchmark pallet --chain=dev --pallet="*" --steps=5 --repeat=0 --extrinsic="*" --heap-pages=4096
# check that read_big_state benchmarks works
./target/${{ matrix.profiles.name }}/gear benchmark pallet --chain=dev --pallet=pallet_gear --repeat=0 --extrinsic="read_big_state" --heap-pages=4096 --extra
# check that signal_stack_limit_exceeded_works benchmarks works
./target/${{ matrix.profiles.name }}/gear benchmark pallet --chain=dev --pallet=pallet_gear --repeat=0 --extrinsic="signal_stack_limit_exceeded_works" --heap-pages=4096 --extra
# check that check/test benchmarks works
./target/${{ matrix.profiles.name }}/gear benchmark pallet --chain=dev --pallet=pallet_gear --repeat=0 --extrinsic="check_all" --heap-pages=4096 --extra
- name: "Test: Syscalls Wasmi integrity"
run: ./scripts/gear.sh test syscalls ${{ matrix.profiles.flags }}
- name: "Test: `try-runtime` feature tests"
run: |
cargo test -p "pallet-*" --features try-runtime --locked ${{ matrix.profiles.flags }}
- name: "Test: Try runtime migrations"
run: |
echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.4/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
echo "---------- Building vara runtime ----------"
time cargo build -p vara-runtime -F std,try-runtime --locked ${{ matrix.profiles.flags }}
echo "---------- Executing on-runtime-upgrade for Vara ----------"
time ./try-runtime --runtime ./target/${{ matrix.profiles.name }}/wbuild/vara-runtime/vara_runtime.wasm on-runtime-upgrade --checks=all --no-weight-warnings --disable-spec-version-check live --uri ws://rpc-private.vara-network.io:9944
sleep 5
env:
RUST_LOG: info,pallet=debug
- name: "Build: Production binaries"
if: ${{ inputs.production && matrix.profiles.name == 'release' }}
run: cargo build -p gear-cli -F cli --profile production
- name: Prepare artifacts
if: ${{ inputs.production && matrix.profiles.name == 'release' }}
run: |
mkdir -p artifact
tar czvf artifact/examples.tar.gz target/wasm32-unknown-unknown/release/*.wasm
cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm artifact/
cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/
cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/
cp target/production/gear artifact/
cp target/release/wasm-proc artifact/
strip artifact/gear || true
strip artifact/wasm-proc || true
- name: Upload artifacts
if: ${{ github.event_name == 'push' && inputs.production && matrix.profiles.name == 'release' }}
uses: actions/upload-artifact@v4
with:
path: artifact
win-cross:
runs-on: [kuberunner, github-runner-03]
needs: dynamic-profiles
strategy:
matrix:
profiles: ${{ fromJson(needs.dynamic-profiles.outputs.profiles) }}
fail-fast: false
name: win-cross (${{ matrix.profiles.name }})
env:
XWIN_ARCH: x86_64
RUSTUP_HOME: /tmp/rustup_home
WINEDEBUG: fixme-all
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Set cargo path"
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH
- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1
- name: "Install: MSVC target"
run: rustup target add x86_64-pc-windows-msvc
- name: "Install: cargo config"
run: cp ./.github/build-win-cross/config.toml ${CARGO_HOME:-~/.cargo}/config.toml
- name: "Show: Versioning"
run: ./scripts/gear.sh show
- name: "Install: Wine"
run: |
wineboot
winetricks win10
- name: "Install: LLVM"
run: |
sudo ./.github/build-win-cross/update-alternatives-clang.sh 12 100
- name: "Install: binaryen"
run: |
sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C .
sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/
- name: "Install: cargo-xwin"
run: |
curl -L https://github.com/rust-cross/cargo-xwin/releases/download/v0.14.0/cargo-xwin-v0.14.0.x86_64-unknown-linux-musl.tar.gz | tar zxf -
mv ./cargo-xwin ${CARGO_HOME:-~/.cargo}/bin/
- name: "Build: Node"
run: ./scripts/gear.sh build node --release --locked
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
- name: "Check: Stack height limit"
# no need to run check twice
if: ${{ matrix.profiles.name == 'release' }}
run: cargo xwin run -p calc-stack-height --release --locked
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
# These tests randomly stops responding
#- name: "Test: Client tests"
# run: |
# cp ./target/x86_64-pc-windows-msvc/release/gear.exe ./target/release/
# ./scripts/gear.sh test client
# env:
# CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
- name: "Test: Lazy pages"
run: >-
cargo xwin test
-p "pallet-*"
-p gear-lazy-pages
-p gear-runtime-interface
${{ matrix.profiles.flags }}
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
win-native:
needs: [dynamic-profiles, linux]
if: ${{ !cancelled() && (github.ref == 'refs/heads/master' || inputs.win-native) }}
uses: ./.github/workflows/build-win-native.yml
with:
profiles: ${{ needs.dynamic-profiles.outputs.profiles }}
macos:
needs: [dynamic-profiles, linux]
if: ${{ !cancelled() && inputs.macos }}
uses: ./.github/workflows/build-macos.yml
with:
profiles: ${{ needs.dynamic-profiles.outputs.profiles }}