Skip to main content

92 posts tagged with "ledger"

View All Tags

Ledger Team Update

· 5 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary​

Most of this cycle went into Leios and the block header abstraction that supports it. The EraBlockHeader interface was reshaped into a separate type class per protocol that can be specified on a per-era basis, which required a dedicated BbodySignal type and a redefined BBODY rule for Babbage, where the TPraos to Praos switch happened. Related to this, the block header now uses a more lax VersionInfo in place of ProtVer for Dijkstra and no longer relies on a self-reported version when constructing headers. On Leios itself we now select the Leios committee at the epoch boundary, expire BLS keys after KES expiry, check the BLS proof of possession in Dijkstra's POOL rule, added a lens for the announcement block header reference on LeiosEraBlockHeader, and added Dijkstra forecasting for Leios on the prototype branch. We also began laying groundwork for Peras by adding its protocol parameters, while keeping Peras certificates out of the Dijkstra block body for now.

Work on the Plutus V4 context and sub-transactions continued, with the PlutusV4 context implemented for the GuardingPurpose and the sub-transaction index now available in the Plutus context. On the Dijkstra era itself we added a DijkstraEraTx type class with a hashTx function, fixed a superclass constraint in DijkstraEraPParams, added reference-input cost protocol parameters (ppRefInputsCostPerMultiAssetPolicyL and ppRefInputsCostPerDatumByteL) starting at Dijkstra, and fixed conservation of value for phase-2-invalid transactions. Elsewhere we introduced a distinct type for the pool distribution used for governance, fixed VRF reuse when re-registering a pool, and removed some unnecessary memory overhead in native scripts.

On the testing side we continued filling in predicate-failure coverage for the sub-rules and related rules (MEMPOOL, SUBGOV, SUBLEDGER), enabled tests in CertSpec, added a BBODY ImpSpec, added regression tests for conformance, LeiosCert serialization tests, and more withdrawal tests. For infrastructure and releasing we updated the Allegra changelog, bumped the CHaP index-state, and dropped cardano-crypto-leios as a source-repository-package from the cabal project.

Low level summary​

Features​

  • PR-6054 - Use a distinct type for the pool distribution used for governance
  • PR-6062 - Fix VRF reuse when re-registering pool
  • PR-6052 - Select the Leios committee at the epoch boundary
  • PR-6047 - Expire BLS keys after KES expiry
  • PR-6089 - Fix superclass constraint in DijkstraEraPParams
  • PR-6077 - Fix conservation of value for phase2- invalid transactions
  • PR-6099 - Add DijkstraEraTx typeclass with hashTx function
  • PR-6088 - BlockHeader cross era interface
  • PR-6084 - Use more lax VersionInfo in place of ProtVer in BlockHeader for Dijkstra
  • PR-6101 - Add ebReferencesAnnouncementBlockHeaderL to LeiosEraBlockHeader
  • PR-6067 - Add Peras protocol parameters
  • PR-6068 - PlutusV4 context for GuardingPurpose
  • PR-6117 - Do not use self-reported version when constructing block headers
  • PR-6064 - [Leios Prototype] Add Dijkstra forecasting for Leios
  • PR-6110 - Add ppRefInputsCostPerMultiAssetPolicyL and ppRefInputsCostPerDatumByteL protocol parameters starting at DijkstraEra
  • PR-6085 - Check BLS proof of possession in Dijkstra's POOL rule
  • PR-6121 - Sub Tx index in plutus context
  • PR-6122 - Remove unnecessary memory overhead in NativeScripts

Testing​

  • PR-6082 - Add regression tests for conformance
  • PR-6091 - Add LeiosCert serialization tests
  • PR-6095 - MEMPOOL predicate failures
  • PR-6083 - SUBGOV predicate failures
  • PR-6115 - Enable tests in CertSpec
  • PR-6116 - BBODY Impspec
  • PR-6111 - Additional withdrawal tests
  • PR-6112 - SUBLEDGER predicate-failure tests

Infrastructure and releasing​

  • PR-6087 - Update Allegra changelog
  • PR-6107 - Update CHaP index-state and remove cardano-crypto-leios as SRP from cabal project

Ledger Team Update

· 6 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary​

