revive: cap remaining_gas to u64::MAX in substrate_execution #44022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Checks that doesn't require heavy lifting, like formatting, linting, etc. | |
| name: quick-checks | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| isdraft: | |
| uses: ./.github/workflows/reusable-isdraft.yml | |
| preflight: | |
| needs: isdraft | |
| uses: ./.github/workflows/reusable-preflight.yml | |
| fmt: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Cargo fmt | |
| id: required | |
| run: cargo +nightly fmt --all -- --check | |
| - name: Stop all workflows if failed | |
| if: ${{ failure() && steps.required.conclusion == 'failure' && !github.event.pull_request.head.repo.fork }} | |
| uses: ./.github/actions/workflow-stopper | |
| with: | |
| app-id: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_ID }} | |
| app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }} | |
| check-dependency-rules: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: check dependency rules | |
| run: | | |
| cd substrate/ | |
| ../.gitlab/ensure-deps.sh | |
| check-zepter: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: fetch deps | |
| run: | | |
| # Pull all dependencies eagerly: | |
| time cargo metadata --format-version=1 --locked > /dev/null | |
| - name: Install newer Zepter | |
| run: | | |
| cargo install [email protected] --locked -q | |
| - name: run zepter | |
| run: | | |
| zepter --version | |
| time zepter run check | |
| test-rust-features: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: run rust features | |
| run: bash .gitlab/rust-features.sh . | |
| check-toml-format: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: check toml format | |
| run: | | |
| taplo format --check --config .config/taplo.toml | |
| echo "Please run `taplo format --config .config/taplo.toml` to fix any toml formatting issues" | |
| check-workspace: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: install python deps | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y python3-pip python3 | |
| pip3 install toml "cargo-workspace>=1.2.6" | |
| - name: check integrity | |
| run: > | |
| python3 .github/scripts/check-workspace.py . | |
| --exclude | |
| "substrate/frame/contracts/fixtures/build" | |
| "substrate/frame/contracts/fixtures/contracts/common" | |
| - name: deny git deps | |
| run: python3 .github/scripts/deny-git-deps.py . | |
| check-markdown: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: "18.x" | |
| registry-url: "https://npm.pkg.github.com" | |
| scope: "@paritytech" | |
| - name: Install tooling | |
| run: | | |
| npm install -g markdownlint-cli | |
| markdownlint --version | |
| - name: Check Markdown | |
| env: | |
| CONFIG: .github/.markdownlint.yaml | |
| run: | | |
| echo "Checking markdown formatting. More info: docs/contributor/markdown_linting.md" | |
| echo "To fix potential erros, you can run 'markdownlint --config .github/.markdownlint.yaml -f --ignore target .' locally." | |
| markdownlint --config "$CONFIG" --ignore target . | |
| check-umbrella: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: install python deps | |
| run: pip3 install "cargo-workspace>=1.2.4" toml | |
| - name: Install newer Zepter | |
| run: | | |
| cargo install [email protected] --locked -q && zepter --version | |
| - name: check umbrella correctness | |
| run: | | |
| # Fixes "detected dubious ownership" error in the ci | |
| git config --global --add safe.directory '*' | |
| # Ensure jq is installed | |
| if ! command -v jq &> /dev/null; then | |
| echo "Installing jq..." | |
| apt-get update && apt-get install -y jq | |
| fi | |
| # Extract the umbrella crate version dynamically from cargo metadata | |
| UMBRELLA_VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.manifest_path | endswith("umbrella/Cargo.toml")) | .version') | |
| if [ -z "$UMBRELLA_VERSION" ]; then | |
| echo "Warning: Could not determine umbrella version from cargo metadata, using fallback version 0.1.0" | |
| UMBRELLA_VERSION="0.1.0" | |
| fi | |
| echo "Using umbrella crate version: $UMBRELLA_VERSION" | |
| python3 scripts/generate-umbrella.py --sdk . --version "$UMBRELLA_VERSION" | |
| cargo +nightly fmt -p polkadot-sdk | |
| if [ -n "$(git status --porcelain)" ]; then | |
| cat <<EOF | |
| 👋 Hello developer! Apparently you added a new crate that is not part of the umbrella crate? | |
| You can just apply the patch (git apply PATCH_NAME) that was printed to make this CI check succeed. | |
| Otherwise feel free to ask in the Merge Request or in Matrix chat. | |
| EOF | |
| git diff | |
| exit 1 | |
| fi | |
| check-fail-ci: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| container: | |
| # there's no "rg" in ci-unified, and tools is a smaller image anyway | |
| image: "paritytech/tools:latest" | |
| # paritytech/tools uses "nonroot" user by default, which doesn't have enough | |
| # permissions to create GHA context | |
| options: --user root | |
| steps: | |
| - name: Fetch latest code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Check | |
| run: | | |
| set +e | |
| rg --line-number --hidden --type rust --glob '!{.git,target}' "$ASSERT_REGEX" .; exit_status=$? | |
| if [ $exit_status -eq 0 ]; then | |
| echo "$ASSERT_REGEX was found, exiting with 1"; | |
| exit 1; | |
| else | |
| echo "No $ASSERT_REGEX was found, exiting with 0"; | |
| exit 0; | |
| fi | |
| env: | |
| ASSERT_REGEX: "FAIL-CI" | |
| GIT_DEPTH: 1 | |
| check-invisible-chars: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Check for invisible Unicode characters | |
| run: | | |
| # Detects dangerous invisible Unicode characters that can be used for: | |
| # - Trojan Source attacks (bidi controls) | |
| # - Hidden text/logic (zero-width chars, tags) | |
| # - Confusable whitespace | |
| # | |
| # Exceptions (allowed in emoji sequences): | |
| # - U+200D (ZWJ) when between non-ASCII chars | |
| # - U+FE0E/FE0F (variation selectors) when following non-ASCII | |
| FOUND=0 | |
| # Pattern: Invisible chars EXCEPT ZWJ and variation selectors | |
| INVISIBLE='[\x{00AD}\x{034F}\x{061C}\x{115F}\x{1160}\x{17B4}\x{17B5}\x{180B}-\x{180F}\x{1680}\x{2000}-\x{200C}\x{200E}\x{200F}\x{2028}\x{2029}\x{202A}-\x{202F}\x{205F}-\x{206F}\x{2800}\x{3000}\x{3164}\x{FEFF}\x{FFF0}-\x{FFFC}\x{1BCA0}-\x{1BCA3}\x{1D173}-\x{1D17A}\x{E0000}-\x{E0FFF}]' | |
| # ZWJ must be surrounded by non-ASCII on both sides (emoji joining) | |
| BARE_ZWJ='(?<![^\x00-\x7F])\x{200D}|\x{200D}(?![^\x00-\x7F])' | |
| # Variation selectors must follow non-ASCII (emoji style modifier) | |
| BARE_VS='(?<![^\x00-\x7F])[\x{FE00}-\x{FE0F}\x{E0100}-\x{E01EF}]' | |
| echo "Scanning for invisible Unicode characters..." | |
| if grep -rPnI --exclude-dir='.git' --exclude-dir='target' "$INVISIBLE" .; then | |
| FOUND=1 | |
| fi | |
| if grep -rPnI --exclude-dir='.git' --exclude-dir='target' "$BARE_ZWJ" .; then | |
| FOUND=1 | |
| fi | |
| if grep -rPnI --exclude-dir='.git' --exclude-dir='target' "$BARE_VS" .; then | |
| FOUND=1 | |
| fi | |
| if [ "$FOUND" -eq 1 ]; then | |
| echo "" | |
| echo "==========================================" | |
| echo "ERROR: Found invisible Unicode characters!" | |
| echo "==========================================" | |
| echo "" | |
| echo "These characters can be used for Trojan Source attacks or cause subtle bugs." | |
| echo "Please remove them from your code." | |
| exit 1 | |
| else | |
| echo "No invisible Unicode characters found." | |
| exit 0 | |
| fi | |
| check-readme: | |
| runs-on: ubuntu-latest | |
| needs: isdraft | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Install prerequisites | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler | |
| - name: Set rust version from env file | |
| run: | | |
| RUST_VERSION=$(cat .github/env | sed -E 's/.*ci-unified:([^-]+)-([^-]+).*/\2/') | |
| echo $RUST_VERSION | |
| echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV | |
| - name: Install Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| with: | |
| cache: false | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std | |
| - name: Find README.docify.md files and check generated READMEs | |
| run: .github/scripts/check-missing-readme-generation.sh | |
| confirm-required-checks-quick-jobs-passed: | |
| runs-on: ubuntu-latest | |
| name: All quick checks passed | |
| # If any new job gets added, be sure to add it to this array | |
| needs: | |
| - fmt | |
| - check-dependency-rules | |
| - check-zepter | |
| - test-rust-features | |
| - check-toml-format | |
| - check-workspace | |
| - check-markdown | |
| - check-umbrella | |
| - check-fail-ci | |
| - check-invisible-chars | |
| - check-readme | |
| if: always() && !cancelled() | |
| steps: | |
| - run: | | |
| tee resultfile <<< '${{ toJSON(needs) }}' | |
| FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) | |
| if [ $FAILURES -gt 0 ]; then | |
| echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| else | |
| echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY | |
| fi |