test: auto-detect live precompiles so base-forge test just works; rename fork->live precompile testing#167
Merged
Merged
Conversation
BaseTest probes for the live precompiles (STATICCALL ActivationRegistry.admin() before any etch) instead of requiring LIVE_PRECOMPILES, and records the result in livePrecompiles. Stock forge test runs the Solidity mocks (reference mode); base-forge test (or forge --fork-url a base-anvil node) uses the live precompiles (conformance) and skips the mock etch. setUp logs which mode ran. LIVE_PRECOMPILES=true remains as a force-live override. Fixes the 'vm.etch: cannot use precompile ... as an argument' failures when running base-forge test without LIVE_PRECOMPILES.
…round base-forge Lead the docs with the auto-detected base-forge test path (reference vs live precompile worlds), keep the python node-runner as the against-a-real-node / CI path, and sweep 'fork mode' -> 'live precompile mode' terminology. Functional names (make fork-tests, script/fork, the workflow) left intact.
Interface Coverage✅ All interface functions have test coverage. |
📊 Forge Coverage (
|
| File | Lines | Stmts | Branches | Funcs |
|---|---|---|---|---|
| 🟢 B20FactoryLib.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🔴 test/lib/ForceFeeder.sol | 0.00% | 0.00% | 100.00% | 0.00% |
| 🔴 test/lib/PrecompileProbe.sol | 0.00% | 0.00% | 0.00% | 0.00% |
| 🟢 MockActivationRegistry.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockActivationRegistryStorage.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockB20.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockB20Asset.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟡 MockB20Factory.sol | 98.96% | 99.10% | 100.00% | 100.00% |
| 🟢 MockB20Stablecoin.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockB20Storage.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockPolicyRegistry.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| 🟢 MockPolicyRegistryStorage.sol | 100.00% | 100.00% | 100.00% | 100.00% |
| Total | 96.69% | 97.23% | 98.39% | 96.89% |
Full report: download artifact. To browse locally: make coverage (runs forge coverage + genhtml + opens the HTML report).
…testing) Add a Quick start that uses base-foundryup-installed base-forge/base-anvil instead of a from-source build: base-forge test for the no-node path, and the Python runner pointed at $HOME/.foundry/versions/base-nightly for genuine node fork testing. Note that a base-anvil node starts with features inactive (only forge in-process seeds them), so the runner activates them. Demote the cargo build to a contributors section.
✅ Fork tests: all 616 passedbase/base is fully in sync with the base-std spec. |
4b1558f to
d58d907
Compare
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.
What
base-forge testagainst base-std previously failed everysetUpwithvm.etch: cannot use precompile ... as an argument: base-forge makes the real precompiles present, butBaseTeststill etched the Solidity mocks over them unlessLIVE_PRECOMPILES=truewas set by hand.This makes the suite detect its world and adapt:
forge test): precompiles absent -> etch the Solidity mocks -> testing the reference implementation.base-forge test, orforge test --fork-url <base-anvil node>): precompiles present -> skip the etch -> checking base/base against the reference (conformance).Detection is a behavioral probe (STATICCALL
ActivationRegistry.admin()before any etch), notextcodesize(native precompiles report zero code).setUplogs which world ran;LIVE_PRECOMPILES=trueremains a force-live override.Result
base-forge test-> 616 passed, 0 failed, 13 skipped (was 145 failing), no env var, no node.forge test-> 625 passed, 0 failed, 4 skipped (reference world unchanged).Also
FORK_TESTING.md->LIVE_PRECOMPILE_TESTING.md, reframed to lead withbase-forge test; the Python node-runner stays documented as the against-a-real-node / CI path. "fork mode" -> "live precompile mode" terminology swept. Functional names (make fork-tests,script/fork/, the workflow) left intact to avoid breaking CI.Test plan
Ran the full suite both ways on macOS arm64 against the v1.1.0 base-anvil build; both green (counts above).