fix(wallet): enforce the native-DERO burn guard on the token-send path#19
Merged
Conversation
TransferToken builds its transfer directly rather than through InternalWalletCall, so it did not share the centralized burn guard the other send paths use. This routes it through the same check. Extract the transfer construction into buildTokenTransfer (credits Amount, Burn 0) and run shouldBlockBurn before building the transaction, so a native-DERO (zero-SCID) burn is consistently rejected across every send path, not just the XSWD path. Add TestTransferTokenCannotBurnNativeDero covering the real constructor: a normal token send is non-destructive and a zero-SCID burn is blocked.
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.
What
Routes
TransferTokenthrough the same native-DERO burn guard the othersend paths already use, so the check is applied consistently across every
path that can build a transfer.
Why
TransferTokenbuilds its transfer directly and callsTransferPayload0without going through
InternalWalletCall, whereshouldBlockBurnruns.That left it as the one send path the guard didn't cover. This change
closes that gap so the guard is enforced everywhere, not just on the
XSWD path.
Changes
buildTokenTransfer(creditsAmount,Burn0), making the exact production construction testablewithout a live wallet.
shouldBlockBurnat the chokepoint before building the transaction,so a native-DERO (zero-SCID) burn is rejected here too.
TestTransferTokenCannotBurnNativeDero, which exercises the realconstructor: asserts a normal token send is non-destructive and that a
zero-SCID burn is blocked.
Verification
go build ./...,go vet, and the full test suite pass.destructive construction and observing it fail.