add ShieldedMultiSigToken preset with threshold-gated mint and burn#451
Draft
pepebndc wants to merge 2 commits intoadd-multisigfrom
Draft
add ShieldedMultiSigToken preset with threshold-gated mint and burn#451pepebndc wants to merge 2 commits intoadd-multisigfrom
pepebndc wants to merge 2 commits intoadd-multisigfrom
Conversation
Introduces ShieldedMultiSigToken.compact: a multisig token contract where
both minting and burning require threshold ECDSA authorization. No deposit
function exists — the only way tokens enter supply is through an authorized
mint(). Operation domain prefixes ("MGBP:MINT" / "MGBP:BURN") in the
message hash prevent cross-operation signature replay.
Also clarifies ShieldedMultiSigV2 doc to distinguish it as a vault
(unauthenticated deposit, threshold-gated send) and cross-references
the new token contract.
|
Important Review skippedDraft detected. 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:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Replaces the receiveShielded/sendShielded flow (which expected externally created coins) with Midnight's native shielded token primitives, following the pattern from the archived ShieldedToken: - mint() calls mintToken() to create a new UTXO of this contract's token type, addressed to the contract itself. No external coin input. - burn() calls receive() + sendImmediate() to burnAddress() to destroy a coin. Only coins of this contract's token type can be burned. Adds state required for native minting: _counter (doubles as op nonce for replay protection and feeds evolveNonce for coin nonce uniqueness), _coinNonce, and _tokenDomain (sealed, set at construction). Constructor gains initCoinNonce and tokenDomain parameters. Adds getTokenDomain() and getTokenType() views so callers can derive the color.
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.
Summary
ShieldedMultiSigToken.compact: a multisig token contract where bothmintandburnrequire threshold ECDSA authorizationdepositfunction — tokens can only enter supply through an authorizedmintMGBP:MINT/MGBP:BURN) in the message hash prevent cross-operation signature replayShieldedMultiSigV2doc to distinguish it as a vault (unauthenticated deposit + threshold-gated send) and adds a cross-reference to the new contractContracts
ShieldedMultiSigV2deposit(open),execute(threshold-gated send)ShieldedMultiSigTokenmint(threshold-gated),burn(threshold-gated)Notes
stubVerifySignaturealways returnstrue) — pending the Compact ECDSA + Keccak primitivespersistentHashas a placeholder; will need to switch tokeccak256to match BitGo's HSM signing format once the primitive lands