Repository navigation
fix!: use deposit-bearing certificates (7/8) for stake (de)registration - #871
Merged
Merged
Conversation
whisky's parser reports `coin: 0` for every stake registration, so reading it in `baseCertFromObj` turned a CSL-parsed registration into a certificate 7 with a 0 deposit when the body was rebuilt. The deposit is left to the keyDeposit protocol parameter again. Certificate 7 needs the stake credential's witness, so the emulator tests registering a script stake credential now provide the script and collateral. New tests pin that a missing script witness and a missing stake key signature are rejected, and that a CSL-parsed registration is rebuilt with the keyDeposit deposit.
twwu123
approved these changes
Nov 13, 2026
twwu123
approved these changes
Nov 13, 2026
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
registerStakeCertificate/deregisterStakeCertificate(and the deprecatedTransaction.registerStake/deregisterStake) now build the Conway certificates 7 (reg_cert) and 8 (unreg_cert), which state their deposit, instead of the legacy certificates 0 and 1. The legacy certificates are gone from the CDDL of the next era (Dijkstra), so Mesh stops producing them.keyDepositprotocol parameter is used at serialization, and the builder balances with the same value. A deregistration refund must equal the deposit originally paid, so it can now be stated whenkeyDeposithas changed since the registration.coin, so historical transactions round-trip.CSLSerializerrejects stake (de)registration: whisky ignores the deposit and emits the legacy certificates.coin: 0for every one), so a parsed registration is rebuilt with thekeyDepositdeposit rather than 0.Breaking changes
Unlike certificate 0, certificate 7 must be witnessed by the stake credential:
MeshWalletsigns with one key, so the stake key needs a second instance withaccountType: "stake"andsignTx(tx, true);certificateScript(...)(plus a redeemer and collateral for Plutus), and the validator must accept thepublishpurpose.CSLSerializernow throws on stake (de)registration; use the CST serializer, theMeshTxBuilderdefault.Affect components
@meshsdk/common@meshsdk/contract@meshsdk/core@meshsdk/core-csl@meshsdk/core-cst@meshsdk/hydra@meshsdk/provider@meshsdk/react@meshsdk/svelte@meshsdk/transaction@meshsdk/walletType of Change
Related Issues
None.
Checklist
npm run test)npm run build)Additional Information
The emulator tests in
tx.test.tscheck that certificate 7 is rejected without the script witness (MissingOrExtraScriptHashes) and without the stake key signature (MissingKeyHashes), andstake-certificates.test.tschecks that a registration parsed by the CSL parser is rebuilt with thekeyDepositdeposit. CI runs only thecore-cstandscalus-emulatortests, so thetransactionandcore-csltests were run locally withnpm run test(all 9 packages pass).Follow-ups, not in this PR:
StakeRegistration::new_with_explicit_deposit,StakeDeregistration::new_with_explicit_refund, acoinonDeregisterStake) and reportcoin()from its parser. Then the CSL guard can go andfromObjcan read the deposit again.