Skip to content

Conversation

@mbenke
Copy link
Collaborator

@mbenke mbenke commented Nov 28, 2025

Contract testing (create contract and call its methods) using testrunner and evmone.
This PR integrates the C++ testrunner into the Nix build system and adds end-to-end integration tests to nix flake check (which is now run as part of the CI workflow).

Written using substantial Claude Code input, hence includes CLAUDE.md (which can also serve as a part of documentation).

Changes

Nix Build System:

  • Added Nix derivations for evmone dependencies (nix/evmone.nix, nix/intx.nix, nix/blst.nix)
  • Created testrunner package that builds the C++ test executor
  • Added checks.contests derivation that runs full pipeline integration tests
  • Uses nixpkgs packages (boost, nlohmann_json) instead of git submodules

Script Portability:

  • Made contest.sh configurable via environment variables with sensible defaults
  • Scripts work both in Nix builds (with overrides) and local development (with defaults)
  • Environment variables: SOLCORE_CMD, YULE_CMD, testrunner_exe, evmone

Testing:

  • Integration tests verify full pipeline: .solc → sol-core → .core → yule → .yul → solc → .hex → testrunner
  • nix flake check now runs contest test suite (6 tests)
  • Test results: basic.json (4 tests) and neg.json (2 tests) passing ✓

Documentation:

  • Added CLAUDE.md with architecture and Nix integration details
  • Updated README.md with testrunner build and usage instructions
  • Clear distinction between Haskell unit tests and integration tests

Usage

  # Run integration tests via Nix (recommended)
  nix flake check

  # Or build testrunner manually and run locally
  cmake -S . -B build && cmake --build build --target testrunner
  export testrunner_exe=build/test/testrunner/testrunner
  bash run_contests.sh

@mbenke mbenke requested review from clonker and d-xo November 28, 2025 12:21
Allow overriding paths and commands via environment variables:
- SOLCORE_CMD (default: cabal exec sol-core --)
- YULE_CMD (default: cabal run yule --)
- testrunner_exe (default: test/testrunner/testrunner)
- evmone (default: ~/.local/lib/libevmone.so)

This preserves the ability to run scripts outside of Nix builds while
allowing Nix to override these values as needed.
Documents:
- C++ testrunner architecture and components
- Contest integration test system
- Environment variable configuration
- Nix build system and packages
- Development workflow for local and Nix builds
Documents:
- Building the C++ testrunner with cmake
- Running integration tests manually and via Nix
- Distinction between Haskell unit tests and integration tests
- Test case structure and usage
- Using contest.sh for individual test execution
@mbenke mbenke marked this pull request as ready for review December 29, 2025 16:26
Adds parallel 'integration-tests' job that runs 'nix flake check' to
execute the C++ testrunner and contest integration tests on every PR.

The workflow now has two parallel jobs:
- build: Builds sol-core (existing)
- integration-tests: Runs full pipeline tests (new)
Removes branch restriction from pull_request trigger so the workflow
runs on all PRs regardless of target branch. Keeps push trigger
restricted to main branch to avoid duplicate runs.
Replaces separate 'build' and 'integration-tests' jobs with a single
'build-and-test' job that runs 'nix flake check'.

This is more efficient because:
- nix flake check builds sol-core as a dependency (no duplicate builds)
- Single job is simpler and clearer
- Still runs full integration test suite
@Y-Nak Y-Nak self-requested a review January 6, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants