Further StAnnTx integration#5857
Open
teodanciu wants to merge 13 commits into
Open
Conversation
5af319a to
bc54d6a
Compare
StAnnTx integrationStAnnTx integration
teodanciu
commented
May 22, 2026
lehins
reviewed
May 25, 2026
lehins
left a comment
Collaborator
There was a problem hiding this comment.
I'll finish the review later when I am back to work on Wednesday
bc54d6a to
df72280
Compare
There was a problem hiding this comment.
Pull request overview
This PR continues StAnnTx integration by introducing ValidatedTx, updating mempool transaction application/reapplication APIs, and wiring Alonzo-specific handling for slot-dependent Plutus context construction at ledger entry points.
Changes:
- Adds/deprecates
ApplyTx/mempool APIs aroundValidatedTxand reusable default implementations. - Introduces
AlonzoLEDGERSand updates Alonzo UTXOS to consume memoized Plutus contexts fromStAnnTx. - Updates era instances, tests, benchmarks, and changelogs to use the new APIs and removed memoized protocol-version fields.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
libs/ledger-state/bench/Performance.hs |
Updates benchmark transaction application/reapplication to new validated transaction APIs. |
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/MockChain.hs |
Adds embedding support for AlonzoLEDGERS. |
libs/cardano-ledger-test/benchProperty/Main.hs |
Imports Alonzo trace instances for benchmark properties. |
libs/cardano-ledger-test/bench/Bench/Cardano/Ledger/ApplyTx.hs |
Switches apply benchmark to applyTxWithFullValidation. |
eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Generator/Trace/Ledger.hs |
Extracts reusable ledgersSigGen. |
eras/shelley/test-suite/CHANGELOG.md |
Documents the new test generator helper. |
eras/shelley/impl/src/Cardano/Ledger/Shelley/API/Mempool.hs |
Adds ValidatedTx, new apply/reapply APIs, defaults, and deprecations. |
eras/shelley/impl/CHANGELOG.md |
Documents mempool API changes. |
eras/mary/impl/src/Cardano/Ledger/Mary.hs |
Uses default ApplyTx implementations. |
eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra/Tx.hs |
Removes protocol version from Dijkstra StAnnTx. |
eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra.hs |
Uses default mempool implementations and updated StAnnTx. |
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/LedgerSpec.hs |
Updates tests to use full validation API. |
eras/conway/impl/src/Cardano/Ledger/Conway.hs |
Uses default mempool implementations. |
eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxos.hs |
Adapts UTXOS environment after removing ueUtxo. |
eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs |
Updates UTXOS transition environment construction. |
eras/babbage/impl/src/Cardano/Ledger/Babbage.hs |
Uses default ApplyTx implementations. |
eras/alonzo/test-suite/src/Test/Cardano/Ledger/Alonzo/Trace.hs |
Adds trace support for AlonzoLEDGERS. |
eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/TreeDiff.hs |
Updates AlonzoStAnnTx tree diff after field removal. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs |
Removes protocol version from AlonzoStAnnTx. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxos.hs |
Reuses memoized Plutus scripts/contexts from StAnnTx. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs |
Updates UTXOS environment construction. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Ledgers.hs |
Implements new Alonzo-specific LEDGERS rule. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules.hs |
Re-exports the new Alonzo LEDGERS rule module. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Era.hs |
Maps Alonzo LEDGERS to AlonzoLEDGERS. |
eras/alonzo/impl/src/Cardano/Ledger/Alonzo.hs |
Adds Alonzo-specific validation/reapplication behavior and updated StAnnTx. |
eras/alonzo/impl/CHANGELOG.md |
Documents Alonzo rule/environment changes. |
eras/allegra/impl/src/Cardano/Ledger/Allegra.hs |
Uses default ApplyTx implementations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
df72280 to
cc97f3d
Compare
47b3a9c to
57e8230
Compare
57e8230 to
fd85863
Compare
to replace `applyTxValidation`, operating on `ValidatedTx`. Define `applyTxValidation` in terms of `applyTxWithValidation`
for more per-era control over revalidation of transactions
so it can be reused in Alonzo
by extracting the shared logic in helpers
fd85863 to
df8cf07
Compare
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.
Description
So far, integration of
StAnnTx- which means using the memoized values that it holds - has been done for eras starting with Babbage (#5804).Alonzo is problematic because the EpochInfo used when creating plutus contexts in Alonzo is modified with
unsafeLinearExtendEpochInfo, which depends on the slot number.Passing the slot number when creating the
StAnnTxturned out to be an incorrect solution, because that would make the memoized version dependent on the environment.Instead, in this PR, the problem is handled by pushing the discrepancy more at the "edges" - namely modifying the EpochInfo via
unsafeLinearExtendEpochInfoat the entry points: inApplyTxandLEDGERSrule for alonzo.ApplyTxhas been restructured (old methods deprecated), in order to facilitate the change we needed ,and also to provide better names, as follows:applyTxValidationdeprecated in favor ofapplyTxWithValidationapplyTxdeprecated in favour ofapplyTxWithFullValidationreapplyTxdeprecated in favor ofreapplyValidatedTxunsafeMakeValidateddeprecated in favor ofunsafeMakeValidatedTxA new method was added to
ApplyTx:reapplyTxFromValidated- for full per-era flexibility and safety.A new
AlonzoLEDGERShad to be introduced instead of reusing ShelleyLEDGERS, that passes theunsafeLinearExtendEpochInfomodification.Finally, the memoized plutus contexts have been reused in Alonzo UTXOS.
Closes #5836
Checklist
CHANGELOG.mdfiles updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
.cabalandCHANGELOG.mdfiles when necessary, according to theversioning process.
.cabalfiles updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh).scripts/cabal-format.sh).scripts/gen-cddl.sh)hie.yamlupdated (usescripts/gen-hie.sh).