This update spans four weeks, so it covers a larger than usual body of work. The headline item is that Dijkstra's batch validation now executes Plutus scripts from sub-transactions and accounts for their execution budgets. Previously it skipped Plutus execution for sub-transactions, so spending validators and minting policies inside a sub-transaction were not enforced and their ExUnits were left out of transaction and block limits and of script fees; that gap is now closed, and sub-transaction budgets count toward limits and fees. Alongside this, withdrawals handling in the ENTITIES rule was reworked to implement the full set of responsibilities from the specification, covering the network and existence checks, the legacy-mode full-drain and per-account sub-aggregate cap, and the non-legacy pre-batch existence check and batch-wide aggregate cap over the top transaction together with all of its sub-transactions. This moved the batch withdrawal checks out of UTXO and into ENTITIES, and was accompanied by conservation of value in legacy mode and by SUBUTXO/SUBUTXOW predicate failures.

A second major thread was the Plutus V4 context: we implemented the TxInfo translation for protocol version 4, redid the PlutusPurpose translation, made further TxInfo improvements, fixed the Dijkstra cost model injection, and bumped plutus-ledger-api to at least 1.68.

Progress continued on the Dijkstra era rules and on Leios. A POOL rule was added for Dijkstra, an EMax /= 0 well-formedness check was introduced, the stake calculation was made consistent by moving SNAP to the end of the EPOCH, and account balance intervals are now enforced. On the Leios side, the Leios protocol parameters were added to the Dijkstra era and the leios_certificate signer set is now size-constrained. We also removed the hardforkConwayMoveWithdrawalsAndDRepChecksToLedgerRule transition flag and the WithdrawalsNotInRewardsCERTS failure, finishing the migration of those withdrawal and DRep checks into the ledger rule.

The rest of the work spanned serialisation, more abstract interfaces, conformance, and releasing. On serialisation we adjusted transaction serialisation in the block body, made the OutputVRF decoder more resilient, removed a guard from the IndividualPoolStake codecs, and improved the custom PParamUpdate encoding. The move toward era-parametric interfaces continued with an era parameter on StakePoolParams, forcing of the Shelley initial-funds injection result, and ToJSON/FromJSON instances for EraTxOut and for TxBody/Tx across all eras. On testing we landed two formal-ledger-specification updates (one enabling the corresponding tests), conformance for the Dijkstra EPOCH rule and for starting account balance intervals, the Shelley Pool Imp tests in Dijkstra conformance, an era-generic Conway CERTS test, and a fix for a produced vs. consumed conformance failure. Finally, we updated to crypton == 1.1 (replacing memory with ram), hardened the branch-history CI job, and landed two rounds of backports of fixes for node 11.1.1.

Low level summary​

Features​

  • PR-5983 - Implement TxInfo translation for PV4
  • PR-6017 - shelley: force the initial-funds injection result
  • PR-6031 - Add EMax /= 0 as well formed check to Dijkstra era
  • PR-6012 - Conservation of value in legacy mode
  • PR-5888 - Constrain the size of leios_certificate signers
  • PR-6033 - Make OutputVRF decoder more resilient
  • PR-5986 - Make stake calculation consistent in dijkstra by moving SNAP to the end of the EPOCH
  • PR-5985 - Adjust transaction serialization in BlockBody
  • PR-6001 - Enforce (starting_)account_balance_intervals
  • PR-6002 - Add Leios protocol parameters to DijkstraEra
  • PR-6041 - Remove hardforkConwayMoveWithdrawalsAndDRepChecksToLedgerRule and WithdrawalsNotInRewardsCERTS
  • PR-6040 - Add era parameter to StakePoolParams
  • PR-6046 - Bump plutus-ledger-api to >=1.68
  • PR-5855 - Add ToJSON/FromJSON instances for EraTxOut
  • PR-6038 - Redo PlutusPurpose translation
  • PR-6030 - Fix CostModels injection for Dijkstra
  • PR-6051 - TxInfo improvements
  • PR-6029 - Add POOL rule for Dijkstra
  • PR-5997 - Withdrawals rework in ENTITIES
  • PR-6071 - Execute Plutus scripts from sub-transactions and count their ExUnits
  • PR-6070 - Improve versatility of custom PParamUpdate encoding
  • PR-6042 - Remove guard from IndividualPoolStake codecs
  • PR-6076 - Add ToJSON/FromJSON instances for TxBody l and Tx l in all eras

