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

Updates to the conformance test suite #2432

Merged
merged 35 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0538f96
*/: remove uses of LegacyTests in repository
ehildenb May 17, 2024
94558f2
test_conformance: run each test individually with log messages
ehildenb May 17, 2024
9460160
.github/test-pr: skip submodule checkout on local checks
ehildenb May 17, 2024
78b3d63
Merge remote-tracking branch 'upstream/master' into new-gst
ehildenb May 17, 2024
56cf54a
Set Version: 1.0.561
May 17, 2024
bb6676c
.github/test-pr: only clone the needed submodules for each job, never…
ehildenb May 17, 2024
4e2b56d
kevm-pyk/tests: move all unit/profiling test data as copies into this…
ehildenb May 17, 2024
50026f8
.github/test-pr: correct plugin submodule directory
ehildenb May 17, 2024
202e408
.github/test-pr: correct how we get submodules
ehildenb May 17, 2024
1116217
.github/test-pr: stages which need ethereum-tests should rely on git …
ehildenb May 17, 2024
4dc036d
tests/interactive, package/test-package, flake.nix, .github/test-pr: …
ehildenb May 17, 2024
0dd3778
.github/: actions/checkout@v3 => actions/checkout@v4
ehildenb May 17, 2024
554146b
.github/: update setup-poetry action from v8 => v9
ehildenb May 17, 2024
fb88f7a
Makefile: make interactive tests not reach into submodules
ehildenb May 17, 2024
06437b6
flake.lock: update
ehildenb May 18, 2024
47bceb5
tests/interactive/add.json: add newline
ehildenb May 18, 2024
a2e8888
Set Version: 1.0.562
May 18, 2024
3bf310e
Merge branch 'master' into new-gst
ehildenb May 20, 2024
45cc079
Set Version: 1.0.563
May 20, 2024
1badec7
Merge remote-tracking branch 'upstream/master' into new-gst
ehildenb May 21, 2024
2132b49
kevm-pyk/interpreter: always check return code on abnormal exit inste…
ehildenb May 21, 2024
c1bb11a
Set Version: 1.0.566
May 21, 2024
d623bd3
kevm-pyk/interpret: actually check on empty output for return code
ehildenb May 21, 2024
2ed9ce5
kevm-pyk/interpreter: make an effort to fail more gracefully on bad i…
ehildenb May 21, 2024
c190eec
Revert "kevm-pyk/interpreter: make an effort to fail more gracefully …
ehildenb May 21, 2024
d4da2e1
Revert "kevm-pyk/interpret: actually check on empty output for return…
ehildenb May 21, 2024
19c8687
Revert "kevm-pyk/interpreter: always check return code on abnormal ex…
ehildenb May 21, 2024
d355072
Merge branch 'master' into new-gst
ehildenb May 22, 2024
be31faa
Set Version: 1.0.568
May 22, 2024
b0f2401
.github/Dockerfile: try upgraded poetry version
ehildenb May 22, 2024
13faf57
.github/Dockerfile: even newer version of poetry
ehildenb May 22, 2024
1a31e1f
Merge branch 'master' into new-gst
anvacaru May 23, 2024
d561039
Set Version: 1.0.569
May 23, 2024
1befe59
Merge branch 'master' into new-gst
rv-jenkins May 23, 2024
1572855
Set Version: 1.0.570
May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ WORKDIR /home/${USER}/workspace

ENV PATH=/home/${USER}/.local/bin:${PATH}

RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.6.1 \
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 \
&& poetry --version
6 changes: 3 additions & 3 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.runner }}
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.push.head.sha }}
fetch-depth: 0
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
needs: nix-cache
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.push.head.sha }}
fetch-depth: 0
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
needs: make-release
steps:
- name: 'Check out gh-pages'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.JENKINS_GITHUB_PAT }}
# fetch-depth 0 means deep clone the repo
Expand All @@ -40,11 +40,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
uses: actions/checkout@v4
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9
- name: 'Run code quality checks'
run: make -C kevm-pyk check
- name: 'Run pyupgrade'
Expand All @@ -56,11 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
uses: actions/checkout@v4
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9
- name: 'Run unit tests'
run: make -C kevm-pyk cov-unit

Expand All @@ -70,11 +66,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
uses: actions/checkout@v4
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9
- name: 'Run profiling'
run: |
make -C kevm-pyk profile
Expand All @@ -86,7 +80,7 @@ jobs:
timeout-minutes: 45
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: 'Set up Docker'
Expand Down Expand Up @@ -128,9 +122,11 @@ jobs:
timeout-minutes: ${{ matrix.timeout }}
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
uses: actions/checkout@v4
- name: 'Check out select submodules'
run: |
set -eux
git submodule update --init --recursive -- kevm-pyk/src/kevm_pyk/kproj/plugin
ehildenb marked this conversation as resolved.
Show resolved Hide resolved
- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
Expand Down Expand Up @@ -160,10 +156,14 @@ jobs:
timeout-minutes: 60
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
- name: 'Check out select submodules'
run: |
set -eux
git submodule update --init --recursive -- kevm-pyk/src/kevm_pyk/kproj/plugin
- name: 'Install Nix'
if: ${{ matrix.runner == 'macos-13' }}
uses: cachix/install-nix-action@v25
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.JENKINS_GITHUB_PAT }}
Expand All @@ -27,7 +27,7 @@ jobs:
git config user.name devops
git config user.email [email protected]
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9
- name: 'Update pyk release tag'
run: |
K_VERSION=v$(cat deps/k_release)
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ KRUN_OPTS ?=
KEEP_OUTPUTS := false
CHECK := git --no-pager diff --no-index --ignore-all-space -R

