Skip to main content

90 posts tagged with "ledger"

View All Tags

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

Ledger Team Update

· 4 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary

The most visible result of the past two weeks is that the Plutus context performance arc has reached its first real payoff. Two cycles ago we memoized the Plutus related parts of transaction validation, last cycle we threaded the state-annotated transaction StAnnTx through the LEDGER, UTXOW, UTXO and MEMPOOL rules across every era, and this cycle the rules actually start consuming the precomputed information stored in StAnnTx instead of recomputing it. In parallel we kicked off a sizeable effort to remove the legacy Coders machinery from the codebase: several call sites have been switched off Coders, a new SparseKeyed alternative has been introduced, and decodeSparseKeyed was extended to cover additional types. This is part of a broader cleanup that is expected to continue for several more cycles.

On the Dijkstra era CDDL front the work begun with the new block_body definition continued: we introduced a dedicated transaction_mempool rule so that the transaction decoder used in the mempool can be distinguished from the one used inside the block body, tightened the chain_code specification to 32 bytes, and landed a thorough pass of fixes to the Dijkstra CddlSpec so that all of the CDDL tests pass. We also pushed forward the second installment of conformance testing preparation for Dijkstra, this time adding an era type parameter to SpecTranslate and SpecTransM, instantiating it for the Conway modules, and updating the formal-ledger-specifications dependency accordingly.

The namespace work for the canonical ledger state initiative also continued, with a new entities/accounts/v0 namespace and a refactor of gov/proposals/v0 that preserves the proposals order, which is required to reconstruct ledger state faithfully.

On the benchmarking and tooling side we added two new criterion microbenchmarks for the TICK and NEWEPOCH rules, which we expect to be a tremendously useful tool for analysing epoch transition performance. Vector-map benchmarks were also fixed and we switched some hot paths to unsafe vector indexing where bounds checking is redundant. A new generate-cbor CLI tool was added, which makes it possible to generate CBOR for any rule in any era from the command line and should be useful both for our own debugging and for downstream consumers, such as serialization libraries and alternative node implementotions. The test reorganization started last cycle continued with the CddlSpec hierarchy being inverted to give cleaner test output and the predicate failure CBOR roundtrip tests being folded into the per-era ImpSpec set, which also brought in missing tests for the BBODY, MEMPOOL and Dijkstra-specific rules. Finally on the infrastructure side, the doctesting setup that was temporarily disabled in the last cycle has been properly refactored to use cabal repl --with-repl=doctest instead of cabal-doctest, and the index-state was bumped to pull in cardano-base 0.1.4.

Low level summary

Features

  • PR-5807 - Stop using Coders in some places
  • PR-5815 - Switch to unsafe vector indexing
  • PR-5804 - Use precomputed data from state-annotated transactions
  • PR-5834 - Coder's SparseKeyed alternative
  • PR-5843 - Add transaction_mempool
  • PR-5846 - Update Dijkstra chain_code
  • PR-5738 - Refactor gov/proposals/v0 namespace to include the proposals order
  • PR-5699 - Add entities/accounts/v0 namespace
  • PR-5847 - decodeSparseKeyed for more types

Testing

  • PR-5810 - Add examplePParams[Update] to EraTest for goldens.
  • PR-5814 - Add TICK and NEWEPOCH benchmarks
  • PR-5841 - Invert CddlSpec hierarchy
  • PR-5830 - Prepare conformance for Dijkstra 2
  • PR-5851 - Organize predicate failure CBOR roundtrip tests
  • PR-5779 - Fix various issues in Dijkstra CddlSpec to make all the tests pass

Infrastructure and releasing

Ledger Team Update

· 6 min read
Alexey Kuleshevich
Ledger Team Software Engineer

