cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Protocol.Parameters.Update

Description

Sparse typed changes to protocol parameters. Nothing leaves a field unchanged. For nullable leverage and bootstrap round, Just Nothing explicitly removes the bound or round. The original imported encoding is available separately from fresh serialization, which may normalize representation.

import qualified Cometa.Protocol.Parameters.Update as Update

change :: Update.Update
change = Update.empty { Update.updateMinFeeB = Just 155381 }
Synopsis

Documentation

data Update Source #

Independent optional changes. All constituent values are validated once; constructing or applying a change is pure and cannot fail. Construction does not validate activation or governance rules of a particular ledger era.

Constructors

Update 

Fields

Instances

Instances details
Show Update Source # 
Instance details

Defined in Cometa.Protocol.Parameters.Update

Eq Update Source # 
Instance details

Defined in Cometa.Protocol.Parameters.Update

Methods

(==) :: Update -> Update -> Bool #

(/=) :: Update -> Update -> Bool #

empty :: Update Source #

The empty change. Applying it preserves every parameter field.

apply :: Update -> Parameters -> Parameters Source #

Apply all present fields to a complete snapshot, preserving absent fields.

fromParameters :: Parameters -> Update Source #

Produce a change setting each available field, including explicit nulls. Unavailable fields are omitted.

data EncodedUpdate Source #

A validated update with its exact original CBOR bytes. Equality and ordering compare those bytes, so alternative encodings of the same change can differ.

encodeCbor :: Update -> ByteString Source #

Serialize present fields in ascending parameter-key order, using definite collections and minimal integer encodings. Rational pairs remain exact; imported representation is preserved only by toCbor.

decodeCbor :: ByteString -> Either Error EncodedUpdate Source #

Decode one complete update, retaining exact bytes. Unknown or duplicate parameter keys, invalid field bounds/arity, malformed CBOR and trailing input return InvalidProtocolParametersCbor. Historical fields are accepted without applying era-specific governance validity rules.

toCbor :: EncodedUpdate -> ByteString Source #

Return the exact validated input encoding.

toUpdate :: EncodedUpdate -> Update Source #

Inspect the Haskell-owned change without altering its original encoding.

toPlutusData :: Update -> IO (Either Error PlutusData) Source #

Encode changed parameters for a Plutus governance script. The result is a map keyed by parameter identifiers; absent fields are omitted. Rational values are reduced fractions represented as numerator/denominator lists. Historical decentralization, entropy and protocol-version changes are excluded. This is script data, distinct from protocol-update CBOR, and does not validate whether the changes are permitted in a particular ledger era. Conversion failures return NativeError.