Skip to main content

58 posts tagged with "ledger"

View All Tags

· 6 min read
Kevin Hammond

High level summary

We have undertaken an initial high-level security analysis of the CIP-1694 design. We summarise the analysis and our responses here.

Initial CIP-1694 Security Analysis and Responses

Section: The constitutional committee


  • “For example, if we consider the hypothetical Constitution rule "The Cardano network must always be able to produce new blocks" - In this example, if the governance action to reduce block size to 0 is passed, then there will be no way of passing or enacting further proposals. That is, this governance action is completely non-reversable. Suggestion: Instating a built-in mechanism that checks (and perhaps enforces) that the proposed governance actions, if passed, can be reverted in the future.

There is a 'guardrails document' in preparation which captures issues such as these. Some of them may be automatable, as suggested; others will need to be evaluated by humans.


Section: Size of the constitutional committee


  • A possible issue with very large committee sizes (or large number of proposals/voters in general) is that it may take longer to have votes appear on-chain, which in extreme cases may require longer voting periods.

Thanks. Yes, we’ve been thinking about this issue for a long time, see for example the section ‘Final safety measure, post bootstrapping’. We don’t consider this as an issue for the CC since they need to be elected while DReps can just register, so we expect the number of CC members to be much less than the number of DReps


Section: Terms


  • The following sentence is a bit awkward to read: “For example, a committee of size five with a threshold of 3/5 a minimum size of three and two expired members can still pass governance actions if two non-expired members vote Yes.” —> Suggestion: “For example, if we have a committee of size five with a threshold of 3/5, then a committee of three non-expired and two expired members can still pass governance actions if two non-expired members vote Yes.”

Thanks. Yes, that suggestion is a bit easier to read.


Section: Registered DReps


  • “Additionally, registered DReps will need to vote regularly to still be considered active.” - There is a minor issue with requiring “voting regularly”. That is, if there are no proposals to vote on for a long time, this means that no DRep can vote regularly (or they have to issue bogus proposals just to vote on them).

Thanks. We’ve added a mechanism to prevent that issue in the spec/code where if there’s nothing to vote on for an entire epoch, we increment the epoch that each DRep expires.


Section: Ratification


  • It is a bit unclear why protocol changes: network group and technical group are two separate groups.

These correspond exactly to the groups that are administered by the Parameter Committee.


  • I didn’t understand the rationale for requiring 100% “Yes” votes to pass “Info” type governance actions? It seems they have the least potential to harm the system.

Yes, it’s not about harming the system, since Info actions have no direct effect on the operation of Cardano. The motivation is simply to record the actual level of support for the action.

Once an action is enacted it’s no longer possible to vote on it. So if there was e.g. a threshold of 50%, then there is no way of telling whether the support for it might eventually have reached 90% or higher if it was not immediately enacted when the threshold was reached.


Section: Content


  • For Hard-fork initiation, the changed parameters should probably also be required as part of Additional data.

Protocol parameters can be changed in arbitrary ways by the hard fork and new ones might be introduced, so anything this action pins down might not actually be the value that will be present after the hard fork.


Section: Protocol Parameter groups


  • It is a bit unclear to the reader what some of these parameters mean, for example: monetary expansion (rho) and treasury expansion (tau). Suggestion: Include brief explanations for the non-obvious parameters.

These are existing protocol parameters, described in e.g. https://cips.cardano.org/cips/cip9/9 or The Cardano Protocol Parameters Guide.


  • With the current set of governance actions, it seems that it is not possible to add new types of protocol parameters, or categories of governance voting thresholds. Suggestion: Consider possibility of incorporating governance actions that allow addition of new protocol parameters, deletion of defunct protocol parameters, or modification of governance voting threshold categories.

All of this needs to be done via a hard fork. If we had an action that added a parameter then there is no way of giving it semantics anyway, since that must be done by logic in the code.


Section: Votes


  • Is a constitutional committee member also a DRep? If so, do they vote twice, once as a committee member and once as a DRep?

They may or may not be (and they could also be an SPO). Note that this is fine, since these are completely separate tallies. This is also not preventable, since we don’t have an on-chain mechanism for identity. And yes, each credential gets to vote on each action for all roles in the governance system it has.


Section: Separation of Hard Fork Initiation from Standard Protocol Parameter Changes


  • It is unclear whether there would be automated checks for whether a proposal is indeed a soft fork or hard fork, which would reduce human error in categorising proposals.

There is no on-chain mechanism that could enforce this, the best we could do is some kind of certificate. However, this may not be trustworthy, of course. We will consider this in future versions of Voltaire.