Testing​

  • PR-6019 - Improve tests in UtxoSpec
  • PR-6022 - Update formal-ledger-specification
  • PR-5995 - Update formal-ledger-specification and enable tests
  • PR-6024 - Enable Shelley Imp tests for Pool in conformance (Dijkstra)
  • PR-5842 - Add a submitFailingSubsetTx helper
  • PR-6009 - Make Conway CERTS test era-generic
  • PR-6056 - Conformance for EPOCH rule in Dijkstra
  • PR-6044 - Conformance for starting account balance intervals
  • PR-6034 - SUBUTXOW predicate failures
  • PR-6055 - SUBUTXO predicate failures
  • PR-6074 - Fix conformance failure in produced vs. consumed

Infrastructure and releasing​

  • PR-6014 - Make the branch-history CI job more robust
  • PR-5999 - Update to crypton == 1.1 and replace memory package with ram
  • PR-6025 - Backport of fixes for node 11.1.1
  • PR-6028 - Backport of fixes for node 11.1.1 - take 2
  • PR-6032 - Add changelog for cardano-ledger-shelley-1.19.0.1 backport

Ledger Team Update

· 4 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary​

Leios support in the ledger took another step forward this cycle: pool parameters now carry an actual BlsKey, replacing the placeholder types introduced previously. On the testing side, block-header serialization - Praos and Leios alike - is now covered by a dedicated round-trip test suite, giving early guard-rails on the wire format as the Leios header evolves.

Work on nested transactions in Dijkstra advanced as well: the withdrawal mechanism for sub-transactions was implemented. Predicate failures around this area were reworked to be more useful and consistent, moved into the layer the specification prescribes and given clearer names. We settled how UTxO state updates should behave under nested transactions and the AdaPots obligations invariant guard-rail was adapted accordingly. A field for the initial account balance was also added to the top-level transaction body.

On the Plutus side, a per-block script cache was introduced so that scripts decoded once for a transaction can be reused by later transactions within the same block. A related optimization now memoizes the computation of the script hashes a transaction needs.

Two CIPs advanced this cycle. CIP-50 (pledge-leverage-based staking rewards) was implemented, and groundwork for CIP-23 began with the addition of the minPoolMargin protocol parameter to the Dijkstra era.

Test coverage was expanded: the Conway conformance suite was enabled in Dijkstra, and new tests were added around stake calculations and sub-transactions - as far as the current test framework allows.

Low level summary​

Features​

  • PR-5945 - Fix JSON roundtrip for InjectionData
  • PR-5946 - Make AlonzoTx mempool decoder backwards compatible
  • PR-5942 - Optimize plutus script preparation
  • PR-5953 - Reuse script cache for script validation
  • PR-5952 - Add startingAccountBalanceInterval to TopTx body
  • PR-5930 - Fix deposits in AdaPots calculations
  • PR-5941 - Fix updating of UTxOState
  • PR-5947 - Add canonical ledger state CDDL spec and validation tests
  • PR-5938 - Rename isValid to isPhase2Valid
  • PR-5967 - Move network checks of deposits and withdrawals to (SUB)ENTITIES
  • PR-5961 - Remove unnecessary setup of the DRepPulser
  • PR-5960 - Memoize getScriptsHashesNeeded in StanTx
  • PR-5969 - Withdrawals rework in SubEntities
  • PR-5943 - CIP-50 Pledge Leverage-Based Staking Rewards
  • PR-5891 - Add BlsKey in StakePoolParams
  • PR-5854 - Add ToJSON/FromJSON instances for EraTxWits
  • PR-5949 - CIP-23 - Add minPoolMargin protocol parameter to Dijkstra era
  • PR-5950 - Drop EncCBORGroup BlockBody in Dijkstra
  • PR-5909 - Stable type for querySetSnapshotStakePoolDistr

Testing​

  • PR-5939 - Enable Conway conformance tests in Dijkstra
  • PR-5959 - Test collateral inputs are in utxo
  • PR-5971 - Add Imp test to test that DReps unregistered and reregistered in the same tx lose vote delegated stake
  • PR-5948 - Add serialization tests for block headers
  • PR-5975 - Add stake calculation tests for conway

