Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eip1153 coverage [DEMO] #504

Closed
wants to merge 13 commits into from
File renamed without changes.
File renamed without changes.
File renamed without changes.
155 changes: 155 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Evmone Coverage Report

on:
pull_request:
paths:
- 'converted-ethereum-tests.txt' # This triggers the workflow only for changes in file.txt

jobs:
evmone-coverage-diff:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }} # Checks out the PR branch
fetch-depth: 0 # Necessary to fetch all history for diff

- name: Fetch target branch
run: git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}

- name: Install deps
run: |
echo $(pwd)
echo ${{ github.workspace }}

#install pyspec deps from root repo
python3 --version
python3 -m venv ./venv/
source ./venv/bin/activate
pip install -e .

#install solc
curl -L --output solc "https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux"
sudo mv solc /usr/local/bin
sudo chmod +x /usr/local/bin/solc
solc --version

# Required to fill .py tests
- name: Build GO EVM
uses: ./.github/actions/build-evm
id: evm-builder
with:
type: 'main'

- name: Build EVMONE EVM
uses: ./.github/actions/build-evmone-evm
id: evm-builder2
with:
type: 'main'

- name: Checkout ethereum/tests
uses: actions/checkout@v4
with:
repository: ethereum/tests
path: testpath
sparse-checkout: |
GeneralStateTests


# This command diffs the file and filters in new lines
- name: Parse converted tests from converted-ethereum-tests.txt
run: |
echo "New lines introduced in converted-ethereum-tests.txt:"
lines=$(git diff origin/${{ github.base_ref }} HEAD -- converted-ethereum-tests.txt | grep "^+" | grep -v "^+++")
files=$(echo "$lines" | grep -oP '(?<=\+).+\.json')

if [ -z "$files" ]; then
echo "Error: No new JSON files found in converted-ethereum-tests.txt"
exit 1
fi

for file in $files; do
echo $file
done

mkdir -p ${{ github.workspace }}/evmtest_coverage/coverage/BASE_TESTS
for file in $files; do
cp ${{ github.workspace }}/testpath/$file ${{ github.workspace }}/evmtest_coverage/coverage/BASE_TESTS
done


# This command diffs the .py scripts introduced by a PR
- name: Parse and fill introduced test sources
run: |
python3 -m venv ./venv/
source ./venv/bin/activate

files=$(git diff --name-status origin/${{ github.base_ref }}...HEAD -- tests/ | grep -E '^[AM]' | grep '\.py$')
echo "Modified or new .py files in tests folder:"
echo "$files" | while read line; do
file=$(echo "$line" | cut -c 3-)
echo $file
done

# fill new tests
echo "$files" | while read line; do
file=$(echo "$line" | cut -c 3-)
fill $file --until=Cancun --evm-bin evmone-t8n
done

files=$(find fixtures/state_tests -type f -name "*.json")
if [ -z "$files" ]; then
echo "Error: No filled JSON fixtures found in fixtures/state_tests."
exit 1
fi

mkdir -p ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS
find fixtures/state_tests -type f -name "*.json" -exec cp {} ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS \;

- name: Print tests that will be covered
run: |
echo "Original BASE tests:"
ls ${{ github.workspace }}/evmtest_coverage/coverage/BASE_TESTS
echo "--------------------"
echo "Ported PATCH tests:"
ls ${{ github.workspace }}/evmtest_coverage/coverage/PATCH_TESTS

- name: Run coverage of the BASE tests
uses: addnab/docker-run-action@v3
with:
image: winsvega/evmone-coverage-script:latest
options: -v ${{ github.workspace }}/evmtest_coverage/coverage:/tests
run: /entrypoint.sh --mode=cover --testpath=/tests/BASE_TESTS --outputname=BASE

- name: Run coverage of the PATCH tests
uses: addnab/docker-run-action@v3
with:
image: winsvega/evmone-coverage-script:latest
options: -v ${{ github.workspace }}/evmtest_coverage/coverage:/tests
run: /entrypoint.sh --mode=cover --testpath=/tests/PATCH_TESTS --outputname=PATCH

- name: Run coverage DIFF of the PATCH tests compared to BASE tests
uses: addnab/docker-run-action@v3
with:
image: winsvega/evmone-coverage-script:latest
options: -v ${{ github.workspace }}/evmtest_coverage/coverage:/tests
run: /entrypoint.sh --mode=diff --basefile=coverage_BASE.lcov --patchfile=coverage_PATCH.lcov

- name: Chmod coverage results
run: |
user=$(whoami)
sudo chown -R $user:$user ${{ github.workspace }}/evmtest_coverage/coverage

- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: coverage-diff
path: ${{ github.workspace }}/evmtest_coverage/coverage

- name: Verify coverage results
uses: addnab/docker-run-action@v3
with:
image: winsvega/evmone-coverage-script:latest
options: -v ${{ github.workspace }}/evmtest_coverage/coverage:/tests
run: /check.sh
75 changes: 0 additions & 75 deletions .github/workflows/tox_verify.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions converted-ethereum-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
([#440](https://github.com/ethereum/execution-spec-tests/pull/440))
GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/06_tstoreInReentrancyCall.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/07_tloadAfterReentrancyStore.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/08_revertUndoesTransientStore.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/09_revertUndoesAll.json

GeneralStateTests/Cancun/stEIP1153-transientStorage/11_tstoreDelegateCall.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/12_tloadDelegateCall.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/13_tloadStaticCall.json

GeneralStateTests/Cancun/stEIP1153-transientStorage/16_tloadGas.json
GeneralStateTests/Cancun/stEIP1153-transientStorage/18_tloadAfterStore.json

GeneralStateTests/Cancun/stEIP1153-transientStorage/20_oogUndoesTransientStoreInCall.json
1 change: 1 addition & 0 deletions evmone-hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
af7f7be3b633043835e32faa5ba962b3
Loading
Loading