Skip to content

fix(txbuilder): allow native-script DRep certificates without a redeemer#447

Open
emmanuel-musau wants to merge 1 commit into
IntersectMBO:mainfrom
emmanuel-musau:fix/native-script-drep-cert
Open

fix(txbuilder): allow native-script DRep certificates without a redeemer#447
emmanuel-musau wants to merge 1 commit into
IntersectMBO:mainfrom
emmanuel-musau:fix/native-script-drep-cert

Conversation

@emmanuel-musau

Copy link
Copy Markdown
Contributor

Why this PR is more than the requested test

Follow-up to #432. The review asked for a devnet test with mixed Plutus and
native-script voters in one transaction (using governance_voting.ak).

Writing that test surfaced a blocker: before a native-script DRep can vote on
devnet, it has to be registered, and TxBuilder rejected the registration
with "Redeemer required for script-controlled DRep credential registration".

The fix

Mirrors the approach from #432, deferring the native-vs-Plutus decision to
build time:

  • Removed the eager "redeemer required" failures from
    createRegisterDRepProgram, createUpdateDRepProgram, and
    createDeregisterDRepProgram.
  • Added a validateCertRedeemers build-time pass,
    run alongside validateVoterRedeemers. It classifies
    the DRep credential's script via .attachScript() or reference inputs:
    Plutus credentials still require a redeemer (with guidance in the error for
    both cases); native-script credentials need none, and a mistakenly supplied
    redeemer is pruned with a debug log.
  • Extracted the script classifier shared with the voter pass into
    makeIsNativeScript rather than duplicating it.

Tests

  • TxBuilder.NativeScriptDRepCert.test.ts unit coverage of the cert paths
    (fail without the fix, pass with it).
  • TxBuilder.MixedVoters.test.ts the requested devnet test: one transaction
    with a Plutus DRep voter (keeps its redeemer) and a native-script DRep voter
    (redeemer pruned), registered end-to-end and accepted by the ledger.

@emmanuel-musau

Copy link
Copy Markdown
Contributor Author

Related: #448 — the same eager-redeemer defect exists for CC cold credentials (authCommitteeHot / resignCommitteeCold).
There is an issue open for this check it and confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant