test: Introduce TestingFramework struct#532
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a higher-level TestingFramework abstraction in the rig test harness to decouple tests from Chain, while also changing default test execution behavior so RISC-V simulation/proving runs are disabled locally by default and enabled in CI.
Changes:
- Added
rig::TestingFrameworkwith builder-style configuration and convenience helpers for executing/simulating blocks and inspecting results. - Refactored many test crates to construct/use
TestingFramework(and passZKsyncTxEnvelopedirectly) instead of manually wiringChain+ encoded transactions. - Updated
RunConfigsemantics fromonly_forwardtodo_riscv_run, and adjusted CI to enable proving runs by default.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| zk_ee/src/oracle/usize_serialization/tests.rs | Removes unused variable binding in a unit serialization test. |
| tests/rig/src/testing_utils.rs | Updates install_system_contracts to accept generic Chain<const RANDOMIZED_TREE>. |
| tests/rig/src/lib.rs | Introduces TestingFramework, tx helpers, and common test utilities (tx_succeeded/failed, signer_from_key, etc.). |
| tests/rig/src/chain.rs | Refactors oracle factory trait, adds RunConfig defaulting based on env, renames only_forward → do_riscv_run, adds set_chain_id, updates oracle factory dispatch. |
| tests/instances/unit/src/validator/tx_validator_filtering.rs | Migrates validator tests to TestingFramework and disables RISC-V run where validator behavior must be observed. |
| tests/instances/unit/src/tracer/tracer_storage_hooks.rs | Migrates storage tracer test to TestingFramework and adjusts address conversions. |
| tests/instances/unit/src/tracer/tracer_event_hook.rs | Migrates event tracer test to TestingFramework and adjusts address conversions. |
| tests/instances/unit/src/tracer/mod.rs | Migrates tracer harness helper to TestingFramework and uses block context setter. |
| tests/instances/unit/src/tracer/evm_opcodes_logger.rs | Migrates opcode logger tests to TestingFramework. |
| tests/instances/unit/src/initial_slot_regression.rs | Updates custom oracle factory impl to new trait shape; migrates test to TestingFramework. |
| tests/instances/unit/src/coinbase_regression.rs | Migrates to TestingFramework and uses shared common_target_address(). |
| tests/instances/transactions/src/native_charging.rs | Migrates tx execution/simulation to TestingFramework and uses shared signer helper. |
| tests/instances/transactions/src/lib.rs | Large migration to TestingFramework, removes bespoke run_config helper, centralizes constants and assertions. |
| tests/instances/transactions/src/l1_tx_resilience.rs | Migrates to TestingFramework and shared target address helper. |
| tests/instances/system_hooks/src/lib.rs | Migrates system hook tests to TestingFramework and uses shared tx helpers (tx_succeeded/failed). |
| tests/instances/precompiles/src/lib.rs | Migrates precompile tests to TestingFramework and removes encoding step. |
| tests/instances/multiblock_batch/src/lib.rs | Migrates multiblock proof test to TestingFramework and uses stored proof_input via last_executed_block_info. |
| tests/instances/header/src/lib.rs | Migrates header invariant tests to TestingFramework block runners. |
| tests/instances/forge_tests/src/lib.rs | Migrates forge-style tests to TestingFramework and ZKsyncTxEnvelope inputs. |
| tests/instances/evm/src/lib.rs | Migrates EVM tests/benches to TestingFramework and removes repeated run config wiring. |
| tests/instances/eth_runner/src/single_run.rs | Updates runner config field name to do_riscv_run. |
| tests/instances/eth_runner/src/live_run/block_execution.rs | Updates runner config field name/logic to do_riscv_run: !only_forward. |
| tests/instances/erc20/src/lib.rs | Migrates ERC20 instance tests to TestingFramework and uses with_run_config. |
| tests/instances/bench/src/lib.rs | Migrates benchmark-style test to TestingFramework and ZKsyncTxEnvelope inputs. |
| tests/fuzzer/fuzz/fuzz_targets/precompiles/common/mod.rs | Updates run config field name to do_riscv_run. |
| tests/evm_tester/src/vm/zk_ee/mod.rs | Updates run config field name/logic to do_riscv_run: proof_run. |
| tests/common/src/zksync_tx/mod.rs | Adds Clone derives for tx envelope enums to support new flows. |
| tests/binary_checker/src/lib.rs | Marks verify_default_binaries as ignored by default (intended CI-only). |
| AGENTS.md | Updates testing infrastructure docs for the new testing abstraction and new local test-running guidance. |
| .github/workflows/ci.yml | Enables proving mode env vars in CI, changes test invocation, and adjusts binary checker invocation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
antoniolocascio
left a comment
There was a problem hiding this comment.
Generally LGTM, left a couple comments
Benchmark report
|
What ❔
Additional layer of abstraction between tests and
Chain. This is an intermediate step - in following PRs I will better separate concerns betweenChainandTestingFramework. Additionally this separation will make RevmRunner integration easier and more effective.Note that in this PR we'll change how testing works in general - by default locally RISC-V simulation will be disabled, it will be enabled in CI. This change makes testing setup a bit more friendly for AI agents.
Why ❔
Is this a breaking change?
Checklist