fix: transfer rejects previously burned destinations (#1059) - #1684
Merged
blurbeast merged 2 commits intoAug 30, 2026
Merged
Conversation
- transfer() checked has_any_remittance_state(to), which only looks at Metadata, Score, and RecipientCommitment. burn_internal() clears all three, leaving only the Burned flag, so a burned account always looked empty to transfer and could regain a clean identity via the transfer path — bypassing the BurnedRequiresApproval gate mint()/admin_remint() already enforce - Add a hard check for DataKey::Burned(to) in transfer(), matching mint()'s existing gate exactly. No storage layout change, no new panics - Add 2 regression tests: transfer into a burned address fails with BurnedRequiresApproval and mutates no state on either side; the burned destination never ends up credit-bearing after a rejected transfer - Verified: cargo test (78 passed), cargo fmt --check clean, cargo clippy clean (1 pre-existing unrelated warning: unused STROOP_SCALE constant)
…_nft POINTS_DENOMINATOR now references Self::STROOP_SCALE instead of a hardcoded duplicate literal, matching its own doc comment. Same value (1_000_000_000), no behavior change. Unrelated to the LabsCrypt#1059 security fix itself, but was causing cargo clippy -D warnings to fail CI on this file. Verified: cargo test (78 passed), cargo fmt --check clean, cargo clippy --all-targets --all-features -- -D warnings clean
4 tasks
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 Changed
transfer()only rejected a destination viahas_any_remittance_state(to), which checks for existingMetadata,Score, orRecipientCommitment.burn_internal()clears all three of those on burn, leaving only theBurnedflag set — so a previously burned (defaulted) account always looked "empty" totransfer()and could regain a clean, credit-bearing identity simply by receiving a transfer. This bypassed theBurnedRequiresApprovalgate thatmint()andadmin_remint()already enforce for exactly this scenario.Fix: added a hard check for
DataKey::Burned(to)intransfer(), right next to the existinghas_any_remittance_statecheck, returning the sameNftError::BurnedRequiresApprovalerrormint()uses. No storage layout change (reads the existingBurnedkey), no new panics — pureResultearly-return.Related Issues
Closes #1059
Testing Done
test_transfer_rejects_burned_destination: mints and burns an account, then assertstransferinto it fails withBurnedRequiresApprovaland that neither side's state was mutated.test_transfer_into_burned_destination_never_leaves_credit_bearing_state: explicitly asserts the burned destination has no metadata after a rejected transfer — i.e. it's never simultaneouslyBurnedand credit-bearing.cargo test— 78 passed, 0 failed.cargo fmt --check— clean.cargo clippy— clean (1 pre-existing, unrelated warning: unusedSTROOP_SCALEconstant, not touched by this change).Pull Request Checklist
CONTRIBUTING.mddocument.mint()/admin_remint().