Skip to main content

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