Skip to content

Parallel transaction execution with BALs #29438

Parallel transaction execution with BALs

Parallel transaction execution with BALs #29438

name: Nethermind/Ethereum tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [master]
workflow_dispatch:
inputs:
coverage:
default: false
description: Collect coverage
required: false
type: boolean
env:
COLLECT_COVERAGE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.coverage }}
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
TERM: xterm
defaults:
run:
shell: bash
jobs:
tests:
name: Run ${{ matrix.project }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
outputs:
collect_coverage: ${{ env.COLLECT_COVERAGE }}
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
project:
- Nethermind.Abi.Test
- Nethermind.Api.Test
- Nethermind.AuRa.Test
- Nethermind.Blockchain.Test
- Nethermind.Clique.Test
- Nethermind.Config.Test
- Nethermind.Consensus.Test
- Nethermind.Core.Test
- Nethermind.Db.Test
- Nethermind.Era1.Test
- Nethermind.Ethash.Test
- Nethermind.EthStats.Test
- Nethermind.Evm.Test
- Nethermind.Facade.Test
- Nethermind.Flashbots.Test
- Nethermind.HealthChecks.Test
- Nethermind.History.Test
- Nethermind.Hive.Test
- Nethermind.JsonRpc.Test
- Nethermind.JsonRpc.TraceStore.Test
- Nethermind.KeyStore.Test
- Nethermind.Logging.NLog.Test
- Nethermind.Merge.AuRa.Test
- Nethermind.Merge.Plugin.Test
- Nethermind.Mining.Test
- Nethermind.Monitoring.Test
- Nethermind.Network.Discovery.Test
- Nethermind.Network.Dns.Test
- Nethermind.Network.Enr.Test
- Nethermind.Network.Test
- Nethermind.Optimism.Test
- Nethermind.Runner.Test
- Nethermind.Serialization.Ssz.Test
- Nethermind.Shutter.Test
- Nethermind.Sockets.Test
- Nethermind.Specs.Test
- Nethermind.State.Test
- Nethermind.State.Test.Runner.Test
- Nethermind.Synchronization.Test
- Nethermind.Taiko.Test
- Nethermind.Trie.Test
- Nethermind.TxPool.Test
- Nethermind.Wallet.Test
- Nethermind.Xdc.Test
include: # macOS only for OS-sensitive tests (I/O, networking, sockets)
- { runner: macos-latest, project: Nethermind.Db.Test }
- { runner: macos-latest, project: Nethermind.JsonRpc.Test }
- { runner: macos-latest, project: Nethermind.KeyStore.Test }
- { runner: macos-latest, project: Nethermind.Network.Discovery.Test }
- { runner: macos-latest, project: Nethermind.Network.Dns.Test }
- { runner: macos-latest, project: Nethermind.Network.Enr.Test }
- { runner: macos-latest, project: Nethermind.Network.Test }
- { runner: macos-latest, project: Nethermind.Runner.Test }
- { runner: macos-latest, project: Nethermind.Sockets.Test }
- { runner: macos-latest, project: Nethermind.Synchronization.Test }
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up .NET
uses: actions/setup-dotnet@v5
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('Directory.Packages.props', 'global.json') }}
restore-keys: nuget-${{ runner.os }}-
- name: ${{ matrix.project }}
id: test
working-directory: src/Nethermind/${{ matrix.project }}
run: |
flags="${{ matrix.runner == 'ubuntu-latest' && env.COLLECT_COVERAGE == 'true' && '--coverage --coverage-output-format cobertura --coverage-settings ../codecoverage.json' || '' }}"
set +e
dotnet test --project ${{ matrix.project }}.csproj -c release $flags
rc=$?
set -e
if [[ $rc -eq 0 ]]; then
exit 0
elif [[ $rc -eq 1 ]]; then
exit 1
else
echo "::warning::Test process crashed (exit code $rc), retrying..."
dotnet test --project ${{ matrix.project }}.csproj -c release $flags
fi
- name: Upload coverage report
if: matrix.runner == 'ubuntu-latest' && env.COLLECT_COVERAGE == 'true'
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.project }}-coverage
path: src/Nethermind/artifacts/bin/${{ matrix.project }}/release/TestResults/*.cobertura.xml
retention-days: 1
tests-spec:
name: Run ${{ matrix.project }}${{ matrix.chunk && format(' ({0})', matrix.chunk) || '' }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- ubuntu-24.04-arm
project:
- Ethereum.Abi.Test
- Ethereum.Basic.Test
- Ethereum.Blockchain.Block.Test
- Ethereum.Difficulty.Test
- Ethereum.HexPrefix.Test
- Ethereum.KeyAddress.Test
- Ethereum.KeyStore.Test
- Ethereum.Legacy.Blockchain.Block.Test
- Ethereum.Legacy.Transition.Test
- Ethereum.Legacy.VM.Test
- Ethereum.PoW.Test
- Ethereum.Rlp.Test
- Ethereum.Transaction.Test
- Ethereum.Trie.Test
chunk: ['']
exclude: # Legacy VM unchunked on ubuntu-latest is replaced by 8 chunks below (coverage makes it too slow)
- runner: ubuntu-latest
project: Ethereum.Legacy.VM.Test
chunk: ''
include:
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 1of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 2of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 3of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 4of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 5of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 6of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 7of8 }
- { runner: ubuntu-latest, project: Ethereum.Legacy.VM.Test, chunk: 8of8 }
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up .NET
uses: actions/setup-dotnet@v5
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('Directory.Packages.props', 'global.json') }}
restore-keys: nuget-${{ runner.os }}-
- name: ${{ matrix.project }}${{ matrix.chunk && format(' ({0})', matrix.chunk) || '' }}
id: test
working-directory: src/Nethermind/${{ matrix.project }}
env:
TEST_CHUNK: ${{ matrix.chunk }}
run: |
flags="${{ matrix.runner == 'ubuntu-latest' && env.COLLECT_COVERAGE == 'true' && '--coverage --coverage-output-format cobertura --coverage-settings ../codecoverage.json' || '' }}"
set +e
dotnet test --project ${{ matrix.project }}.csproj -c release $flags
rc=$?
set -e
if [[ $rc -eq 0 ]]; then
exit 0
elif [[ $rc -eq 1 ]]; then
exit 1
else
echo "::warning::Test process crashed (exit code $rc), retrying..."
dotnet test --project ${{ matrix.project }}.csproj -c release $flags
fi
- name: Upload coverage report
if: matrix.runner == 'ubuntu-latest' && env.COLLECT_COVERAGE == 'true'
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.project }}${{ matrix.chunk && format('-{0}', matrix.chunk) || '' }}-coverage
path: src/Nethermind/artifacts/bin/${{ matrix.project }}/release/TestResults/*.cobertura.xml
retention-days: 1
tests-chunked:
name: Run ${{ matrix.test.project }} (${{ matrix.test.chunk }}) (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
- macos-latest
test:
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 1of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 2of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 3of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 4of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 5of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 6of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 7of8 }
- { project: Ethereum.Legacy.Blockchain.Test, chunk: 8of8 }
- { project: Ethereum.Blockchain.Pyspec.Test, chunk: 1of4 }
- { project: Ethereum.Blockchain.Pyspec.Test, chunk: 2of4 }
- { project: Ethereum.Blockchain.Pyspec.Test, chunk: 3of4 }
- { project: Ethereum.Blockchain.Pyspec.Test, chunk: 4of4 }
steps:
- name: Enable long paths (Windows)
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Free up disk space
if: runner.os == 'Linux' && startsWith(matrix.test.project, 'Ethereum.Blockchain.Pyspec')
uses: jlumbroso/free-disk-space@v1.3.1
with:
large-packages: false
tool-cache: false
- name: Check out repository
uses: actions/checkout@v6
with:
submodules: ${{ startsWith(matrix.test.project, 'Ethereum.Blockchain.Pyspec') && 'false' || 'recursive' }}
- name: Set up .NET
uses: actions/setup-dotnet@v5
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('Directory.Packages.props', 'global.json') }}
restore-keys: nuget-${{ runner.os }}-
- name: ${{ matrix.test.project }} (${{ matrix.test.chunk }})
id: test
working-directory: src/Nethermind/${{ matrix.test.project }}
env:
TEST_CHUNK: ${{ matrix.test.chunk }}
run: |
set +e
dotnet test --project ${{ matrix.test.project }}.csproj -c release
rc=$?
set -e
if [[ $rc -eq 0 ]]; then
exit 0
elif [[ $rc -eq 1 ]]; then
exit 1
else
echo "::warning::Test process crashed (exit code $rc), retrying..."
dotnet test --project ${{ matrix.test.project }}.csproj -c release
fi
tests-summary:
name: Tests summary
needs: [tests, tests-spec, tests-chunked]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check result
run: |
[[ \
"${{ needs.tests.result }}" == "success" && \
"${{ needs.tests-spec.result }}" == "success" && \
"${{ needs.tests-chunked.result }}" == "success" \
]]
codecov-upload:
name: Upload Codecov reports
needs: [tests, tests-summary]
if: needs.tests.outputs.collect_coverage == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up .NET
uses: actions/setup-dotnet@v5
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
path: coverage
pattern: '*-coverage'
- name: Merge coverage reports
run: |
dotnet tool install --global dotnet-coverage
dotnet-coverage merge \
coverage/**/*.cobertura.xml \
-f cobertura \
-o coverage.cobertura.xml \
--remove-input-files
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-nethermind
files: coverage.cobertura.xml
disable_search: true
fail_ci_if_error: true