feat(semantic-tests): add per-test // optimize: filter for semantic tests#219
Merged
feat(semantic-tests): add per-test // optimize: filter for semantic tests#219
// optimize: filter for semantic tests#219Conversation
Add support for a `// optimize:` flag in semantic test files that controls which optimizer configurations the test runs under. Syntax: - `// optimize: false` or `// optimize: []` — skip when optimizer is on - `// optimize: 200` — only run with --optimizer-runs 200 - `// optimize: [1, 200]` — only run with --optimizer-runs 1 or 200 - (not present) — no filtering, run with any config When the optimizer is off, the test always runs regardless of this flag. Motivation: the RNG precompile now uses gas-remaining as entropy, so tests with exact expected values produce different results across optimizer settings. This flag lets tests pin to specific configs.
When `// optimize: [200]` is set, the test should only run with --optimize --optimizer-runs 200. Previously it also ran when the optimizer was off, producing wrong expected values.
drappi-ai
added a commit
to SeismicSystems/seismic-solidity
that referenced
this pull request
Apr 8, 2026
The RNG precompile uses gas-remaining as entropy, producing different results across optimizer/via-ir configurations. Split the single test into 4 files, each pinned to a specific config via `// compileViaYul:` and `// optimize:` flags (requires SeismicSystems/seismic-revm#219). - RngPrecompile.sol: no optimizer, no via-ir - RngPrecompileViaIR.sol: no optimizer, via-ir - RngPrecompileOptimized.sol: optimizer 200, no via-ir - RngPrecompileOptimizedViaIR.sol: optimizer 200, via-ir
1 task
// optimize: filter for semantic tests// optimize: filter for semantic tests
cdrappi
added a commit
to SeismicSystems/seismic-solidity
that referenced
this pull request
Apr 8, 2026
#257) ## Summary - The RNG precompile now uses gas-remaining as entropy (SeismicSystems/seismic-revm#189), so different optimizer/via-ir settings produce different RNG output - Split the single `RngPrecompile.sol` test into 4 config-specific files using `// compileViaYul:` and `// optimize:` flags - Each file is pinned to exactly one compilation config with its own expected values - Both `seismicRng()` (no personalization) and `seismicRngPers(bytes32)` are tested in all 4 files | File | via-ir | optimizer | |------|--------|-----------| | `RngPrecompile.sol` | off | off | | `RngPrecompileViaIR.sol` | on | off | | `RngPrecompileOptimized.sol` | off | 200 runs | | `RngPrecompileOptimizedViaIR.sol` | on | 200 runs | **Depends on:** SeismicSystems/seismic-revm#219 (merged) which adds the `// optimize:` per-test filter. ## Test plan - [x] All 4 semantic test configurations pass locally against merged seismic-revm --------- Co-authored-by: daltoncoder <daltoncoder2@gmail.com> Co-authored-by: Samuel Laferriere <9342524+samlaf@users.noreply.github.com> Co-authored-by: Christian Drappi <c@seismic.systems>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
// optimize:flag support in semantic test.solfiles to control which optimizer configurations a test runs under// optimize: false/// optimize: []— skip when optimizer is enabled// optimize: 200— only run when--optimizer-runs 200// optimize: [1, 200]— only run when--optimizer-runsis 1 or 200SkipCountsarray size to derive fromSkipReason::ALL.len()instead of hardcoded7Motivation: The RNG precompile now uses gas-remaining as entropy, so tests with exact expected values produce different results across optimizer settings. This flag lets tests pin to specific optimizer configs.
Test plan
cargo check -p revmecompiles clean// optimize: falsetests are skipped with--optimize, run without