Prevent successful withdrawals that burn unlock NFTs while transferring zero assets#82
Draft
lukezed wants to merge 1 commit into
Draft
Prevent successful withdrawals that burn unlock NFTs while transferring zero assets#82lukezed wants to merge 1 commit into
lukezed wants to merge 1 commit into
Conversation
f0bea3a to
4a01439
Compare
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.
This patch makes
Tenderizer.withdraw()revert when the adapter returns0assets.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:
42assets = 00This 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 --checkFOUNDRY_PROFILE=tenderizer forge test --match-contract TenderizerTest --match-test test_Withdraw_RevertIfAdapterReturnsZeroAssetsNote: 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.