test(smoke): pin composite policyType → IncompatiblePolicyType at the precompile boundary (BOP-476) - #184
Open
robriks wants to merge 1 commit into
Open
Conversation
…e precompile boundary (BOP-476) Add a raw-calldata precompile-invariants probe asserting createPolicy and createPolicyWithAccounts revert IncompatiblePolicyType for a composite policyType (UNION/INTERSECT). At Cobalt the PolicyType enum widened to 4 variants, so discriminant 2/3 now decodes and reaches the logic, which must reject it with the typed error rather than a decode failure or Panic; the simple-policy constructors mint only BLOCKLIST/ALLOWLIST (composites go through createCompositePolicy). Sends the two constructors' calldata via raw eth_call against the live Rust precompile and matches the IncompatiblePolicyType selector, so the behavior is pinned against published binaries independent of the forge/mock unit suite. Complements #178's composite-write payable/value coverage; pairs with base/base #4210 (V2 fix) and base-std #176 (mock guard + fork tests). Co-authored-by: Cursor <cursoragent@cursor.com>
robriks
requested review from
amiecorso,
eric-ships,
ilikesymmetry,
rayyan224 and
stevieraykatz
as code owners
July 30, 2026 15:12
Interface Coverage✅ All interface functions have test coverage. |
📊 Forge Coverage (
|
| File | Lines | Stmts | Branches | Funcs |
|---|---|---|---|---|
| 🔴 B20FactoryLib.sol | 95.40% | 96.00% | 100.00% | 90.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.74% | 97.34% | 98.68% | 96.46% |
Full report: download artifact. To browse locally: make coverage (runs forge coverage + genhtml + opens the HTML report).
|
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
Adds a raw-calldata
precompile-invariantsprobe that pins the composite-policyTyperevert behavior of the two simple-policy constructors against the live Rust precompile:createPolicy(admin, UNION|INTERSECT)→ revertsIncompatiblePolicyTypecreatePolicyWithAccounts(admin, UNION|INTERSECT, [])→ revertsIncompatiblePolicyTypeAt Cobalt the
PolicyTypeenum widened to 4 variants, so discriminant2/3now decodes and reaches the logic layer — which must reject it with the typedIncompatiblePolicyTypeerror (not an ABI-decode failure orPanic(0x21)). Composites are minted only viacreateCompositePolicy.The probe sends both constructors' calldata via raw
eth_calland matches theIncompatiblePolicyTypeselector (expect_raw_revert(..., error_name="IncompatiblePolicyType")), so the behavior is pinned against published binaries, independent of the forge/mock unit suite. It complements #178's composite-write payable/value coverage.Context / coordination
This is the smoke half of BOP-476's fork+smoke coverage requirement. It pairs with:
validate_create_policy_inputsreturnIncompatiblePolicyTypefor a composite type.The probe only asserts the new behavior; it will pass against a Cobalt binary that carries #4210 and (correctly) fail against one that still returns
Panic(0x21). It does not run in base-std forge CI (ci.ymlis forge/mocks); it executes via the smoke suite (make smoke-invariants) and base-anvil's smoke workflow against published binaries.Test plan
script/smoke/journeys/precompile_invariants.pyparses; diff vsmainis additive only.POLICY_ABIthat_cleanencodes both constructors for UNION+INTERSECT with the correct 4-byte selectors, and thatIncompatiblePolicyType()resolves inERROR_BY_SELECTOR(the mapexpect_raw_revertmatches against).make smoke-invariantsgreen against a Cobalt base-anvil binary built with base/base #4210 (run in lockstep once #4210 is on a Cobalt build).Made with Cursor