Section: Changes post Edinburgh workshop (July 2023)


  • “All governance actions are enacted one epoch after they are ratified.” - I’m not sure if this line is currently in the main body of the CIP?

It is, but it is phrased differently: ‘All governance actions are enacted on the epoch boundary after their ratification.’


Section: Reduced deposits for some government actions


  • Another downside of requiring endorsement from the constitutional committee is that this likely does not apply to constitutional committee-related proposals, such as no-confidence votes.

Indeed. We have no plans for this at the moment.

· 3 min read
Alexey Kuleshevich

High level summary

This update contains mostly improvements to quality of Conway era implementation and tooling that we use for testing Ledger. Major Conway bugs that were discovered and squashed are:

  • PParamsUpdate proposals will now correctly use DRep thresholds for ratification
  • Treasury withdrawals are now properly enacted.
  • Corrected snapshotting and DRep Stake Distribution Pulser initialization
  • Delegation to non-existent Stake pool is no longer possible

Other important quality of life improvements are addition of reusable interfaces for an ordered set OSet and ordered map OMap. Which allowed us to disable duplicate certificates and proposals in a transaction. As a precursor to PlutusV3 integration, a serious reorganization of Plutus related functionality was performed.

Conway related additions that are noteworthy: Conway Ledger events, disallowing voting on expired proposals, addition of Anchor to Constitutional Committee resignation proposals.

Significant improvements have been made to a specialized "Imp" test library that allows us writing concise stateful unit tests for verifying the Ledger logic. Serious progress has been made on the conformance testing, where we can now interface with Haskell generated code from the Agda specification. Serialization testing has been extended to increase binary conformance coverage.

Low level summary

Conway

  • pull-3808 - Enhance CommitteeMembersState query to return quorum and NoConfidence
  • pull-3801 - Fix epoch rule and tests
  • pull-3803 - Fix delegation validation
  • pull-3759 - Reshuffle things to the DRepPulser incorporates some snap shot things
  • pull-3779 - Prevent duplicate certs and proposals
  • pull-3794 - Added anchor to resign certs
  • pull-3797 - Cleanup JSON instances for Conway governance
  • pull-3848 - Plutus modules restructure
  • pull-3840 - Fix anomalies in Deposits in the Conway Era
  • pull-3856 - Add governance related ledger events
  • pull-3825 - Prevent voting on expired GovActions
  • pull-3831 - Treasury withdrawal fix
  • pull-3791 - Use a Data.OMap.Strict to replace ProposalsSnapshot
  • pull-3836 - PParamsUpdate enactment fix
  • pull-3846 - Revert argument order swap.

Testing

  • pull-3782 - Move ImpTest to Shelley testlib
  • pull-3842 - Imp improvements
  • pull-3844 - Add mappings to Agda types
  • pull-3853 - Fix strange assertion failure, which hides real Block too big problem.
  • pull-3809 - CDDL roundtrip testing
  • pull-3832 - Treasury withdrawals tests
  • pull-3839 - Added cardano-ledger-conformance
  • pull-3841 - Add sha256 to cardano-ledger-executable-spec

Improvements and releasing

  • pull-3843 - Add ...WithLogs versions of evalScripts and friends
  • pull-3795 - Bump plutus to 1.15
  • pull-3798 - Bump urllib3 from 1.26.17 to 1.26.18 in /doc
  • pull-3799 - Changes needed for 8.6 release
  • pull-3807 - Add invalidBeforeL and invalidHereAfterL functions
  • pull-3819 - Fixups needed for a release
  • pull-3829 - Post release CHANGELOG version bumps
  • pull-3830 - Bump aeson to 2.2
  • pull-3833 - Backport release cardano-ledger-conway-1.10.1.0
  • pull-3828 - Add changelog for node release 8.6

· One min read
Alexey Kuleshevich

High level summary

The Ledger team has been shifting focus from implementing Conway related features to testing. For this reason there is a very little amount features that are reported this time aorund. Notable Conway related changes are a specialized ledger query for getting Constitutional Committee state and prevention of submitting proposal procedures that have no valid path to enactment.

Testing related work was mainly on a constraint base system as well as on roundtrip serialization. As a result of this extra testing a bug in Conway Genesis serialization was eliminated.

Low level summary

Conway era

Integration and releasing

Testing

  • pull-3769 - Add roundtrip testing by validating FlatTerm
  • pull-3783 - Update TranslationInstance.hs
  • pull-3775 - Refactor and improve constraint based STS tests
  • pull-3793 - Fix sums with negative RHS.