tests/ethereum-tests/LegacyTests/Constantinople/VMTests/%: KEVM_MODE = VMTESTS
tests/ethereum-tests/LegacyTests/Constantinople/VMTests/%: KEVM_SCHEDULE = DEFAULT
tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/%: KEVM_MODE = VMTESTS
tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/%: KEVM_SCHEDULE = DEFAULT

tests/%.run-interactive: tests/%
$(POETRY_RUN) kevm-pyk run $< $(KEVM_OPTS) $(KRUN_OPTS) --target $(TEST_CONCRETE_BACKEND) \
Expand All @@ -145,8 +145,7 @@ tests/%.run-interactive: tests/%
|| $(CHECK) tests/$*.$(TEST_CONCRETE_BACKEND)-out tests/templates/output-success-$(TEST_CONCRETE_BACKEND).json
$(KEEP_OUTPUTS) || rm -rf tests/$*.$(TEST_CONCRETE_BACKEND)-out

interactive_tests = tests/ethereum-tests/LegacyTests/Constantinople/VMTests/vmArithmeticTest/add0.json \
tests/ethereum-tests/LegacyTests/Constantinople/VMTests/vmIOandFlowOperations/pop1.json \
interactive_tests = tests/interactive/add.json \
tests/interactive/sumTo10.evm

.PHONY: test-interactive
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ For Developers
If built from the source, the `kevm-pyk` executable will be installed in a virtual environemtn handled by Poetry.
You can call `kevm-pyk --help` to get a quick summary of how to use the script.

Run the file `tests/ethereum-tests/LegacyTests/Constantinople/VMTests/vmArithmeticTest/add0.json`:
Run the file `tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/vmArithmeticTest/add0.json`:

```sh
poetry -C kevm-pyk run kevm-pyk run tests/ethereum-tests/LegacyTests/Constantinople/VMTests/vmArithmeticTest/add0.json --schedule DEFAULT --mode VMTESTS
poetry -C kevm-pyk run kevm-pyk run tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/vmArithmeticTest/add0.json --schedule DEFAULT --mode VMTESTS
```

To enable the debug symbols for the llvm backend, build using this command:
Expand Down
36 changes: 0 additions & 36 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 2 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@
inputs.flake-utils.follows = "k-framework/flake-utils";
inputs.nixpkgs.follows = "k-framework/nixpkgs";
};
ethereum-tests = {
url = "github:ethereum/tests/6401889dec4eee58e808fd178fb2c7f628a3e039";
flake = false;
};
ethereum-legacytests = {
url =
"github:ethereum/legacytests/d7abc42a7b352a7b44b1f66b58aca54e4af6a9d7";
flake = false;
};
ehildenb marked this conversation as resolved.
Show resolved Hide resolved
haskell-backend.follows = "k-framework/haskell-backend";
};
outputs = { self, k-framework, haskell-backend, nixpkgs, flake-utils
, blockchain-k-plugin, ethereum-tests, ethereum-legacytests, rv-utils, pyk
, ... }@inputs:
, blockchain-k-plugin, rv-utils, pyk, ... }@inputs:
let
nixLibs = pkgs:
with pkgs;
Expand Down Expand Up @@ -127,9 +117,6 @@
buildInputs = [ final.kevm prev.which prev.git ];

