Skip to content

certora: model native wrapping in NoResidue#87

Merged
QGarchery merged 5 commits into
wrap-nativefrom
wrap-native-review-fix
Jul 24, 2026
Merged

certora: model native wrapping in NoResidue#87
QGarchery merged 5 commits into
wrap-nativefrom
wrap-native-review-fix

Conversation

@claude

@claude claude Bot commented Jul 24, 2026

Copy link
Copy Markdown

Requested by Quentin Garchery · Slack thread

Stacked on top of #82 (base branch = wrap-native).

Before

The certora/specs/NoResidue.spec suite only modeled ERC20 transfers and Morpho methods. On the new native paths added in #82 (where msg.value > 0), BlueBundlesV1 mints WNative to the bundler via WNative.deposit and burns it via WNative.withdraw when refunding the unused remainder. Those calls were left unsummarized, so the persistent bundlerBalance ghost stayed stale while the actual token balance moved. The no-residue rules therefore compared against a wrong balance and the suite would fail on native executions (unless the rules were narrowed to msg.value == 0, which would drop native coverage entirely).

After

The no-residue rules stay exact on the native paths too: wrapping and then supplying/repaying (and refunding any remainder) is proven to leave zero residue of every token, without excluding msg.value > 0 executions.

How

In certora/specs/NoResidue.spec, added two exact-signature summaries in the methods block for the WNative interface (src/libraries/interfaces/IWNative.sol), used by TokenLib.pullOrWrapNative and the native refund in BlueBundlesV1:

  • deposit() -> summaryWrapNative(calledContract, e.msg.value) credits bundlerBalance by the forwarded native value (WNative minted to the bundler).
  • withdraw(uint256) -> summaryUnwrapNative(calledContract, amount) debits bundlerBalance by the unwrapped amount (WNative burned; the returned native is not a tracked token).

These mirror the existing ERC20/Morpho summary style and keep the persistent bundlerBalance ghost in sync across native wrap/unwrap.

Addresses review comment: #82 (comment)

claude and others added 5 commits July 24, 2026 14:59
The wrap-native change makes BlueBundlesV1 mint WNative to the bundler
via WNative.deposit on native supply/repay and burn it via
WNative.withdraw when refunding the unused native remainder. NoResidue
only summarized ERC20 transfers and Morpho methods, so these calls left
the persistent bundlerBalance ghost stale on native paths and the
no-residue rules compared against a wrong balance.

Add deposit/withdraw summaries that credit/debit bundlerBalance by the
wrapped/unwrapped amount, keeping the no-residue rules exact on native
paths instead of restricting them to msg.value == 0.
@QGarchery
QGarchery marked this pull request as ready for review July 24, 2026 16:25
@QGarchery
QGarchery merged commit 83628c9 into wrap-native Jul 24, 2026
9 checks passed
@QGarchery
QGarchery deleted the wrap-native-review-fix branch July 24, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants