Skip to main content

56 posts tagged with "ledger"

View All Tags

· 2 min read
Kevin Hammond

Incident reporting: Cardano block production temporary outage

On Sunday, January 22, 2023, an incident occurred resulting in block production pausing for a brief period of time (approximately two minutes, similar to the usual pause at an epoch boundary). Around 50% of block-producing nodes and relays restarted during this period. Having restarted, nodes continued to produce blocks without failure. While the network continued to operate, the issue did have the potential to affect network integrity, so was flagged as a ‘critical’ incident, thus warranting immediate response and investigation by IOG engineers. The investigation (with SPO & Cardano Foundation collaboration) quickly revealed the cause of the issue – a complex bug in data structure handling code related to the precise order of insertion/deletion of multi-asset tokens into the internal ledger record. Input Output Global (IOG) engineers, along with SPOs and DApp developers, collectively identified how to reproduce the issue as a unit test that could be included in the standard Cardano node test suite. Following successful testing, this led to a bug fix being implemented, tested, benchmarked, and deployed as a hotfix in the node v.1.35.5 release on Friday, January 27, 2023. Care was taken not to highlight the exact cause of the bug during this process so that it could not be exploited prior to SPOs deploying this new node version. With the fix deployed, the Cardano SPO and developer community have not seen any further instances of this issue.

Further Details

You can read more details on the incident and how it was managed from SundaeSwap’s Pi Lanningham here. Thanks again to all the community for its support in identifying and fixing this bug.

· 2 min read
Jared Corduan

High level summary

We are still heavily involved in work related to preparing the next release. The other main thing we have worked on is experimentation about how we will handle the DRep stake distribution for CIP-1694 in the conway ledger era. Lastly, we merged a fix for node-4826 into our main branch (there will be a post-mortem shortly).

Low level summary

Support for the next release

  • pull-3363 - Fix problems relating to Arbitrary instances used by consensus.
  • pull-3361 - Remove the alonze genesis from the conway genesis.
  • pull-3360 - Translate bad pointer addresses to valid ones in conway.
  • pull-3357 - Fix a bug relating to zero valued ADA in the script context.
  • pull-3356 - Added needed instances (Arbitrary and Serialization) for conway integration.
  • pull-3345 - Added helper functions for the CLI.
  • pull-3342 - Fix a bug with a CLI helper function (having to do with deposit tracking).

Experiments for DRep stake distribution

Adding another stake distribution to the ledger state presents some new challenges. We would like to be able to use the current stake distribution at the epoch boundary for DRep voting so that people can always vote themselves in time for any proposal. To this end, we have a prototype of an incremental computation based on the incremental lambda calculus, together with tests and benchmarks (which are very promising). See pull-3344.

Additionally, more of the ledger state is going to need to be rearranged to accomodate the new incremental computations. We have two draft PRs up for possibles solution. See pull-3353 and pull-3364.

Technical debt and bug fixes

Documentation changes

  • pull-3354 - Rename "optional datums" with "supplemental datums" in the alonzo spec.
  • pull-3352 - Add a section to the Shelly errata about the individual deposit tracking.
  • pull-3351 - Further clarify the details regarding the script integrity hash.
  • pull-3350 - Some cleanup of the Babbage spec.

· 2 min read
Jared Corduan

High level summary

We made further progress on the conway ledger era. In particular, we expanded the ledger API significantly, including lots of governance features. We also made progress on the specification and corresponding work in the Haskell implementation.

We also continued to integrate the latest ledger packages into cardano node and addressed technical debt.

Low level summary

Expanded ledger API

The ledger API was significantly expanded to include:

  • a lot of protocol parameter support
  • versioning support (type level ledger eras and protocol versions)
  • auxiliary data support
  • many new lenses
  • support for witnesses
  • support for conway governance

See pull-3328.

Conway ledger rules

We have made progress on the formal ledger specification for the Conway era. Moreover, the corresponding Haskell updates were also completed:

Incremental SPO/DRep stake distribution computation

We have a working (and correct) proof of concept for how to use the incremental lambda calculus to maintain several of the stake distributions incrementally. For the per-SPO distribution, this is a performance improvement. For the (conway) per-DRep distribution, this is will allow those who have delegated their votes to a DRep to have time to react to any votes that they disapprove of. (Sorry, no code to share just yet, more to come.)

Technical debt

· 2 min read
Jared Corduan

High level summary

We have focused the last two weeks on CIP-1694, integration of the last several months of ledger work into consensus and node, and testing infrastrutcture that we will use in the conway ledger era.

Low level summary

Conway rules

We made a major update to the conway era so that the implementation is now in sync with the spec with respect to the ratification and enactment logic.

See the notes in pull-3291 for more details.

Constraint based generators

This week we hit a major milestone in our efforts to build out better property based testing support for the main ledger properties. The new constraint based generators can now generate full ledger states with what is probably very close to the real constraints (if anything, it is under constrained). Next we will work on generating a transaction in the context of a ledger state, which would allow us to actually start using these generators for real tests.

See pull-3219.

Preparing a release, now with proper versioning

After quite some time, we are ready to release a version of ledger that will work with a new version of consensus, using CHaPs.

See pull-3308.

Technical debt

  • We cleaned up the redeemer serialization code (to prevent future mistakes). See pull-3269.
  • We added a note to the Alonzo spec, specifying that the transaction inputs are lexicographically ordered in the Plutus script context. See pull-3306.
  • We fixed a problem with the address deserialiazation (we mistakenly fixed a bug in the Babbage era which cannot be fixed until Conway). See pull-3307.
  • We fixed a problem with our nix build. See pull-3311.
  • We fixed a problem with our NoThunks tests. See pull-3310.
  • We improved our nightly tests. See pull-3316.

· 3 min read
Jared Corduan

High level summary

This past two weeks saw many months worth of ledger changes integrated with the cardano-base and ouroboros-network repositories. The vast majority of the effort involved all the changes to the ledger serialization libraries (and the interplay with cardano-base) which now support proper versioning. Supporting the conway ledger era, and in particular allowing the ledger state to transition to a whole new system of governance, also played a noticeable part in the integration.

Besides the integration work, the team continues to address technical debt, improve the documentation, make our testing infrastructure better (such as experimenting with better nightly tests), and formally specifying more parts of CIP-1694.

Lower level summary

Integration work

Below is all the integration work completed, which will enable a release to node from the current ledger master. Many thanks to Alexey for this colossal undertaking!

Technical debt

Starting in major protocol version 9, zero-valued multi-assets will no longer be permitted in the CBOR specification. See pull-3241.

We now have our .cabal files being checked for a consistent formatting given by cabal format in our CI. See pull-3286.

We are still experimenting with better nightly tests for our long running property based tests. See pull-3276 and pull-3296.

Small documentation improvements

The hand proofs of the preservation ADA property have been added back to the Shelley ledger specification. See pull-3295.

We have clarified how the script integrity hash is computed in the CDDL description. See pull-3290.

Specifying CIP-1694

Our new formal specifications backed by Agda have seen a lot of progress! Upgrading to Agda 2.6.3 fixed our main build infrastructure problems, and we no longer have to rely on our custom fork. See pull-50.

Our progress on formally specifying CIP-1694 can be followed here:

Constraint based testing

We are still actively working on our new constraint based property testing framework. We have nearly all of the constraints for an entire ledger state hooked into generators, and tests that the generators do indeed obey the constraints. The variable count in the constraints is over 100! There is still much work to do on shrinking, making the generators faster, and writing actual property tests for the ledger, but the approach still seems viable and we are hopeful that it could replace our trace generators. The WIP can be followed here: pull-3219.