feat(contracts): bump rollups-contracts to alpha 9 #1483
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
| name: Build | |
| # Push covers the long-lived branches and release tags; pull_request | |
| # covers everything else, including forks (which get no CI at all | |
| # under a bare push trigger). The concurrency group below dedupes. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "next/*" | |
| tags: | |
| - "v*" | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| prt-contracts: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| - name: Install Cartesi Machine | |
| uses: ./.github/actions/cartesi-machine | |
| with: | |
| version: 0.21.0 | |
| suffix-version: "" | |
| # This suite needs the PRT dependencies and the real yield image used by | |
| # its Lua proof generator. Devnet, echo, and Honeypot are E2E inputs. | |
| - name: Prepare PRT state-transition inputs | |
| run: | | |
| just prt-contracts::install-deps | |
| just programs::download-deps | |
| just programs::build-yield | |
| - name: Build, format check and test prt contracts | |
| working-directory: ./prt/contracts | |
| run: | | |
| just check-fmt | |
| just build-smart-contracts | |
| just test-disputes | |
| just test-stf | |
| just test-stf-fuzzy | |
| dave-contracts: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| - name: Download PRT contracts | |
| working-directory: ./prt/contracts | |
| run: | | |
| just install-deps | |
| - name: Download Rollups contracts | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just install-deps | |
| - name: Build, format check and test Dave consensus contracts | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just check-fmt | |
| just build-smart-contracts | |
| just test | |
| prt-honeypot: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| setup-qemu: true | |
| - name: Install Cartesi Machine | |
| uses: ./.github/actions/cartesi-machine | |
| with: | |
| version: 0.21.0 | |
| - name: Download PRT contracts | |
| working-directory: ./prt/contracts | |
| run: | | |
| just install-deps | |
| - name: Download Rollups contracts | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just install-deps | |
| - name: Build devnet | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just build-devnet | |
| - name: Download deps | |
| working-directory: ./test/programs/ | |
| run: | | |
| just download-deps | |
| - name: Rust build | |
| run: | | |
| just build-rust-workspace | |
| - name: Test computation-hash release corpus | |
| timeout-minutes: 10 | |
| run: | | |
| just test-computation-hash-corpus | |
| - name: Build honeypot | |
| working-directory: ./test/programs/ | |
| run: | | |
| just build-honeypot-snapshot | |
| - name: Build echo | |
| working-directory: ./test/programs/ | |
| run: | | |
| just build-echo | |
| - name: Build yield | |
| working-directory: ./test/programs/ | |
| run: | | |
| just build-yield | |
| - name: Test prt-rollups | |
| timeout-minutes: 20 | |
| run: | | |
| just test-rollups-honeypot-ci | |
| # SIGKILL mid-advance-batch; the resumed run must re-execute the | |
| # batch and settle identically to the oracle. | |
| # Cheap (no dispute), and the only e2e that puts a full | |
| # multi-record batch under the kill (the harness default is | |
| # gap 2, small batches). | |
| - name: Test batched catch-up kill | |
| timeout-minutes: 15 | |
| run: | | |
| just test-rollups-kill-ci | |
| # The chaos loop proves the dispute survives SIGKILL/respawn fire. | |
| # Fixed seed: CI is the regression | |
| # net; seed exploration stays in local runs. | |
| - name: Test chaos | |
| timeout-minutes: 15 | |
| env: | |
| CHAOS_SEED: "1" | |
| run: | | |
| just test-rollups-chaos | |
| # The state-transition coverage suite: every on-chain STF shape | |
| # driven through a real dispute (docs/test-harness.md coverage | |
| # matrix). The battery's most valuable net; it rotted once while | |
| # living outside CI. | |
| - name: Test stf_all | |
| timeout-minutes: 60 | |
| run: | | |
| just test-rollups-honeypot-stf | |
| # stf_all cannot statically select the program-timing-dependent closing | |
| # slot that substitutes the pre-input root after RX_REJECTED. | |
| - name: Test rejected-input revert transition | |
| timeout-minutes: 30 | |
| run: | | |
| just rollups-tests::test-yield-case stf_revert | |
| - name: Show failing log | |
| if: failure() | |
| run: | | |
| echo '▼▼▼ failing-step dave.log ▼▼▼' | |
| cat ./test/e2e/rollups/dave.log | |
| echo '▲▲▲ end log ▲▲▲' | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y --no-install-recommends \ | |
| build-essential git wget curl \ | |
| libslirp-dev \ | |
| libclang-dev \ | |
| liblua5.4-dev lua5.4 lua-check \ | |
| xxd jq sqlite3 libc6 clang | |
| # The from-source emulator build dominates this job. Cache both the | |
| # prepared tree and its verified preparation state so a hit preserves | |
| # Make's incremental inputs instead of republishing generated sources. | |
| - name: Emulator cache key | |
| id: emulator-key | |
| run: | | |
| echo "emulator=$(git rev-parse HEAD:machine/emulator)" >> "$GITHUB_OUTPUT" | |
| lifecycle=$( | |
| git hash-object \ | |
| .github/workflows/build.yml \ | |
| machine/justfile \ | |
| machine/script/cartesi-machine-source.sh | | |
| sha256sum | cut -d ' ' -f 1 | |
| ) | |
| echo "lifecycle=$lifecycle" >> "$GITHUB_OUTPUT" | |
| - name: Cache emulator build | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| machine/emulator | |
| target/machine-source/prepared-generated-sources | |
| key: emulator-build-${{ runner.os }}-${{ steps.emulator-key.outputs.emulator }}-${{ steps.emulator-key.outputs.lifecycle }} | |
| # Source acquisition and verification belong to the machine lifecycle; | |
| # CI only installs the resulting native build. The upstream prefix is | |
| # /usr, matching the paths shipped by the release package. | |
| - name: Install Cartesi Machine | |
| run: | | |
| just machine::prepare-release | |
| just machine::prepare-boost | |
| make -C machine/emulator -j"$(nproc)" release=yes slirp=no | |
| sudo make -C machine/emulator release=yes slirp=no install | |
| test -f /usr/lib/libcartesi.a | |
| test -f /usr/include/cartesi-machine/cm.h | |
| echo "LIBCARTESI_PATH=/usr/lib" >> "$GITHUB_ENV" | |
| echo "INCLUDECARTESI_PATH=/usr/include/cartesi-machine" >> "$GITHUB_ENV" | |
| # Rust integration tests consume echo, yield, and the devnet bundle. | |
| # Honeypot belongs only to the E2E lane above. | |
| - name: Prepare Rust test inputs | |
| run: | | |
| just prt-contracts::install-deps | |
| just rollups-contracts::install-deps | |
| just rollups-contracts::build-devnet | |
| just programs::download-deps | |
| just programs::build-programs | |
| # Keep Rust and Lua failures legible here. Contract and build-tooling | |
| # portions of `just check` have their own jobs or focused scripts. | |
| - name: Rust fmt and check | |
| run: | | |
| just check-fmt-rust-workspace | |
| just check-rust-workspace | |
| - name: Clippy | |
| run: | | |
| just clippy-rust-workspace | |
| - name: Lua lint | |
| run: | | |
| just lint-lua | |
| - name: Lua client unit tests | |
| run: | | |
| just test-lua-client | |
| - name: Build tooling regressions | |
| run: | | |
| just test-build-tooling | |
| - name: Rust build | |
| run: | | |
| just build-rust-workspace | |
| - name: Rust test workspace | |
| run: | | |
| just test-rust-workspace | |
| - name: Engine machine integration tests | |
| run: | | |
| just test-engine-machine | |
| build-release-node: | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| target: x86_64-unknown-linux-gnu | |
| os: ubuntu-24.04 | |
| - arch: arm64 | |
| target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.os }} | |
| container: | |
| image: rust:1.90-trixie | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Setup dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends \ | |
| build-essential git wget curl \ | |
| liblua5.4-dev lua5.4 \ | |
| libslirp-dev libboost1.83-dev \ | |
| libclang-dev \ | |
| xxd jq sqlite3 | |
| - name: Install dependency for ARM | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| apt-get install -y --no-install-recommends \ | |
| g++-aarch64-linux-gnu | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| setup-qemu: false | |
| setup-rust: false | |
| - name: Contracts | |
| run: | | |
| just -f prt/contracts/justfile install-deps | |
| just -f cartesi-rollups/contracts/justfile install-deps | |
| just bind | |
| - name: Prepare Cartesi Machine source | |
| run: | | |
| just machine::prepare-release | |
| just machine::prepare-boost | |
| - name: Cartesi Machine Sys | |
| working-directory: machine/rust-bindings | |
| run: | | |
| cargo build --release -p cartesi-machine-sys --target ${{ matrix.target }} | |
| - name: Exercise Cartesi Machine source provider | |
| working-directory: machine/rust-bindings | |
| run: | | |
| cargo test --release -p cartesi-machine --target ${{ matrix.target }} \ | |
| machine::tests::test_sync_and_rename_stored_reject_invalid_and_missing_paths \ | |
| -- --exact | |
| - name: Build release | |
| run: | | |
| cargo build --release -p cartesi-rollups-prt-node --target ${{ matrix.target }} | |
| cp -v ./target/${{ matrix.target }}/release/cartesi-rollups-prt-node cartesi-rollups-prt-node | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: cartesi-rollups-prt-node-linux-${{ matrix.arch }} | |
| path: | | |
| ./cartesi-rollups-prt-node | |
| if-no-files-found: error | |
| retention-days: 1 | |
| release-node: | |
| needs: [prt-contracts, dave-contracts, prt-honeypot, build, build-release-node, release-contracts] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| - arch: arm64 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Create directory | |
| run: mkdir -p upload | |
| - name: Extract version from tag | |
| id: extract_version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: cartesi-rollups-prt-node-linux-${{ matrix.arch }} | |
| - name: Change node binary file permissions | |
| run: chmod 755 cartesi-rollups-prt-node | |
| - name: Compress node binary | |
| run: tar -czf "$FILEPATH" cartesi-rollups-prt-node | |
| env: | |
| FILEPATH: upload/cartesi-rollups-prt-${{ steps.extract_version.outputs.version }}-node-${{ matrix.arch }}.tar.gz | |
| - name: Upload assets to release on GitHub | |
| run: gh release upload "$TAG" upload/* --clobber | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ github.ref_name }} | |
| release-contracts: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| - name: Create directory | |
| run: | | |
| mkdir -p upload | |
| - name: Extract version from tag | |
| id: extract_version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=0.0.0-dev" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| id: setup | |
| - name: Build PRT Core contracts | |
| working-directory: ./prt/contracts | |
| run: | | |
| just install-deps | |
| forge clean | |
| forge build src | |
| - name: Build Cartesi Rollups PRT contracts | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just install-deps | |
| forge clean | |
| forge build src | |
| - name: Compress contract artifacts | |
| run: tar -czf "$FILEPATH" prt/contracts/out cartesi-rollups/contracts/out | |
| env: | |
| FILEPATH: upload/cartesi-rollups-prt-${{ steps.extract_version.outputs.version }}-contract-artifacts.tar.gz | |
| - name: Simulate deployment to supported testnets and mainnets | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| ./script/deploy-testnets.sh | |
| ./script/deploy-mainnets.sh | |
| - name: Compress testnet and mainnet deployment simulation artifacts | |
| run: tar -czf "$FILEPATH" -C cartesi-rollups/contracts deployments | |
| env: | |
| FILEPATH: upload/cartesi-rollups-prt-${{ steps.extract_version.outputs.version }}-deployment-addresses.tar.gz | |
| - name: Build devnet | |
| working-directory: ./cartesi-rollups/contracts | |
| run: | | |
| just build-devnet | |
| - name: Compress complete devnet bundle | |
| run: | | |
| tar -czf "$FILEPATH" -C cartesi-rollups/contracts \ | |
| deployments/31337 state.json state.fingerprint | |
| env: | |
| FILEPATH: upload/cartesi-rollups-prt-${{ steps.extract_version.outputs.version }}-anvil-${{ steps.setup.outputs.installed-foundry-version }}.tar.gz | |
| - name: Upload packaged contract artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: contract-release-assets | |
| path: upload/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| publish-contracts: | |
| needs: [prt-contracts, dave-contracts, prt-honeypot, build, build-release-node, release-contracts] | |
| runs-on: ubuntu-24.04 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: contract-release-assets | |
| path: upload | |
| - name: Upload contract assets to release on GitHub | |
| run: gh release upload "$TAG" upload/* --clobber | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ github.ref_name }} |