High level summary

  • CIP-118 - Nested Transactions:

    Over the past two weeks the Ledger team has continued to push the Dijkstra era forward on multiple fronts. The CDDL specification of block was updated to match CIP-0176 - Non-segregated Block Body Serialization, a dedicated block_body was added and an EncCBORGroup instance for DijkstraBlockBody was added to unblock downstream integration in Consensus. Serialization for DijkstraTx was fixed up as well. We also followed up on the Plutus context performance work introduced in the previous update by integrating StAnnTx (the state annotated transaction representation that memoizes the Plutus parts of validation) into the LEDGER, UTXOW, UTXO and MEMPOOL rules across every era. With this integration the performance benefits of the earlier memoization work are now realized end to end. Further work in this area will let us rip the benefits of this optimization upon block construction as well, not just during initial validation. On top of that, several guards were added to the Plutus V1-V3 context translation so that any of the new Dijkstra features that those older language versions cannot represent (subtransactions, direct deposits, balance intervals, etc.) cause translation to fail explicitly rather than silently producing a wrong context. We also did preparation work for running conformance tests in Dijkstra and started reorganizing the test hierarchy around a new class-based ImpSpec approach that enforces a common set of tests across all eras.

  • LedgerHD

    The streaming infrastructure for injecting large amounts of data from genesis files, which was started in the previous cycle, has been completed. It now covers stake pools and the remaining state needed for the testing and benchmarking work that targets reading data in constant memory from disk and paves the way for further direct injection into on-disk ledger state.

  • CIP-165 - Canonical Ledger State:

    The expansion of the Canonical Ledger State continued with two more namespaces being added under the new namespace-based query interface, entities/dreps/v0 and entities/stake_pools/vrf_key_hashes/v0.

  • Maintenance

    We've expanded examples and added golden tests for all of the migrated queries from Consensus to Ledger done last cycle. Furthermore we did the same for transaction examples. All of this effort not only will let us remove golden tests unrelated to the Consensus component from the ouroboros-consensus repository, but also improve their quality.

    In addition to features we published the changelog for the recent cardano-node-11.0 release, made ZeroTreasuryWithdrawals a permanent governance check for every era starting with Conway, instead of not having it in the bootstrap phase. We switched ChainData and Attributes to use ByteArray instead of ByteString to avoid pinned-memory fragmentation. A few NoThunks instances were tightened up where consensus needs them for storing on disk and relaxed where the values are already forced to normal form. Finally, we fixed a cuddle failure on Plutus Constr data and a bug in its definition in the CDDL spec discovered by our new generator-based tooling.

Low level summary

Features

  • PR-5787 - Remove redundant import
  • PR-5785 - Relax header protocol version for testnets
  • PR-5786 - Changelog for cardano-node-11.0
  • PR-5733 - Dijkstra era CDDL for block, add block_body
  • PR-5789 - Integrate StAnnTx in rules across all eras
  • PR-5777 - Full support of data injection from genesis files using streaming
  • PR-5793 - Change DijkstraTx decoder to support variable length encoding
  • PR-5669 - Fail PlutusV1-V3 translation for non-empty subTransactionsTxBody
  • PR-5797 - Make ZeroTreasuryWithdrawals a permanent check in gov state transation rule
  • PR-5700 - Add entities/dreps/v0 namespace
  • PR-5808 - Relax NoThunks instance for BlockTransitionError
  • PR-5781 - Fail Plutus V1-V3 translation with guards
  • PR-5813 - Implement EncCBORGroup instance for DijkstraBlockBody
  • PR-5812 - Switch ChainData and Attributes to use ByteArray
  • PR-5811 - Fix TranslateErainstance for DijkstraEra CertState
  • PR-5743 - Add entities/stake_pools/vrf_key_hashes/v0 namespace
  • PR-5823 - Add NoThunks instances for ChainTransitionError and ChainPredicateFailure
  • PR-5816 - Import Rules as qualified
  • PR-5799 - Add example transaction golden test for each era

Testing

  • PR-5778 - Add golden tests for queryConstitution
  • PR-5761 - Expand upon transaction examples by adding missing fields.
  • PR-5794 - Add golden tests for the rest of the query result types
  • PR-5801 - Fix failing cuddle test for Plutus data Constr.
  • PR-5775 - Preparation for conformance testing in Dijkstra
  • PR-5803 - Start to re-organize test hierarchy: ImpSpec
  • PR-5826 - Fix trace construction in TestChain

Infrastructure and releasing

  • PR-5790 - Bump slackapi/slack-github-action from 3.0.2 to 3.0.3 in the actions group
  • PR-5796 - Disable doctest to unblock master
  • PR-5806 - Bump cuddle to 1.7.0.0
  • PR-5817 - Bump urllib3 from 2.6.3 to 2.7.0 in /doc
  • PR-5822 - Remove weird hyperlinked space between badges
  • PR-5758 - Refactor testing in GitHub CI