Skip to content

Add support for Plutus scripts on compatible Tx - #1282

Draft
carbolymer wants to merge 4 commits into
masterfrom
mgalazyn/feature/compatible-plutus
Draft

Add support for Plutus scripts on compatible Tx#1282
carbolymer wants to merge 4 commits into
masterfrom
mgalazyn/feature/compatible-plutus

Conversation

@carbolymer

Copy link
Copy Markdown
Contributor

Context

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

@carbolymer carbolymer self-assigned this Aug 8, 2026
The ledger resolves the Proposing purpose's redeemer pointer index
against proposalProceduresTxBodyL, an OSet whose Indexable instance
walks the underlying StrictSeq in insertion order (StrictSeq.findIndexL),
never Ord order. compareWitnesses' WitProposal branch instead sorted
proposals by their Ord instance before assigning indices, so
makeUnsignedTx could embed a redeemer pointer at the wrong index
whenever a caller's OMap insertion order differed from Ord order.

Fix the WitProposal branch to a constant LT, mirroring WitTxCert's
existing stable no-op, which preserves insertion order through the
stable sort in createIndexedPlutusScriptWitnesses.
The ledger resolves the Certifying purpose's redeemer pointer index
against certsTxBodyL's full StrictSeq, which contains every certificate
- witnessed and unwitnessed alike - in original order. Unwitnessed
certs still consume an index slot there (indexCertificatesWith already
gets this right for the Compatible and legacy Fee builders).

extractWitnessableCertificates instead filtered out unwitnessed certs
before handing the list to createIndexedPlutusScriptWitnesses, so a
Plutus-witnessed cert's assigned index only counted its position among
OTHER WITNESSED certs, undercounting by the number of preceding
unwitnessed certs.

Fix by keeping every certificate in the list, pairing unwitnessed ones
with a placeholder credential and AnyKeyWitnessPlaceholder so their
index slot is still consumed by createIndexedPlutusScriptWitnesses'
zip [0 ..] (which already filters back down to plutus-witnessed
entries afterwards, discarding the placeholders once their slot has
been counted).
Replace the positional-arguments-plus-CompatibleTxExtraContent signature
with a single CompatibleTxBodyContent record covering exactly the
features Compatible implements, named after the experimental
TxBodyContent vocabulary.

Reuse the experimental Witnessable machinery for spending, certifying
and proposing redeemer pointer indexing, replacing the bespoke
ScriptWitnessIndex-based plumbing. Add regression tests for the
proposal and certificate redeemer ordering fixes, and harden getVotes
against voter-map gaps.
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