fix(b20-asset): bubble inner-call Panic from announce (BOP-477) - #185
Open
robriks wants to merge 2 commits into
Open
fix(b20-asset): bubble inner-call Panic from announce (BOP-477)#185robriks wants to merge 2 commits into
announce (BOP-477)#185robriks wants to merge 2 commits into
Conversation
…477) The Rust precompile propagates system-level faults from an announce inner call raw (Panic/OutOfGas/Fatal/SlotOverflow via is_system_error) and wraps only ordinary reverts as InternalCallFailed. The Solidity reference wrapped every inner failure, so e.g. an overflowing toScaledBalance reverted Panic(0x11) on-chain but InternalCallFailed in the mock. - MockB20Asset.announce now re-raises an inner Solidity Panic(uint256) (selector 0x4e487b71) unchanged; only ordinary reverts wrap as InternalCallFailed. - IB20Asset.announce natspec corrected: Panic propagates raw; OOG halts; else InternalCallFailed. - Fork conformance test test_announce_innerPanic_propagatesRaw asserts the raw Panic(0x11) payload from the live precompile (no livePrecompiles skip). - Smoke asset journey probes the raw Panic(0x11) payload via eth_call. Scope: only the arithmetic-overflow Panic (0x11) is reachable as an inner call on both sides. OOG/Fatal/SlotOverflow are native-precompile faults a Solidity delegatecall cannot reproduce (OOG follows the 63/64 rule, empty returndata); enum (0x21) / array-OOB (0x32) have no reachable inner-call selector (strict ABI decode rejects out-of-range enums as AbiDecodeFailed before any conversion guard, and nothing produces an array-OOB). Co-authored-by: Cursor <cursoragent@cursor.com>
robriks
requested review from
amiecorso,
eric-ships,
ilikesymmetry,
rayyan224 and
stevieraykatz
as code owners
July 30, 2026 16:26
Interface Coverage✅ All interface functions have test coverage. |
Open
3 tasks
📊 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.75% | 97.35% | 98.69% | 96.46% |
Full report: download artifact. To browse locally: make coverage (runs forge coverage + genhtml + opens the HTML report).
|
announce (BOP-477)
…anges Keep the propagate-raw-vs-wrap rationale in the IB20Asset.announce natspec (the spec) and make the mock comment, test @dev, smoke probe, and expect_raw_panic docstring terse, dropping the repeated BOP-477 explanation and extraneous detail (OOG 63/64 rule, enum/array-OOB reachability). No code change. Co-authored-by: Cursor <cursoragent@cursor.com>
stephancill
reviewed
Jul 30, 2026
stephancill
left a comment
Contributor
There was a problem hiding this comment.
lgtm, would block on approval from @stevieraykatz
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
Reconciles a base/base (Rust, authoritative) ↔ base-std (Solidity reference) divergence in
IB20Asset.announce. When an inner call fails, the Rust precompile propagates system-level faults raw (Panic/OutOfGas/Fatal/SlotOverflow, viais_system_error()) and wraps only ordinary reverts asInternalCallFailed. The Solidity mock wrapped every inner failure — so e.g.announce([toScaledBalance(overflowing)])revertsPanic(0x11)on-chain butInternalCallFailedin the reference.Chosen direction (Rust is authoritative — OOG must halt to preserve EVM gas semantics, and a Panic is a VM-level fault): fix base-std to match Rust.
MockB20Asset.announcere-raises an inner SolidityPanic(uint256)(selector0x4e487b71) unchanged viaassembly { revert(add(ret, 0x20), mload(ret)) }; ordinary reverts still wrap asInternalCallFailed.IB20Asset.announcenatspec corrected: an inner Panic propagates raw; OOG halts the whole call; any other revert wraps asInternalCallFailed.InternalCallFailederror doc clarified.test_announce_innerPanic_propagatesRaw— asserts the rawPanic(0x11)payload from the live precompile (nolivePrecompilesskip).expect_raw_panichelper asserting the rawPanic(0x11)payload viaeth_call.Scope / limitation
OutOfGas/Fatal/SlotOverfloware native-precompile faults a Soliditydelegatecallcannot faithfully reproduce (OOG follows the 63/64 rule and yields empty returndata) — not synthesized in the mock.0x21) / array-OOB (0x32) have no reachable inner-call selector: strict ABI decoding rejects an out-of-range enum asAbiDecodeFailed(an ordinary revert) before any conversion guard, and nothing produces an array-OOB. (Note: a malformed-enum inner call surfaces a decode-timePanic(0x21)in Solidity vsAbiDecodeFailedin Rust — not part of the conformance matrix.)Test plan
forge test --match-contract B20AssetAnnounceTest(reference / mocks) — 14 passtest/unit/B20Asset/*reference suite — 100 pass;forge fmt --checkcleananvil --base(Cobalt) node:test/unit/B20Asset/announcement/*— 20 pass, incl.test_announce_innerPanic_propagatesRawassetjourney vs the same live node — green, incl. the step-14b rawPanic(0x11)probeCompanion (base/base): a test-only self-pin extension asserting every Panic kind classifies as a system error.
Made with Cursor