Skip to content

fix(evolution): resolve committee cert redeemers to their certificate index (#518) - #642

Open
Kshot3000 wants to merge 1 commit into
IntersectMBO:mainfrom
Kshot3000:fix/committee-cert-redeemer-index
Open

Kshot3000 wants to merge 1 commit into
IntersectMBO:mainfrom
Kshot3000:fix/committee-cert-redeemer-index

Conversation

@Kshot3000

Copy link
Copy Markdown

Summary

Fixes #518. authCommitteeHot and resignCommitteeCold store a Plutus-script committee cold credential's redeemer under cert:{coldCredentialHash}, but the certificate lookup that resolves that key to a certificate index never checked committeeColdCredential, so the redeemer was dropped and the transaction could not be built.

The lookup exists in two places, and both had the same gap:

  • txBuilder.ts (assembly): the cert branch matched only stakeCredential and drepCredential; an unresolved key logged Could not find cert index for key: cert:… and the redeemer was skipped.
  • Evaluation.ts (script evaluation): the certificate index map was built from the same two fields, so evaluation never associated the redeemer with a purpose either — in practice the build failed there first, with Evaluation returned zero results despite having … once the assembled pre-evaluation transaction came back with no cert redeemer for the evaluator to price.

Both now also match committeeColdCredential (the credential on AuthCommitteeHotCert and ResignCommitteeColdCert), in the same shape as the existing branches.

Deliberately left out

The issue's second suggestion — failing instead of warning when a cert redeemer cannot be resolved. Warn-and-continue is the shared behaviour of that assembly loop for every redeemer tag (mint, cert, reward, vote), so changing the failure semantics for cert alone is a broader behaviour change than the index fix; I left it for maintainer direction rather than deciding it in this PR. After this fix, a committee cert redeemer resolves, so the warning path is only reachable for a key that names no certificate at all.

Tests

New file TxBuilder.PlutusCCCert.test.ts (4 tests), all verified red on main first, one at a time:

  • Plutus-script authCommitteeHot with a redeemer: on main the build failed in evaluation; after the fix it emits one cert redeemer at index 0 with the evaluator's ExUnits, the Plutus V3 script in the witness set, and a script data hash.
  • Index positioning: a key-hash authCommitteeHot first and the Plutus one second — the redeemer is emitted at index 1 (the committee certificate's own index), with the ExUnits the evaluator returned for index 1.
  • Plutus-script resignCommitteeCold with a redeemer: one cert redeemer at index 0.
  • Control (passes on main too): a key-hash cold credential emits no redeemer, even when one is supplied — native-script and key-hash committee flows are unchanged (the existing TxBuilder.NativeScriptCCCert suite also still passes).

Full suite: 1682 passed / 75 skipped / 0 failed (103 test files: 102 passed, 1 skipped) — main's 1678 baseline plus the 4 new tests. tsc --noEmit and eslint clean; a patch changeset is included.


Built and maintained by Kyle Cox — independent Cardano builder.
𝕏 @Kshot9000 (https://x.com/kshot9000) · GitHub https://github.com/Kshot3000
ADA: addr1q8hnl6vl5a6k3rw3n5g3jtte696zcl76kfatzv7gpswa9r0dj7fma6klq55y4ffm7tf0em09udnyhuk4ah92pl5x9jpqjae44v
Not affiliated with the Cardano Foundation, IOG, or Intersect. Tagging @cardano-foundation and @IntersectMBO for visibility.

This branch has not been deployed

No deployments
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.

txBuilder: committee cert redeemers are never resolved to a certificate index

1 participant