Skip to content

Conversation

@adhusson
Copy link
Contributor

No description provided.

@adhusson adhusson changed the base branch from main to feat/donation-resistance-and-force-remove November 21, 2025 01:01
@chatgpt-codex-connector
Copy link

💡 Codex Review

uint256 burnedShares;
if (assets > 0) {
(, burnedShares) = IMorpho(morpho).withdraw(marketParams, assets, 0, address(this), address(this));
position.supplyShares -= uint128(burnedShares);

P1 Badge Burned positions cannot be deallocated later

When burnShares is executed it just zeroes positions[marketId].supplyShares and leaves the actual Morpho supply shares untouched. If liquidity later returns (or new funds are supplied to the same market) and deallocate is called with assets > 0, IMorpho.withdraw will burn some shares and the subtraction at position.supplyShares -= uint128(burnedShares) underflows because the balance was zeroed. The call reverts and prevents any recovery of the position even when withdrawals would otherwise succeed. Consider actually burning the Morpho shares before zeroing the tracker or skipping this subtraction when the tracker has been reset so post-burn withdrawals aren’t bricked.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@adhusson adhusson changed the title [force remove] burn share stest [force remove] burn shares test for #789 Nov 21, 2025
@adhusson adhusson changed the title [force remove] burn shares test for #789 [force remove] burn shares fix+tests for #789 Nov 21, 2025
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.

4 participants