· 3 min read
Alexey Kuleshevich

High level summary

Few important Conway related features were completed in this two week period:

  • Constitutional Committee was the last missing Conway related entity that has now been fully implemented.
  • Treasury withdrawals governance actions have been fixed and now behave as expected.
  • Current treasury amount supplied in the transaction is now enforced by the rules.
  • DRep's expiry is prevented by delaying the expiry for all DReps whenever there are no proposals to vote on.
  • Semantics of how CostModels are updated with Protocol Parameters have been changed to allow for individual Plutus language version updates, rather than requiring a complete replacement of all CostModels

Besides the new features there were also important performance and testing improvements:

  • In particular stake distribution computation and native script handling received some optimizations.
  • New testing DSL has been implemented that drastically simplifies writing unit tests for ledger rules.
  • Integration tests and benchmarks are now possible for Conway era because of the overhaul of functionality for initial funds and staking injection whenever node starts up in Conway, while bypassing all previous eras.

Low level summary

Conway era

  • pull-3729 - DRep expiry update after a contiguous set of epochs with no proposals to vote on
  • pull-3739 - Rename some PParams to be consistent with Agda specification
  • pull-3743 - Move DRepDistr from VState to ConwayGovState
  • pull-3746 - Implement tcTranslationContextL for Shelley
  • pull-3737 - Implement EraTransition
  • pull-3749 - Add predicate failure: current treasury value mismatch in LEDGER
  • pull-3748 - Apply enacted treasury withdrawals
  • pull-3745 - Constitutional Committee Ratification
  • pull-3763 - Plutus interface improvements
  • pull-3771 - Changed how costmodel updates are applied
  • pull-3766 - Prevent updating protocol version with PParamUpdate

Performance

  • pull-3765 - Improve native script handling
  • pull-3747 - Use (CompactForm Coin) in IncrementalStake, DRepDistr (and other places) instead of Coin
  • pull-3758 - Cardano-Perf regression: UMap.size regression fix
  • pull-3754 - Use Alonzo-style TxOut encoder when possible

Releasing

  • pull-3742 - Update fourmolu, ghcid and hls. Update haskellNix and iohkNix flakes
  • pull-3744 - Changelog 8.4
  • pull-3752 - Patch release of cardano ledger conway 1.8.1.0
  • pull-3753 - Minor cleanup and changelog entries
  • pull-3760 - Fixup issues for release
  • pull-3764 - Bump plutus deps to 1.13

Testing

  • pull-3734 - Removed Shaped instance for Rep
  • pull-3735 - Simplify the implementations of hasOrd and hasEq
  • pull-3728 - STS tests based on constraints
  • pull-3714 - Implement the remaining upgradable families
  • pull-3733 - Add some unit tests for Conway features
  • pull-3762 - Update CDDL for praos headers.

· 2 min read
Alexey Kuleshevich

High level summary

The Ledger team's focus is still mainly on the Conway era implementation.

We were able to add ability to specify initial Constitutional Comittee and the initial version of Constitution. Priority in which Governance Action are now enacted matches the specification. DRep's deposits are now properly accounted for. Governance actions that are not allowed to be voted on by Stake Pool operators and Constitutional Committee members are prevented by transaction submission failure, rather than simply being ignored. There was a few important CDDL fixes as well as a lot of new round trip serialization tests. Constraint based testing framework has also received a lot of improvements.

Low level summary

Conway era

  • pull-3681 - Conway Genesis additions
  • pull-3690 - Preserve the order of ProposalProcedures
  • pull-3705 - Removed ProtVer from EnactState
  • pull-3700 - Add conway-specific certs to deposit/refunds
  • pull-3704 - Add comments on deprecating certs to Conway CDDL
  • pull-3698 - Reordering of governance actions
  • pull-3712 - Disallow empty fields in ConwayTxBodyRaw
  • pull-3716 - Abstract threshold calculation
  • pull-3725 - Fix mistaken use of dollar sign in cddl files
  • pull-3718 - Predicate failure for mismatched Voter GovAction
  • pull-3721 - Committee expiration, validation and modification

Improvements and releasing

Testing

  • pull-3730 - Implement Show instance for Rep using IsTypeable
  • pull-3697 - Rewrite testEql using Typeable to make it impossible to forget cases
  • pull-3709 - Add many new features to the Constrained modues in cardano-ledger-test
  • pull-3726 - Conway and other eras serialization roundtrip tests
  • pull-3713 - Improve CI resiliency against GitHub issues