Skip to content

Prevent successful withdrawals that burn unlock NFTs while transferring zero assets#82

Draft
lukezed wants to merge 1 commit into
Tenderize:mainfrom
lukezed:codex-prevent-zero-asset-withdrawals
Draft

Prevent successful withdrawals that burn unlock NFTs while transferring zero assets#82
lukezed wants to merge 1 commit into
Tenderize:mainfrom
lukezed:codex-prevent-zero-asset-withdrawals

Conversation

@lukezed
Copy link
Copy Markdown

@lukezed lukezed commented May 20, 2026

This patch makes Tenderizer.withdraw() revert when the adapter returns 0 assets.

Today, the withdraw path can complete successfully even when the adapter returns zero. That means the user's unlock NFT is consumed, the unlock state can be deleted, Withdraw(..., 0, unlockID) is emitted, and the user receives no underlying asset.

A successful withdrawal should probably withdraw something.

This is especially important for adapter integrations where upstream protocol state can change or return unexpected values. Reverting preserves the unlock NFT and all state, giving the protocol/team a chance to fix adapter accounting instead of finalizing a zero-asset redemption.

Related real-world failure mode:

  • unlockID 42
  • withdraw emitted assets = 0
  • GRT transfer amount 0
  • unlock NFT was burned

This patch does not fully fix the GRT/Horizon accounting issue, but it prevents the protocol from turning an accounting failure into an irreversible user-facing loss.

Validation:

  • git diff --check
  • FOUNDRY_PROFILE=tenderizer forge test --match-contract TenderizerTest --match-test test_Withdraw_RevertIfAdapterReturnsZeroAssets

Note: the focused test was run with a temporary local Foundry profile that limits compilation to test/tenderizer, because the current repository test tree has unrelated compile failures in existing GraphAdapter/fork tests under the default profile.

@lukezed lukezed force-pushed the codex-prevent-zero-asset-withdrawals branch from f0bea3a to 4a01439 Compare May 20, 2026 21:14
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.

1 participant