buildPhase = ''
mkdir -p tests/ethereum-tests/LegacyTests
cp -r ${ethereum-tests}/* tests/ethereum-tests/
cp -r ${ethereum-legacytests}/* tests/ethereum-tests/LegacyTests/
chmod -R u+w tests
APPLE_SILICON=${
if prev.stdenv.isAarch64 && prev.stdenv.isDarwin then
Expand Down Expand Up @@ -237,16 +224,12 @@
};

check-submodules = rv-utils.lib.check-submodules pkgs {
inherit k-framework blockchain-k-plugin ethereum-tests
ethereum-legacytests;
inherit k-framework blockchain-k-plugin;
};

update-from-submodules =
rv-utils.lib.update-from-submodules pkgs ./flake.lock {
blockchain-k-plugin.submodule = "deps/plugin";
ethereum-tests.submodule = "tests/ethereum-tests";
ethereum-legacytests.submodule =
"tests/ethereum-tests/LegacyTests";
};
};
}) // {
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.569"
version = "1.0.570"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '1.0.569'
VERSION: Final = '1.0.570'
34 changes: 18 additions & 16 deletions kevm-pyk/src/tests/integration/test_conformance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import json
import logging
import sys
from typing import TYPE_CHECKING

Expand All @@ -21,22 +22,24 @@
from pyk.kore.syntax import Pattern


_LOGGER: Final = logging.getLogger(__name__)
_LOG_FORMAT: Final = '%(levelname)s %(asctime)s %(name)s - %(message)s'


sys.setrecursionlimit(10**8)

TEST_DIR: Final = REPO_ROOT / 'tests/ethereum-tests'
GOLDEN: Final = (REPO_ROOT / 'tests/templates/output-success-llvm.json').read_text().rstrip()


def _test(gst_file: Path, schedule: str, mode: str, chainid: int, usegas: bool) -> None:
# Given
with gst_file.open() as f:
gst_data = json.load(f)

# When
res = interpret(gst_data, schedule, mode, chainid, usegas, check=False)

# Then
_assert_exit_code_zero(res)
for test_name, test in gst_data.items():
_LOGGER.info(f'Running test: {gst_file} - {test_name}')
res = interpret({test_name: test}, schedule, mode, chainid, usegas, check=False)
_assert_exit_code_zero(res)


def _assert_exit_code_zero(pattern: Pattern) -> None:
Expand Down Expand Up @@ -65,7 +68,7 @@ def read_test_list(path: Path) -> list[Path]:

SKIPPED_TESTS: Final = _skipped_tests()

VM_TEST_DIR: Final = TEST_DIR / 'LegacyTests/Constantinople/VMTests'
VM_TEST_DIR: Final = TEST_DIR / 'BlockchainTests/GeneralStateTests/VMTests'
ALL_VM_TESTS: Final = tuple(VM_TEST_DIR.glob('*/*.json'))
VM_TESTS: Final = tuple(test_file for test_file in ALL_VM_TESTS if test_file not in SKIPPED_TESTS)
REST_VM_TESTS: Final = tuple(test_file for test_file in ALL_VM_TESTS if test_file in SKIPPED_TESTS)
Expand All @@ -90,15 +93,14 @@ def test_rest_vm(test_file: Path) -> None:
_test(test_file, 'DEFAULT', 'VMTESTS', 1, True)


BCHAIN_NEW_TEST_DIR: Final = TEST_DIR / 'BlockchainTests/GeneralStateTests'
BCHAIN_NEW_TESTS: Final = tuple(BCHAIN_NEW_TEST_DIR.glob('**/*.json'))

BCHAIN_LEGACY_TEST_DIR: Final = TEST_DIR / 'LegacyTests/Constantinople/BlockchainTests/GeneralStateTests'
BCHAIN_LEGACY_TESTS: Final = tuple(BCHAIN_LEGACY_TEST_DIR.glob('*/*.json'))

ALL_BCHAIN_TESTS: Final = BCHAIN_NEW_TESTS + BCHAIN_LEGACY_TESTS
BCHAIN_TESTS: Final = tuple(test_file for test_file in ALL_BCHAIN_TESTS if test_file not in SKIPPED_TESTS)
REST_BCHAIN_TESTS: Final = tuple(test_file for test_file in ALL_BCHAIN_TESTS if test_file in SKIPPED_TESTS)
BCHAIN_TEST_DIR: Final = TEST_DIR / 'BlockchainTests/GeneralStateTests'
ALL_BCHAIN_TESTS: Final = tuple(BCHAIN_TEST_DIR.glob('**/*.json'))
BCHAIN_TESTS: Final = tuple(
test_file for test_file in ALL_BCHAIN_TESTS if test_file not in (list(SKIPPED_TESTS) + list(ALL_VM_TESTS))
)
REST_BCHAIN_TESTS: Final = tuple(
test_file for test_file in ALL_BCHAIN_TESTS if test_file in SKIPPED_TESTS and test_file not in ALL_VM_TESTS
)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/tests/profiling/test_gst_to_kore.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pyk.testing import Profiler


GST_FILE = REPO_ROOT / 'tests/ethereum-tests/BlockchainTests/GeneralStateTests/stEIP1559/intrinsic.json'
GST_FILE = REPO_ROOT / 'tests/interactive/intrinsic.json'


def test_gst_to_kore(profile: Profiler) -> None:
Expand Down
4 changes: 2 additions & 2 deletions kevm-pyk/src/tests/unit/test_gst_to_kore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

TEST_DATA: Final = (
(
'tests/ethereum-tests/GeneralStateTests/VMTests/vmLogTest/log3.json',
'tests/interactive/vmLogTest/log3.gst-to-kore.expected',
'tests/interactive/log3.json',
'tests/interactive/log3.gst-to-kore.expected',
),
(
'tests/interactive/log3_MaxTopic_d0g0v0.json',
Expand Down
Loading