fix(token)!: reject contract mint/burn recipients - #833
Open
0xisk wants to merge 1 commit into
Open
Conversation
A coin addressed to a contract must be claimed as a shielded receive by that contract's own call in the same transaction (the ledger's unconditional effects check). The module cannot arrange that claim without cross-contract calls, so a contract recipient made every _mint/_burn transaction malformed (audit H-03). * Narrow `recipient`/`refundTo` from `Either<ZswapCoinPublicKey, ContractAddress>` to `ZswapCoinPublicKey` in NativeShieldedTokenCore and both flavors; wrap with `left<...>` at the protocol boundary and guard zero keys with `Utils_isKeyZero`. * Update the mocks, simulators, and supply-extension doc examples to the narrowed signatures; refresh the stale `@circuitInfo` rows. * Drop the mint-to-contract and zero-address tests: the narrowed parameter type is the guarantee, and the retired shape is reachable only by casting through it.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
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.
Types of changes
Fixes #794
Based on
release/v0.3.0-alpha.1-rc.0, notmain. That branch predates #694, so its test files carry no live-backend plumbing; the main-based version of the same change sits onfix/audit-nst-h3(463f794d) for when the release line is re-cut.This closes the contract arm rather than implementing the two-contract claim the finding sketches (
transientCommitplus the recipient's ownclaimContractCall). That pattern needs a call into the recipient contract, which a library module cannot make on its caller's behalf. Nothing about the arm is persisted, so it can be widened again once contract-to-contract calls land, with no state migration.Breaking: pass a bare
ZswapCoinPublicKeywhere anEitherused to go.Not visible in the diff:
docs/.PR Checklist