[testnet] Cache execution state when staging blocks. (#5367) (#5388) #20353
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: Rust | |
| on: | |
| push: | |
| branches: [ 'devnet_*', 'testnet_*' ] | |
| merge_group: | |
| pull_request: | |
| branches: | |
| - "**" | |
| workflow_dispatch: | |
| # This allows a subsequently queued workflow run to interrupt previous runs on pull requests | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}' | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUST_BACKTRACE: full | |
| # We allow redundant explicit links because `cargo rdme` doesn't know how to resolve implicit intra-crate links. | |
| RUSTDOCFLAGS: -A rustdoc::redundant_explicit_links -D warnings | |
| RUSTFLAGS: -D warnings | |
| RUSTUP_MAX_RETRIES: 10 | |
| RUST_LOG: linera=info | |
| RUST_LOG_FORMAT: plain | |
| LINERA_STORAGE_SERVICE: 127.0.0.1:1235 | |
| LINERA_WALLET: /tmp/local-linera-net/wallet_0.json | |
| LINERA_KEYSTORE: /tmp/local-linera-net/keystore_0.json | |
| LINERA_STORAGE: rocksdb:/tmp/local-linera-net/client_0.db | |
| LINERA_FAUCET_URL: http://localhost:8079 | |
| permissions: | |
| contents: read | |
| jobs: | |
| # paths-ignore within a pull_request doesn't work well with merge_group, so we need to use a custom filter. | |
| changed-files: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-run: ${{ steps.files-changed.outputs.paths }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Filter paths | |
| uses: dorny/paths-filter@v3 | |
| id: files-changed | |
| with: | |
| predicate-quantifier: 'every' | |
| filters: | | |
| paths: | |
| - '!docker/**' | |
| - '!docker_scylla/**' | |
| - '!configuration/**' | |
| - '!kubernetes/**' | |
| - '!CONTRIBUTING.md' | |
| - '!INSTALL.md' | |
| - '!docs/**' | |
| - '!mdbook/**' | |
| remote-net-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest-8-cores | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run the storage-service instance | |
| run: | | |
| cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE & | |
| - name: Wait for storage service to be ready | |
| run: until nc -z ${LINERA_STORAGE_SERVICE/:/ }; do sleep 1; done | |
| - name: Build binaries | |
| run: | | |
| cargo build --features storage-service --bin linera-server --bin linera-proxy --bin linera | |
| - name: Run the validators | |
| run: | | |
| mkdir /tmp/local-linera-net | |
| cargo run --features storage-service --bin linera -- net up --storage service:tcp:$LINERA_STORAGE_SERVICE:table --policy-config testnet --path /tmp/local-linera-net --validators 2 --shards 2 & | |
| - name: Create two epochs and run the faucet | |
| # See https://github.com/linera-io/linera-protocol/pull/2835 for details. | |
| run: | | |
| mkdir /tmp/linera-faucet | |
| cargo run --bin linera -- resource-control-policy --http-request-timeout-ms 1000 | |
| cargo run --bin linera -- resource-control-policy --http-request-timeout-ms 500 | |
| cargo run --bin linera -- faucet --storage-path /tmp/linera-faucet/faucet_storage.sqlite --amount 1000 --port 8079 & | |
| - name: Wait for faucet to be ready | |
| run: | | |
| until curl -s http://localhost:8079 >/dev/null; do sleep 1; done | |
| - name: Run the remote-net tests | |
| run: | | |
| cargo test -p linera-service remote_net_grpc --features remote-net | |
| execution-wasmtime-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Run some extra execution tests with wasmtime | |
| run: | | |
| cargo test --locked -p linera-execution --features wasmtime | |
| metrics-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Run metrics tests | |
| run: | | |
| cargo test --locked -p linera-base --features metrics,opentelemetry | |
| wasm-application-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run Wasm application tests | |
| run: | | |
| cd examples | |
| cargo test --locked | |
| linera-sdk-tests-fixtures: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run linera-sdk fixtures | |
| run: | | |
| cd linera-sdk/tests/fixtures | |
| cargo test --locked | |
| - name: Run linera-sdk tests application lints | |
| run: | | |
| cd linera-sdk/tests/fixtures | |
| cargo fmt -- --check | |
| cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked | |
| default-features-and-witty-integration-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest-8-cores | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Compile Wasm test modules for Witty integration tests | |
| run: | | |
| cargo build -p linera-witty-test-modules --target wasm32-unknown-unknown | |
| - name: Run all tests using the default features (except storage-service) | |
| run: | | |
| # TODO(#2764): Actually link this to the default features | |
| cargo test --no-default-features --features fs,macros,wasmer,rocksdb --locked | |
| - name: Run Witty integration tests | |
| run: | | |
| cargo test -p linera-witty --features wasmer,wasmtime | |
| check-outdated-cli-md: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for outdated CLI.md | |
| run: | | |
| if ! diff CLI.md <(cargo run --bin linera -- help-markdown) | |
| then | |
| echo '`CLI.md` differs from the output of `linera help-markdown`' | |
| echo 'Run `linera help-markdown > CLI.md` to update it.' | |
| exit 1 | |
| fi | |
| benchmark-test: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run the storage-service instance | |
| run: | | |
| cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE & | |
| - name: Wait for storage service to be ready | |
| run: | | |
| until nc -z 127.0.0.1 1235; do sleep 1; done | |
| - name: Run the benchmark test | |
| run: | | |
| cargo build --locked -p linera-service --bin linera-benchmark --features storage-service,opentelemetry | |
| cargo test --locked -p linera-service --features storage-service,opentelemetry benchmark | |
| ethereum-tests: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - uses: foundry-rs/foundry-toolchain@v1.4.0 | |
| - name: Ensure Solc Directory Exists | |
| run: mkdir -p /home/runner/.solc | |
| - name: Cache Solc | |
| id: cache-solc | |
| uses: actions/cache@v4 | |
| with: | |
| path: /home/runner/.solc | |
| key: solc-v0.8.25 | |
| restore-keys: solc- | |
| - name: Get Solc | |
| if: ${{ steps.cache-solc.outputs.cache-hit != 'true' }} | |
| uses: ./.github/actions/get-solc | |
| with: | |
| version: v0.8.25 | |
| - name: Add Solc to PATH | |
| run: echo "/home/runner/.solc" >> $GITHUB_PATH | |
| - name: List the content of the Solc cache | |
| run: ls /home/runner/.solc/v0.8.25/solc-static-linux | |
| - name: Create a Solc symbolic link | |
| run: ln -sf /home/runner/.solc/v0.8.25/solc-static-linux /home/runner/.solc/solc | |
| - name: Check if Solc is in PATH | |
| run: which solc || echo "Solc not found in PATH" | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install serde-generate-bin | |
| run: | | |
| cargo install serde-generate-bin@0.8.0 --locked | |
| - name: Compile the LineraTypes.yaml | |
| run: | | |
| serdegen --language solidity --module-name LineraTypes --target-source-dir dest linera-execution/solidity/LineraTypes.yaml | |
| - name: Check for generated LineraTypes.sol | |
| run: | | |
| if ! diff dest/LineraTypes.sol linera-execution/solidity/LineraTypes.sol | |
| then | |
| echo '`LineraTypes.sol` differs from the output of `serdegen`' | |
| exit 1 | |
| fi | |
| - name: Run the storage-service instance | |
| run: | | |
| cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE & | |
| - name: Wait for storage service to be ready | |
| run: | | |
| until nc -z 127.0.0.1 1235; do sleep 1; done | |
| - name: Run Ethereum tests | |
| run: | | |
| cargo test -p linera-ethereum --features ethereum | |
| cargo test test_wasm_end_to_end_ethereum_tracker --features ethereum,storage-service | |
| - name: Run REVM test | |
| run: | | |
| cargo test evm --features revm,storage-service | |
| storage-service-tests: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest-16-cores | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build example applications | |
| run: | | |
| cd examples | |
| cargo build --locked --release --target wasm32-unknown-unknown | |
| - name: Run the storage-service instance | |
| run: | | |
| cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE & | |
| - name: Wait for storage service to be ready | |
| run: | | |
| until nc -z 127.0.0.1 1235; do sleep 1; done | |
| - name: Run the storage-service tests | |
| run: | | |
| cargo test --features storage-service,opentelemetry -- storage_service --nocapture | |
| check-wit-files: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Check WIT files | |
| run: | | |
| cargo run --bin wit-generator -- -c | |
| lint-unexpected-chain-load-operations: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for unexpected chain load operations | |
| run: | | |
| ./scripts/check_chain_loads.sh | |
| lint-check-copyright-headers: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build check_copyright_header script | |
| run: | | |
| cd ./scripts/check_copyright_header | |
| cargo build --locked --release | |
| - name: Check Copyright headers | |
| run: > | |
| find linera-* examples -name '*.rs' -a -not -wholename '*/target/*' -print0 | |
| | xargs -0 scripts/target/release/check_copyright_header | |
| lint-cargo-machete: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install cargo-machete | |
| run: | | |
| cargo install cargo-machete@0.7.0 --locked | |
| - name: Check for unused dependencies | |
| run: | | |
| cargo machete | |
| lint-cargo-fmt: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Check formatting | |
| run: | | |
| cargo fmt -- --check | |
| lint-taplo-fmt: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install `taplo-cli` | |
| run: RUSTFLAGS='' cargo install taplo-cli@0.9.3 --locked | |
| - name: Check if `Cargo.toml` files are formatted | |
| run: taplo fmt --check --diff | |
| lint-check-for-outdated-readme: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install cargo-rdme | |
| run: | | |
| cargo install cargo-rdme --locked | |
| - name: Check for outdated README.md | |
| run: | | |
| set -e | |
| linera_packages=($( | |
| cargo metadata --format-version 1 \ | |
| | jq -r '.workspace_members[] | match("/(linera-.*)#").captures[0].string' \ | |
| )) | |
| for package in "${linera_packages[*]}" | |
| do | |
| [ -d "$package" ] || continue | |
| echo $package | |
| cargo rdme --check --no-fail-on-warnings -w $package | |
| done | |
| lint-wasm-applications: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run Wasm application lints | |
| run: | | |
| cd examples | |
| cargo fmt -- --check | |
| cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked | |
| cargo clippy --all-targets --all-features --target x86_64-unknown-linux-gnu --locked | |
| cd agent | |
| cargo fmt -- --check | |
| lint-cargo-clippy: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run clippy | |
| run: | | |
| cargo clippy --locked --all-targets --all-features | |
| cargo clippy --locked --no-default-features --features kubernetes | |
| cargo clippy --locked --no-default-features | |
| cargo clippy --locked --target wasm32-unknown-unknown --no-default-features --features web-default \ | |
| -p linera-client \ | |
| -p linera-rpc \ | |
| -p linera-views | |
| lint-cargo-doc: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put lint toolchain file in place | |
| run: | | |
| ln -sf toolchains/nightly/rust-toolchain.toml | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run cargo doc | |
| run: | | |
| cargo doc --locked --all-features | |
| lint-check-linera-service-graphql-schema: | |
| needs: changed-files | |
| if: needs.changed-files.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check linera-service GraphQL schema | |
| run: | | |
| diff <(cargo run --locked --bin linera-schema-export) linera-service-graphql-client/gql/service_schema.graphql |