Infrastructure and releasing​

  • PR-5874 - Update cardano-binary to 1.9.1.0
  • PR-5968 - Restore <2.6 bound for cardano-crypto-class
  • PR-5970 - Bump cardano-data version for release
  • PR-5976 - Correct a bad changlog entry

Ledger Team Update

· 4 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary​

Leios support in the ledger continued to take shape this cycle. Building on the block body work from the previous updates, a Leios.BlockHeader was added along with an EraBlockHeader instance for Praos that consensus needs for its 11.1 integration, which together move the block header behind a common era-parametric abstraction. On the leios-prototype branch we also backported the addition of a LeiosKey (a BLS12381 public key together with a possession proof) to StakePoolParams and StakePoolState, with the Dijkstra CDDL updated to carry the Leios key as an optional field in the pool registration certificate.

A good deal of governance and rules work landed as well. Following the introduction of the ENTITIES rule in the previous cycle, we implemented CIP-181 by removing the DRep-delegation requirement for reward withdrawals, which dropped the corresponding predicate failures from the entities and sub-entities rules. On the Plutus cost model side we followed up on the earlier argument-ordering bug fix with a more permanent safeguard: a new CostModelsUpdate newtype now wraps the update argument so the old and new cost models can no longer be swapped by accident, and the symmetric Semigroup/Monoid instances for CostModels that made that mistake possible were removed. We also adjusted the consumed/produced interface and fixed getProducedValue for the Dijkstra era, added an AccountBalanceExact constructor to AccountBalanceInterval, and switched the minor protocol version to Word32. We also fixed NoThunks instances in the Alonzo and Conway genesis types.

Several changes continued the ongoing push toward more era-parametric, abstract interfaces. SnapShots was made era parametric, and ToJSON/FromJSON instances were added for EraTxAuxData, extending the JSON serialisation coverage started last cycle for scripts. On the Canonical Ledger State front, export and import modules were introduced for handling canonical state, giving a first pass at reading and writing it through the CLS interface. On the testing side the Conway conformance tests were updated to protocol version 11 and tests were added for the newly introduced top-level guard requirement.

On the tooling and infrastructure side, the hackage index-state was bumped to pick up the latest cuddle release, which now validates that CBOR maps contain no duplicate keys per RFC 8949 and required a couple of generators to be adjusted accordingly, and the usual GitHub Actions bumps were applied.

Low level summary​

Features​

  • PR-5905 - Introduce CostModelsUpdate
  • PR-5853 - Add ToJSON/FromJSON instances for EraTxAuxData
  • PR-5869 - Add export/import modules for canonical ledger state
  • PR-5915 - Add EraBlockHeader instance for Praos
  • PR-5918 - Fix getProducedValue for Dijkstra
  • PR-5916 - Remove DRep requirement for reward withdrawals
  • PR-5919 - Adjust consumed and produced interface
  • PR-5935 - Switch minor protocol version to Word32
  • PR-5940 - [Backport] Add LeiosKey to StakePoolParams in leios-prototype branch
  • PR-5927 - Add Leios.BlockHeader
  • PR-5933 - Add AccountBalanceExact constructor to AccountBalanceInterval
  • PR-5944 - Make SnapShots era parametric
  • PR-5926 - Fix/allow thunks in Alonzo/Conway geneses

Testing​

  • PR-5900 - Update Conway conformance tests to PV 11
  • PR-5914 - Add tests for RequiredTopLevelGuards

Infrastructure and releasing​

  • PR-5917 - Bump slackapi/slack-github-action from 3.0.3 to 3.0.4 in the actions group
  • PR-5928 - Update hackage index-state version to get latest cuddle release
  • PR-5934 - Bump slackapi/slack-github-action from 3.0.4 to 4.0.0 in the actions group

Ledger Team Update

· 5 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary​

This update covers a longer stretch than usual because there was no report since 2026-05-27: the whole Ledger team was first at the ZuriHac conference and then had an in-person team meetup, so the last several weeks were lighter on routine reporting but no less productive. A good chunk of the work below is the continuation of storylines from earlier updates, alongside a few new fronts.

On the performance side the state-annotated transaction (StAnnTx) work reached back to the older eras. Integration of the memoized values held in StAnnTx had previously been done for Babbage onward, and this cycle it was extended to Alonzo, which needed special handling, along with a small follow-up removing an unnecessary EncCBOR instance for AlonzoStAnnTx. We also finished the long-running effort to remove the legacy Coders machinery: the final piece for protocol version 12 and up (dropping the Summands usage) landed, Coders was removed from the testlibs and tests, and StakePoolParams was switched from CBORGroup-derived encoding to manual EncCBOR/DecCBOR instances in preparation for dynamic CBOR list lengths.

A notable new front is Leios support beginning to land in the ledger. The LeiosCert type, defined in the new cardano-crypto-leios package on the cardano-base repository, was added as an optional field to DijkstraBlockBody, and the Dijkstra CDDL for header_body was updated to reflect what the Leios prototype should be producing. We also introduced a new cardano-protocol package to house protocol-level code. On the ledger rules themselves there was a round of structural cleanup: a new ENTITIES rule (with an equivalent subrule) was introduced between LEDGER and CERTS to handle withdrawals and direct deposits, the era prefix was dropped from rule names, and the Rewarding script purpose was renamed to the more accurate Withdrawing.

The Dijkstra era work continued on several smaller fronts, including requiring top-level guards in the top-level transaction body, adjusting the Conway transaction_witness_set CDDL rule to use non-empty lists for the relevant fields. Conformance testing for Dijkstra advanced to its third installment, this time adding SpecTranslate instances for Dijkstra types and ExecSpecRule instances for the LEDGER and NEWEPOCH rules. Two user-visible bugs were fixed: injected extraConfig cost models were being ignored for PlutusV1/V3 because of an argument-ordering issue in overrideCostModels, and TxInfo translation could fail spuriously in LegacyMode. We also added ToJSON/FromJSON instances for EraScript and native scripts.

On the tooling and infrastructure side the generate-cbor CLI tool added last cycle was moved into cardano-ledger-api, refactor of the singleton-key namespaces (committee and constitution) for Canonical Ledger State, new Conway UTxO and Script generators were added, and CI was updated to allow automated agents to invoke the /update-changelogs skill. The dependency stack was moved forward with updates to cardano-crypto-class-2.5, the haskellNix flake input, and the usual GitHub Actions bumps.

Low level summary​

Features​

  • PR-5837 - Remove unnecessary re-exports from Shelley Rules
  • PR-5859 - Remove era prefix from rule names
  • PR-5748 - Refactor namespaces with singleton keys
  • PR-5867 - Prevent TxInfo translation failure for LegacyMode
  • PR-5866 - Rename Rewarding to Withdrawing
  • PR-5845 - Add ToJSON/FromJSON instances for EraScript
  • PR-5860 - Stop using Summands from Coders for PV12+
  • PR-5857 - Further StAnnTx integration
  • PR-5872 - Add LeiosCert to DijkstraBlockBody
  • PR-5897 - Remove unnecessary EncCBOR instance for AlonzoStAnnTx
  • PR-5899 - Fix injected extraConfig cost models being ignored for PlutusV1/V3
  • PR-5878 - Entities and Subentities Rules
  • PR-5889 - Fix Dijkstra CDDL for Leios changes to header_body
  • PR-5887 - Create cardano-protocol package
  • PR-5903 - Require top-level guards in top-level transaction body
  • PR-5908 - Use non-empty list for fields without duplicate enforcement in Conway transaction_witness_set cddl rule
  • PR-5890 - Replace CBORGroup-derived EncCBOR/DecCBOR for StakePoolParams with manual instances

Testing​

  • PR-5844 - Prepare conformance for Dijkstra 3
  • PR-5868 - Add Test.Cardano.Ledger.Conway.Gen.{UTxO,Script} modules.
  • PR-5883 - Add isPotentialFutureMember ImpTest

Infrastructure and releasing​

  • PR-5864 - Move generate-cbor to cardano-ledger-api
  • PR-5870 - Update to cardano-crypto-class-2.5
  • PR-5876 - Bump actions/checkout from 6 to 7 in the actions group
  • PR-5877 - Allow agents to invoke /update-changelogs
  • PR-5865 - Remove Coders from testlibs and tests
  • PR-5884 - Bump actions/cache from 5 to 6 in the actions group
  • PR-5894 - Update haskellNix flake input