Documentation
¶
Index ¶
- Constants
- Variables
- func BuildEraParams(cfg *cardano.CardanoNodeConfig, era EraDesc) (hardfork.EraParams, error)
- func BuildShape(cfg *cardano.CardanoNodeConfig) (hardfork.Shape, error)
- func BuildShapeForEras(cfg *cardano.CardanoNodeConfig, eraList []EraDesc) (hardfork.Shape, error)
- func BuildShapeWithDijkstra(cfg *cardano.CardanoNodeConfig, enableDijkstra bool) (hardfork.Shape, error)
- func CalculateConwayMinFee(txSize uint64, exUnits lcommon.ExUnits, minFeeA uint, minFeeB uint, ...) uint64
- func CalculateConwayRefScriptFee(refScriptSize uint64, costPerByte *big.Rat) uint64
- func CalculateEtaVAllegra(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVAlonzo(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVBabbage(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVConway(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVDijkstra(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVMary(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateEtaVShelley(nodeConfig *cardano.CardanoNodeConfig, prevBlockNonce []byte, ...) ([]byte, error)
- func CalculateMinFee(txSize uint64, exUnits lcommon.ExUnits, minFeeA uint, minFeeB uint, ...) uint64
- func CertDepositAllegra(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositAlonzo(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositBabbage(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositConway(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositDijkstra(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositMary(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CertDepositShelley(cert lcommon.Certificate, pp lcommon.ProtocolParameters) (uint64, error)
- func CloneGovernanceProtocolParameters(pparams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func DeclaredExUnits(tx lcommon.Transaction) (lcommon.ExUnits, error)
- func DecodePParamsAllegra(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsAlonzo(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsBabbage(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsConway(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsDijkstra(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsMary(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsShelley(data []byte) (lcommon.ProtocolParameters, error)
- func DecodePParamsUpdateAllegra(data []byte) (any, error)
- func DecodePParamsUpdateAlonzo(data []byte) (any, error)
- func DecodePParamsUpdateBabbage(data []byte) (any, error)
- func DecodePParamsUpdateConway(data []byte) (any, error)
- func DecodePParamsUpdateDijkstra(data []byte) (any, error)
- func DecodePParamsUpdateMary(data []byte) (any, error)
- func DecodePParamsUpdateShelley(data []byte) (any, error)
- func EpochLengthByron(nodeConfig *cardano.CardanoNodeConfig) (uint, uint, error)
- func EpochLengthShelley(nodeConfig *cardano.CardanoNodeConfig) (uint, uint, error)
- func EvaluateTxAlonzo(tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
- func EvaluateTxBabbage(tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
- func EvaluateTxConway(tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
- func EvaluateTxDijkstra(tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
- func HardForkAllegra(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkAlonzo(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkBabbage(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkConway(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkDijkstra(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkMary(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func HardForkShelley(nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
- func IsCompatibleEra(txEraId, ledgerEraId uint) bool
- func IsCompatibleEraIn(eraList []EraDesc, txEraId, ledgerEraId uint) bool
- func IsValidEraAdvancement(currentEraId, nextEraId uint) bool
- func IsValidEraAdvancementIn(eraList []EraDesc, currentEraId, nextEraId uint) bool
- func PParamsUpdateAllegra(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateAlonzo(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateBabbage(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateConway(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateDijkstra(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateMary(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func PParamsUpdateShelley(currentPParams lcommon.ProtocolParameters, pparamsUpdate any) (lcommon.ProtocolParameters, error)
- func ReferenceScriptSizeFromUtxos(utxos []lcommon.Utxo) (uint64, error)
- func ReferencedScriptSize(tx lcommon.Transaction, ls lcommon.LedgerState) (uint64, error)
- func SafeAddExUnits(a, b lcommon.ExUnits) (lcommon.ExUnits, error)
- func StabilityWindowForEra(cfg *cardano.CardanoNodeConfig, eraId uint) (uint64, error)
- func TxSizeForFee(tx lcommon.Transaction) uint64
- func ValidateOpCertCounter(stored uint64, found bool, candidate uint64, enforceNoGap bool) error
- func ValidateOpCertPersistableCounter(candidate uint64) error
- func ValidateTxAllegra(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxAlonzo(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxBabbage(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxByron(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxConway(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxDijkstra(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxExUnits(totalExUnits lcommon.ExUnits, maxTxExUnits lcommon.ExUnits) error
- func ValidateTxFee(tx lcommon.Transaction, minFeeA uint, minFeeB uint, pricesMem *big.Rat, ...) error
- func ValidateTxFeeConway(tx lcommon.Transaction, ls lcommon.LedgerState, ...) error
- func ValidateTxMary(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxPlutusConway(tx lcommon.Transaction, _ uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxShelley(tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, ...) error
- func ValidateTxSize(tx lcommon.Transaction, maxTxSize uint) error
- type BadInputsByronError
- type ByronProtocolMagicProvider
- type ByronProtocolParameters
- func (p *ByronProtocolParameters) ApplyUpdate(mod byron.ByronUpdateProposalBlockVersionMod) (*ByronProtocolParameters, error)
- func (p *ByronProtocolParameters) Clone() *ByronProtocolParameters
- func (p *ByronProtocolParameters) Equal(other *ByronProtocolParameters) bool
- func (p *ByronProtocolParameters) MinFee(size uint64) (*big.Int, error)
- func (p *ByronProtocolParameters) UpdateAdoptionThreshold(numGenKeys int) int
- func (p *ByronProtocolParameters) Utxorpc() (*cardano.PParams, error)
- type ByronProtocolParametersProvider
- type ByronSoftforkRule
- type CommitteeCredentialState
- type CommitteeMemberAlreadyResignedError
- type EraDesc
- type FeeTooLowByronError
- type InputSetEmptyByronError
- type InsufficientForInstantaneousRewardsError
- type InsufficientForTransferError
- type LovelaceBoundByronError
- type MIRCertificateTooLateError
- type MIRCredentialKey
- type MIRDelegState
- type MIRDelegStateProvider
- type MIRProducesNegativeUpdateError
- type MIRTransferNotCurrentlyAllowedError
- type MinPoolMarginProvider
- type NetworkMagicMismatchByronError
- type OutputNegativeByronError
- type OutputNotPositiveByronErrordeprecated
- type OutputSetEmptyByronError
- type ParameterChangeProtocolVersionError
- type PlutusEvalContextCache
- type PlutusEvalContextCacheProvider
- type StakeKeyAlreadyRegisteredError
- type StakeKeyNonZeroAccountBalanceError
- type StakeKeyNotRegisteredError
- type TxTooLargeByronError
- type UnknownAddressAttributesByronError
- type UnknownAttributesByronError
- type ValueNotConservedByronError
- type WitnessWrongKeyByronError
Constants ¶
const MaxPersistableOpCertCounter = uint64(math.MaxInt64)
MaxPersistableOpCertCounter is the highest operational-certificate issue number dingo can record for a pool.
The reference imposes no bound: cardano-ledger decodes the counter as Word64 (Cardano.Protocol.TPraos.OCert) and the CDDL declares it uint .size 8, so every value up to math.MaxUint64 is a well-formed counter. dingo's bound is narrower because it persists what cardano-node only holds in memory. pool_opcert_sequence.sequence and pool.latest_op_cert_sequence are signed engine integers that carry both the value and the ordering the monotonicity rule reads -- MAX(sequence) per pool, the latest_op_cert_sequence < ? guard on the denormalized maximum, and the (pool_key_hash, sequence) index GetChainDepState's aggregate is served from. A counter above math.MaxInt64 stored in those columns as two's complement would order below every smaller counter and silently invert each of those three reads.
The bound is unreachable from Babbage onward: Praos rejects a counter more than one past the last seen (CounterOverIncrementedOCERT) and a registered pool with no recorded counter has a baseline of zero (currentIssueNo), so reaching it would take 2^63 rotations. Only the TPraos eras (Shelley-Alonzo), which enforce monotonicity alone, admit an arbitrary first counter -- so this is the one place where dingo is narrower than the reference, and it says so at the boundary rather than failing part-way through block application.
Variables ¶
var AllegraEraDesc = EraDesc{ Id: allegra.EraIdAllegra, Name: allegra.EraNameAllegra, MinMajorVersion: allegra.MinProtocolVersionAllegra, MaxMajorVersion: allegra.MaxProtocolVersionAllegra, DecodePParamsFunc: DecodePParamsAllegra, DecodePParamsUpdateFunc: DecodePParamsUpdateAllegra, PParamsUpdateFunc: PParamsUpdateAllegra, HardForkFunc: HardForkAllegra, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVAllegra, CertDepositFunc: CertDepositAllegra, ValidateTxFunc: ValidateTxAllegra, }
var AlonzoEraDesc = EraDesc{ Id: alonzo.EraIdAlonzo, Name: alonzo.EraNameAlonzo, MinMajorVersion: alonzo.MinProtocolVersionAlonzo, MaxMajorVersion: alonzo.MaxProtocolVersionAlonzo, DecodePParamsFunc: DecodePParamsAlonzo, DecodePParamsUpdateFunc: DecodePParamsUpdateAlonzo, PParamsUpdateFunc: PParamsUpdateAlonzo, ParamUpdateHasPlutusV2CostModelFunc: func(u any) bool { upd, ok := u.(alonzo.AlonzoProtocolParameterUpdate) if !ok { return false } return paramUpdateHasPlutusV2CostModel(upd.CostModels) }, HardForkFunc: HardForkAlonzo, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVAlonzo, CertDepositFunc: CertDepositAlonzo, ValidateTxFunc: ValidateTxAlonzo, EvaluateTxFunc: EvaluateTxAlonzo, }
var BabbageEraDesc = EraDesc{ Id: babbage.EraIdBabbage, Name: babbage.EraNameBabbage, MinMajorVersion: babbage.MinProtocolVersionBabbage, MaxMajorVersion: babbage.MaxProtocolVersionBabbage, DecodePParamsFunc: DecodePParamsBabbage, DecodePParamsUpdateFunc: DecodePParamsUpdateBabbage, PParamsUpdateFunc: PParamsUpdateBabbage, ParamUpdateHasPlutusV2CostModelFunc: func(u any) bool { upd, ok := u.(babbage.BabbageProtocolParameterUpdate) if !ok { return false } return paramUpdateHasPlutusV2CostModel(upd.CostModels) }, HardForkFunc: HardForkBabbage, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVBabbage, CertDepositFunc: CertDepositBabbage, ValidateTxFunc: ValidateTxBabbage, EvaluateTxFunc: EvaluateTxBabbage, }
var ByronEraDesc = EraDesc{ Id: byron.EraIdByron, Name: byron.EraNameByron, MinMajorVersion: 0, MaxMajorVersion: 1, EpochLengthFunc: EpochLengthByron, ValidateTxFunc: ValidateTxByron, }
var ConwayEraDesc = EraDesc{ Id: conway.EraIdConway, Name: conway.EraNameConway, MinMajorVersion: conway.MinProtocolVersionConway, MaxMajorVersion: conway.MaxProtocolVersionConway, DecodePParamsFunc: DecodePParamsConway, DecodePParamsUpdateFunc: DecodePParamsUpdateConway, PParamsUpdateFunc: PParamsUpdateConway, ParamUpdateHasPlutusV2CostModelFunc: func(u any) bool { upd, ok := u.(conway.ConwayProtocolParameterUpdate) if !ok { return false } return paramUpdateHasPlutusV2CostModel(upd.CostModels) }, HardForkFunc: HardForkConway, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVConway, CertDepositFunc: CertDepositConway, ValidateTxFunc: ValidateTxConway, EvaluateTxFunc: EvaluateTxConway, }
var DefaultPlutusV2CostModel = []int64{}/* 175 elements not displayed */
DefaultPlutusV2CostModel contains the default PlutusV2 cost model values. These values are extracted from the Preview testnet protocol parameter update at slot 260306 (epoch 3). They include placeholder values (20000000000) for BLS12-381 and secp256k1 builtins that were not yet measured at the time. This is used as fallback when PlutusV2 cost models are not yet available from on-chain protocol parameter updates (e.g., during Babbage hard fork before the first pparam update is applied).
var DijkstraEraDesc = EraDesc{ Id: gdijkstra.EraIdDijkstra, Name: gdijkstra.EraNameDijkstra, MinMajorVersion: gdijkstra.MinProtocolVersionDijkstra, MaxMajorVersion: gdijkstra.MaxProtocolVersionDijkstra, DecodePParamsFunc: DecodePParamsDijkstra, DecodePParamsUpdateFunc: DecodePParamsUpdateDijkstra, PParamsUpdateFunc: PParamsUpdateDijkstra, ParamUpdateHasPlutusV2CostModelFunc: func(u any) bool { upd, ok := u.(gdijkstra.DijkstraProtocolParameterUpdate) if !ok { return false } return paramUpdateHasPlutusV2CostModel(upd.CostModels) }, HardForkFunc: HardForkDijkstra, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVDijkstra, CertDepositFunc: CertDepositDijkstra, ValidateTxFunc: ValidateTxDijkstra, EvaluateTxFunc: EvaluateTxDijkstra, }
var Eras = []EraDesc{ ByronEraDesc, ShelleyEraDesc, AllegraEraDesc, MaryEraDesc, AlonzoEraDesc, BabbageEraDesc, ConwayEraDesc, }
var ErasWithDijkstra = []EraDesc{ ByronEraDesc, ShelleyEraDesc, AllegraEraDesc, MaryEraDesc, AlonzoEraDesc, BabbageEraDesc, ConwayEraDesc, DijkstraEraDesc, }
var ErrExUnitsOverflow = errors.New(
"execution units overflow int64",
)
ErrExUnitsOverflow is returned when ExUnits summation would overflow int64.
var ErrIncompatibleProtocolParams = errors.New("pparams are not expected type")
var ErrNoCostModelForPlutusV2 = errors.New(
"no cost model for PlutusV2 script (still HardForkBabbage's synthetic default)",
)
ErrNoCostModelForPlutusV2 is returned when a transaction's PlutusV2 redeemer is evaluated against HardForkBabbage's fabricated cost model rather than real governance/protocol-update data (blinklabs-io/dingo#3962). Real cardano-ledger rejects such a transaction outright, at the UTXOW level, before any script evaluation runs: the formal rule "languages txw ⊆ dom(costmdls pp)" (eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxow.hs, eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxow.hs, both in IntersectMBO/cardano-ledger) is checked unconditionally against the languages the transaction's witnesses actually use, raising `NoCostModel` (Cardano.Ledger.Alonzo.Plutus.Context.CollectError) when a used language has no entry in the current protocol parameters' cost-models map at all. On a real network during the pre-update gap, PlutusV2 genuinely has no entry in that map, so this is not a hypothetical: a real IntersectMBO/cardano-node bug report (cardano-node#4050) shows exactly this rejection reachable in practice, and cardano-ledger's own Conway conformance suite (Test.Cardano.Ledger.Conway.Imp.UtxosSpec) has the identical-shaped test for PlutusV3 at the Conway boundary. Dingo's HardForkBabbage instead fabricates a value specifically so CostModels[1] is never genuinely absent (needed for eras.DefaultPlutusV2CostModel's own internal-validation-continuity purpose), so a literal "is the language a map key" check would never fire here -- the equivalent condition is "is the entry still the fabricated one", tracked as LedgerState.syntheticV2CostModel and reachable from era-package validation code via syntheticV2CostModelReporter.
var MaryEraDesc = EraDesc{ Id: mary.EraIdMary, Name: mary.EraNameMary, MinMajorVersion: mary.MinProtocolVersionMary, MaxMajorVersion: mary.MaxProtocolVersionMary, DecodePParamsFunc: DecodePParamsMary, DecodePParamsUpdateFunc: DecodePParamsUpdateMary, PParamsUpdateFunc: PParamsUpdateMary, HardForkFunc: HardForkMary, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVMary, CertDepositFunc: CertDepositMary, ValidateTxFunc: ValidateTxMary, }
var ShelleyEraDesc = EraDesc{ Id: shelley.EraIdShelley, Name: shelley.EraNameShelley, MinMajorVersion: shelley.MinProtocolVersionShelley, MaxMajorVersion: shelley.MaxProtocolVersionShelley, DecodePParamsFunc: DecodePParamsShelley, DecodePParamsUpdateFunc: DecodePParamsUpdateShelley, PParamsUpdateFunc: PParamsUpdateShelley, HardForkFunc: HardForkShelley, EpochLengthFunc: EpochLengthShelley, CalculateEtaVFunc: CalculateEtaVShelley, CertDepositFunc: CertDepositShelley, ValidateTxFunc: ValidateTxShelley, }
Functions ¶
func BuildEraParams ¶ added in v0.37.0
BuildEraParams assembles a hardfork.EraParams value for the given era, using the node configuration for the era-specific epoch length, slot length, and safe-zone (stability-window) values.
func BuildShape ¶ added in v0.37.0
func BuildShape(cfg *cardano.CardanoNodeConfig) (hardfork.Shape, error)
BuildShape constructs a hardfork.Shape from dingo's static era table. The shape's SystemStart comes from the Shelley genesis; each entry's EraParams are built via BuildEraParams; the protocol-version range is read directly from EraDesc.MinMajorVersion / MaxMajorVersion.
func BuildShapeForEras ¶ added in v0.51.0
func BuildShapeWithDijkstra ¶ added in v0.51.0
func CalculateConwayMinFee ¶ added in v0.52.0
func CalculateConwayRefScriptFee ¶ added in v0.52.0
func CalculateEtaVAllegra ¶
func CalculateEtaVAlonzo ¶
func CalculateEtaVBabbage ¶
func CalculateEtaVConway ¶
func CalculateEtaVDijkstra ¶ added in v0.51.0
func CalculateEtaVMary ¶
func CalculateEtaVShelley ¶
func CalculateMinFee ¶ added in v0.22.0
func CalculateMinFee( txSize uint64, exUnits lcommon.ExUnits, minFeeA uint, minFeeB uint, pricesMem *big.Rat, pricesSteps *big.Rat, ) uint64
CalculateMinFee computes the minimum fee for a transaction using the Cardano fee formula:
fee = (minFeeA * txSize) + minFeeB + scriptFee
where (per Alonzo spec txscriptfee):
scriptFee = ceil(pricesMem * mem + pricesSteps * steps)
Note: a single ceiling is applied over the sum of both components, NOT ceil of each added together. Script fee arithmetic uses big.Rat to prevent overflow and preserve exact rational arithmetic.
func CertDepositAllegra ¶
func CertDepositAllegra( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositAlonzo ¶
func CertDepositAlonzo( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositBabbage ¶
func CertDepositBabbage( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositConway ¶
func CertDepositConway( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositDijkstra ¶ added in v0.51.0
func CertDepositDijkstra( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositMary ¶
func CertDepositMary( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CertDepositShelley ¶
func CertDepositShelley( cert lcommon.Certificate, pp lcommon.ProtocolParameters, ) (uint64, error)
func CloneGovernanceProtocolParameters ¶ added in v0.70.3
func CloneGovernanceProtocolParameters( pparams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
CloneGovernanceProtocolParameters returns an independently owned copy of Conway-or-later protocol parameters. Every map, slice, and rational is cloned so an era update cannot mutate a previously published snapshot.
func DeclaredExUnits ¶ added in v0.22.0
func DeclaredExUnits( tx lcommon.Transaction, ) (lcommon.ExUnits, error)
DeclaredExUnits returns the total execution units declared across all redeemers in a transaction, including Dijkstra subtransaction witness sets. These are the budgets the transaction builder committed to (not the evaluated actuals). Returns an error for negative values or if the summation would overflow int64.
func DecodePParamsAllegra ¶
func DecodePParamsAllegra(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsAlonzo ¶
func DecodePParamsAlonzo(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsBabbage ¶
func DecodePParamsBabbage(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsConway ¶
func DecodePParamsConway(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsDijkstra ¶ added in v0.51.0
func DecodePParamsDijkstra(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsMary ¶
func DecodePParamsMary(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsShelley ¶
func DecodePParamsShelley(data []byte) (lcommon.ProtocolParameters, error)
func DecodePParamsUpdateDijkstra ¶ added in v0.51.0
func DecodePParamsUpdateMary ¶
func EpochLengthByron ¶
func EpochLengthByron( nodeConfig *cardano.CardanoNodeConfig, ) (uint, uint, error)
func EpochLengthShelley ¶
func EpochLengthShelley( nodeConfig *cardano.CardanoNodeConfig, ) (uint, uint, error)
func EvaluateTxAlonzo ¶ added in v0.21.0
func EvaluateTxAlonzo( tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
func EvaluateTxBabbage ¶ added in v0.21.0
func EvaluateTxBabbage( tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
func EvaluateTxConway ¶ added in v0.16.0
func EvaluateTxConway( tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
func EvaluateTxDijkstra ¶ added in v0.51.0
func EvaluateTxDijkstra( tx lcommon.Transaction, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
func HardForkAllegra ¶
func HardForkAllegra( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkAlonzo ¶
func HardForkAlonzo( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkBabbage ¶
func HardForkBabbage( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkConway ¶
func HardForkConway( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkDijkstra ¶ added in v0.51.0
func HardForkDijkstra( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkMary ¶
func HardForkMary( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func HardForkShelley ¶
func HardForkShelley( nodeConfig *cardano.CardanoNodeConfig, prevPParams lcommon.ProtocolParameters, ) (lcommon.ProtocolParameters, error)
func IsCompatibleEra ¶ added in v0.22.0
IsCompatibleEra checks if a transaction era is valid for the current ledger era. Cardano allows transactions from the current era and the immediately previous era (era - 1) after a hard fork. The previous era is determined by the ordering of the Eras slice, not by numeric ID arithmetic.
Returns true if txEraId matches the ledgerEraId or if txEraId is the era immediately preceding ledgerEraId in the known era sequence. Returns false for unknown era IDs that don't match, future eras, or eras more than one step back.
func IsCompatibleEraIn ¶ added in v0.51.0
func IsValidEraAdvancement ¶ added in v0.38.0
IsValidEraAdvancement reports whether a block tagged with nextEraId can legitimately advance the ledger from currentEraId. Valid cases:
- Same era (in-era epoch rollover): nextEraId == currentEraId.
- One step forward: nextEraId is the era immediately following currentEraId in the ordered Eras slice.
All other cases — multi-step forward, any backwards step, and advancement to or from an era that is not present in the Eras slice — are rejected. Each era boundary on a healthy chain is crossed by a specific block from that era, so multi-step advancement implies a non-conforming block, a malformed snapshot, or a chain-selection bug; silently catching up by iterating each era's HardForkFunc would skip per-era epoch-based events that should have fired during the omitted span.
Era IDs are not assumed to be contiguous integers; the check resolves each ID to its position in Eras and compares positions.
func IsValidEraAdvancementIn ¶ added in v0.51.0
func PParamsUpdateAllegra ¶
func PParamsUpdateAllegra( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateAlonzo ¶
func PParamsUpdateAlonzo( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateBabbage ¶
func PParamsUpdateBabbage( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateConway ¶
func PParamsUpdateConway( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateDijkstra ¶ added in v0.51.0
func PParamsUpdateDijkstra( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateMary ¶
func PParamsUpdateMary( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func PParamsUpdateShelley ¶
func PParamsUpdateShelley( currentPParams lcommon.ProtocolParameters, pparamsUpdate any, ) (lcommon.ProtocolParameters, error)
func ReferenceScriptSizeFromUtxos ¶ added in v0.52.0
func ReferencedScriptSize ¶ added in v0.52.0
func ReferencedScriptSize( tx lcommon.Transaction, ls lcommon.LedgerState, ) (uint64, error)
func SafeAddExUnits ¶ added in v0.22.0
SafeAddExUnits adds two ExUnits values with overflow detection. Returns an error if either the Memory or Steps sum would exceed math.MaxInt64.
func StabilityWindowForEra ¶ added in v0.37.0
func StabilityWindowForEra( cfg *cardano.CardanoNodeConfig, eraId uint, ) (uint64, error)
StabilityWindowForEra returns the stability window (in slots) for the given era. For Byron, this is 2k; for Shelley and later eras, 3k/f (rounded up).
Returns an error if the required genesis data is unavailable or malformed. This is the pure, LedgerState-free version of the stability-window computation used by the HFC Shape builder.
func TxSizeForFee ¶ added in v0.22.0
func TxSizeForFee(tx lcommon.Transaction) uint64
TxSizeForFee computes the transaction size used in the Cardano fee formula. Per the Haskell ledger's toCBORForSizeComputation, this is the 3-element CBOR encoding [body, witnesses, auxiliary_data] — the IsValid boolean is excluded for backward compatibility with Mary-era transaction sizes. Since both 0x83 and 0x84 are 1-byte CBOR headers, the difference from the on-wire 4-element format is exactly the 1-byte IsValid field. Pre-Alonzo transactions (Byron through Mary) do not contain an IsValid byte, so their full CBOR length is the fee-relevant size — except when the transaction was rebuilt from block components, which preAlonzoRebuiltWireSize handles.
func ValidateOpCertCounter ¶ added in v0.70.7
ValidateOpCertCounter enforces the operational-certificate issue-number counter rule shared by block application (ledger/verify_opcert.go) and the forge loop's pre-flight check (ledger/forging/keys.go): the single source of truth for the rule, so the two call sites cannot drift apart.
A counter below the last-seen value is always rejected (stale or stolen hot key), in every era. A counter that skips ahead of it is rejected only when enforceNoGap is set: the over-increment (no-gap) rule is Praos-only (Babbage onward); TPraos eras (Shelley-Alonzo) accept any candidate at or above stored. For a registered active pool with no recorded counter (found is false), the reference rules use zero as the baseline. The caller establishes producer eligibility separately; this function applies only the counter transition.
The gap comparison checks candidate > stored before subtracting, rather than comparing candidate > stored+1, so a stored value of math.MaxUint64 cannot wrap the addition to zero and misclassify an equal candidate as gapped.
func ValidateOpCertPersistableCounter ¶ added in v0.70.7
ValidateOpCertPersistableCounter rejects an operational-certificate issue number dingo cannot record, naming the bound and why it exists.
It is deliberately separate from ValidateOpCertCounter: that rule is the era-scoped chain rule and is only evaluated for blocks being validated, while this bound governs every counter that reaches the metadata store -- an unvalidated replay and a locally forged block included.
func ValidateTxAllegra ¶
func ValidateTxAllegra( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxAlonzo ¶
func ValidateTxAlonzo( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxBabbage ¶
func ValidateTxBabbage( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxByron ¶ added in v0.22.0
func ValidateTxByron( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
ValidateTxByron performs structural and UTxO-aware validation on Byron transactions. Structural rules always run. UTxO-aware rules (input existence, value conservation, witness signatures) run when a LedgerState is provided.
func ValidateTxConway ¶
func ValidateTxConway( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxDijkstra ¶ added in v0.51.0
func ValidateTxDijkstra( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxExUnits ¶ added in v0.22.0
ValidateTxExUnits checks that total execution units do not exceed the protocol parameter per-transaction limits.
func ValidateTxFee ¶ added in v0.22.0
func ValidateTxFee( tx lcommon.Transaction, minFeeA uint, minFeeB uint, pricesMem *big.Rat, pricesSteps *big.Rat, ) error
ValidateTxFee checks that the fee declared in the transaction body is at least the calculated minimum fee, including both the base fee component and the script execution fee component.
The minimum fee formula (Alonzo+ eras), computed by CalculateMinFee:
minFee = (minFeeA * txSize) + minFeeB
+ ceil(pricesMem * totalMem
+ pricesSteps * totalSteps)
Note: a single ceiling is applied over the combined script cost sum, not per-component.
Returns nil if the declared fee is sufficient.
func ValidateTxFeeConway ¶ added in v0.52.0
func ValidateTxFeeConway( tx lcommon.Transaction, ls lcommon.LedgerState, pp *conway.ConwayProtocolParameters, ) error
func ValidateTxMary ¶
func ValidateTxMary( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxPlutusConway ¶ added in v0.52.0
func ValidateTxPlutusConway( tx lcommon.Transaction, _ uint64, ls lcommon.LedgerState, pp *conway.ConwayProtocolParameters, ) error
func ValidateTxShelley ¶
func ValidateTxShelley( tx lcommon.Transaction, slot uint64, ls lcommon.LedgerState, pp lcommon.ProtocolParameters, ) error
func ValidateTxSize ¶ added in v0.22.0
func ValidateTxSize( tx lcommon.Transaction, maxTxSize uint, ) error
ValidateTxSize checks that the transaction size does not exceed the protocol parameter maximum.
Types ¶
type BadInputsByronError ¶ added in v0.22.0
type BadInputsByronError struct {
Inputs []lcommon.TransactionInput
}
BadInputsByronError is returned when a Byron transaction references inputs that do not exist in the UTxO set.
func (BadInputsByronError) Error ¶ added in v0.22.0
func (e BadInputsByronError) Error() string
type ByronProtocolMagicProvider ¶ added in v0.70.0
ByronProtocolMagicProvider supplies the protocol magic from the active Byron genesis configuration. It must come from ledger state rather than being inferred from the Shelley network ID because private networks can use custom Byron protocol magic values.
type ByronProtocolParameters ¶ added in v0.74.0
type ByronProtocolParameters struct {
ScriptVersion uint16
SlotDuration *big.Int
MaxBlockSize *big.Int
MaxHeaderSize *big.Int
MaxTxSize *big.Int
MaxProposalSize *big.Int
MpcThd uint64
HeavyDelThd uint64
UpdateVoteThd uint64
UpdateProposalThd uint64
// UpdateProposalTTL is ppUpdateProposalTTL, the number of slots an
// unconfirmed proposal stays registered. Genesis calls it
// updateImplicit.
UpdateProposalTTL uint64
SoftforkRule ByronSoftforkRule
// TxFeeSummand is the fee policy constant in lovelace, and
// TxFeeMultiplierNano the per-byte coefficient scaled by 10^9, so the
// multiplier is the exact rational TxFeeMultiplierNano / 10^9.
TxFeeSummand uint64
TxFeeMultiplierNano *big.Int
UnlockStakeEpoch uint64
// AdoptionUnknown marks parameters whose adopted values could not be
// established: the update state was rebuilt from a chain that starts
// after genesis, so any update adopted before its first block is
// missing. The block size, transaction size and minimum fee rules that
// read them are not enforced, since genesis values could reject a block
// the network accepted.
AdoptionUnknown bool
}
ByronProtocolParameters are the adopted Byron protocol parameters of the update system (Cardano.Chain.Update.ProtocolParameters). Byron genesis only initializes them; an adopted update proposal replaces them at an epoch boundary. The size and duration fields are Natural in the reference, so they are unbounded here too.
func NewByronProtocolParametersFromGenesis ¶ added in v0.74.0
func NewByronProtocolParametersFromGenesis( genesis *byron.ByronGenesis, ) (*ByronProtocolParameters, error)
NewByronProtocolParametersFromGenesis loads the genesis blockVersionData the way the reference JSON decoder does. The fee summand is summand div 10^9 and the multiplier multiplier / 10^9 exactly (TxFeePolicy's FromJSON).
func (*ByronProtocolParameters) ApplyUpdate ¶ added in v0.74.0
func (p *ByronProtocolParameters) ApplyUpdate( mod byron.ByronUpdateProposalBlockVersionMod, ) (*ByronProtocolParameters, error)
ApplyUpdate returns the parameters with a proposal's ProtocolParametersUpdate applied (PPU.apply): every field the update carries replaces the adopted value.
An on-chain fee policy is decoded as TxSizeLinear, which reads both coefficients as Nano and rounds the summand to the nearest lovelace, ties to even, where genesis truncates it.
func (*ByronProtocolParameters) Clone ¶ added in v0.74.0
func (p *ByronProtocolParameters) Clone() *ByronProtocolParameters
Clone returns a deep copy, or nil for a nil receiver.
func (*ByronProtocolParameters) Equal ¶ added in v0.74.0
func (p *ByronProtocolParameters) Equal(other *ByronProtocolParameters) bool
Equal reports whether two parameter sets are identical.
func (*ByronProtocolParameters) MinFee ¶ added in v0.74.0
func (p *ByronProtocolParameters) MinFee(size uint64) (*big.Int, error)
MinFee returns summand + ceiling(multiplier * size) in lovelace (calculateTxSizeLinear), which must stay within the Lovelace domain.
func (*ByronProtocolParameters) UpdateAdoptionThreshold ¶ added in v0.74.0
func (p *ByronProtocolParameters) UpdateAdoptionThreshold( numGenKeys int, ) int
UpdateAdoptionThreshold is upAdptThd: floor(srMinThd * numGenKeys), the number of genesis keys that must confirm or endorse an update.
type ByronProtocolParametersProvider ¶ added in v0.74.0
type ByronProtocolParametersProvider interface {
ByronProtocolParameters() (*ByronProtocolParameters, error)
}
ByronProtocolParametersProvider supplies the Byron protocol parameters in effect for a transaction validated outside block application: those adopted as of the ledger tip, or the genesis parameters before any update has been adopted. Block application passes the parameters adopted for the block's own epoch as the pparams argument instead.
type ByronSoftforkRule ¶ added in v0.74.0
ByronSoftforkRule is the Byron softfork resolution rule, each threshold a LovelacePortion numerator over 10^15.
type CommitteeCredentialState ¶ added in v0.70.5
type CommitteeCredentialState interface {
CommitteeStateAvailable() (bool, error)
CommitteeCredentialMember(
lcommon.Credential,
) (*lcommon.CommitteeMember, error)
CommitteeHotCredentialMember(
lcommon.Credential,
) (*lcommon.CommitteeMember, error)
}
CommitteeCredentialState is the optional ledger-state capability used by Dingo's Conway and Dijkstra validation compositions to preserve key/script credential tags. The legacy hash-only LedgerState committee methods cannot distinguish credentials that share a hash.
The method set is identical to gouroboros ledger/common.CommitteeCredentialState, so the compile-time assertions against this interface (ledger.LedgerView, conformance DingoStateProvider) also prove those types satisfy the upstream capability. Keep the two in sync: the upstream Conway rules type-assert for it and fail closed when the assertion misses, so a signature drift here would silently disable committee validation rather than fail to build. Once the gouroboros pin exports it, alias this to the upstream type instead of redeclaring it.
type CommitteeMemberAlreadyResignedError ¶ added in v0.73.0
type CommitteeMemberAlreadyResignedError struct {
ColdCredential lcommon.Credential
}
CommitteeMemberAlreadyResignedError indicates a committee cold-key resignation certificate for a member already resigned, in ledger state or by an earlier certificate of the same transaction.
Reference: ConwayCommitteeHasPreviouslyResigned in GOVCERT, eras/conway/impl/src/Cardano/Ledger/Conway/Rules/GovCert.hs.
func (CommitteeMemberAlreadyResignedError) Error ¶ added in v0.73.0
func (e CommitteeMemberAlreadyResignedError) Error() string
type EraDesc ¶
type EraDesc struct {
DecodePParamsFunc func([]byte) (lcommon.ProtocolParameters, error)
DecodePParamsUpdateFunc func([]byte) (any, error)
PParamsUpdateFunc func(lcommon.ProtocolParameters, any) (lcommon.ProtocolParameters, error)
// ParamUpdateHasPlutusV2CostModelFunc reports whether a decoded
// DecodePParamsUpdateFunc value (the enacted update itself, not the
// merged result) explicitly specifies a PlutusV2 cost model (map key
// 1). This is the pre-Conway equivalent of
// governance.EnactmentResult.PlutusV2CostModelWritten, used by
// database.ComputeAndApplyPParamUpdates: on a network that forks into
// Babbage before receiving a real PlutusV2 cost model, that model can
// arrive through this classic Shelley-style update system rather than
// CIP-1694 governance (as it did on real mainnet, well before Conway
// governance existed), and that path needs the same real-write
// provenance signal EnactProposal provides for Conway/Dijkstra --
// comparing the merged result's value before and after is unsound for
// the same reason it is there. See blinklabs-io/dingo#3825's PR review.
// nil for eras with no CostModels concept at all (Byron, Shelley,
// Allegra, Mary).
ParamUpdateHasPlutusV2CostModelFunc func(any) bool
HardForkFunc func(*cardano.CardanoNodeConfig, lcommon.ProtocolParameters) (lcommon.ProtocolParameters, error)
EpochLengthFunc func(*cardano.CardanoNodeConfig) (uint, uint, error)
CalculateEtaVFunc func(*cardano.CardanoNodeConfig, []byte, ledger.Block) ([]byte, error)
CertDepositFunc func(lcommon.Certificate, lcommon.ProtocolParameters) (uint64, error)
ValidateTxFunc func(lcommon.Transaction, uint64, lcommon.LedgerState, lcommon.ProtocolParameters) error
EvaluateTxFunc func(lcommon.Transaction, lcommon.LedgerState, lcommon.ProtocolParameters) (uint64, lcommon.ExUnits, map[lcommon.RedeemerKey]lcommon.ExUnits, error)
Name string
Id uint
// MinMajorVersion and MaxMajorVersion are the inclusive protocol-major
// version range covered by this era. Adjacent eras must meet without
// gap or overlap (cur.MinMajorVersion == prev.MaxMajorVersion + 1).
MinMajorVersion uint
MaxMajorVersion uint
}
func ActiveEras ¶ added in v0.51.0
ActiveEras returns the era table for a runtime configuration. Dijkstra is experimental and intentionally excluded from the package-level default table.
func EraForVersion ¶ added in v0.37.0
EraForVersion returns the era descriptor whose [MinMajorVersion, MaxMajorVersion] range contains majorVersion. Returns (nil, false) if no era covers the given version.
func EraForVersionIn ¶ added in v0.51.0
func GetEraById ¶ added in v0.18.0
GetEraById returns the descriptor for any era known to this build. Runtime active-era checks should use GetEraByIdIn with ActiveEras.
func GetEraByIdIn ¶ added in v0.51.0
type FeeTooLowByronError ¶ added in v0.70.13
FeeTooLowByronError is returned when a Byron transaction's implicit fee is below the fee required by the adopted Byron fee policy.
func (FeeTooLowByronError) Error ¶ added in v0.70.13
func (e FeeTooLowByronError) Error() string
type InputSetEmptyByronError ¶ added in v0.22.0
type InputSetEmptyByronError struct{}
InputSetEmptyByronError is returned when a Byron transaction has no inputs.
func (InputSetEmptyByronError) Error ¶ added in v0.22.0
func (InputSetEmptyByronError) Error() string
type InsufficientForInstantaneousRewardsError ¶ added in v0.72.0
type InsufficientForInstantaneousRewardsError struct {
Pot uint
Required *big.Int
Available *big.Int
}
InsufficientForInstantaneousRewardsError indicates a move instantaneous rewards distribution whose pot's accumulated total exceeds the pot.
Reference: InsufficientForInstantaneousRewardsDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (InsufficientForInstantaneousRewardsError) Error ¶ added in v0.72.0
func (e InsufficientForInstantaneousRewardsError) Error() string
type InsufficientForTransferError ¶ added in v0.72.0
InsufficientForTransferError indicates a pot-to-pot move instantaneous rewards transfer larger than what its source pot has left.
Reference: InsufficientForTransferDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (InsufficientForTransferError) Error ¶ added in v0.72.0
func (e InsufficientForTransferError) Error() string
type LovelaceBoundByronError ¶ added in v0.73.0
LovelaceBoundByronError is returned when a Byron balance or minimum fee leaves the Lovelace domain [0, 45e15] (TxValidationLovelaceError).
func (LovelaceBoundByronError) Error ¶ added in v0.73.0
func (e LovelaceBoundByronError) Error() string
type MIRCertificateTooLateError ¶ added in v0.72.0
MIRCertificateTooLateError indicates a move instantaneous rewards certificate in the final stability window of its epoch.
Reference: MIRCertificateTooLateinEpochDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (MIRCertificateTooLateError) Error ¶ added in v0.72.0
func (e MIRCertificateTooLateError) Error() string
type MIRCredentialKey ¶ added in v0.70.15
type MIRCredentialKey struct {
Tag uint8
Credential lcommon.Blake2b224
Pot uint
}
MIRCredentialKey identifies one stake credential within one source pot, for the purpose of folding move instantaneous rewards deltas accumulated within an epoch. All three fields are required: a key hash and a script hash may coincidentally share 28 bytes (hence Tag), and the reference keeps reserves and treasury deltas in two entirely separate maps -- iRReserves and iRTreasury, each keyed by Credential -- so a surplus pending in one pot must never offset a deficit in the other (hence Pot). Pot uses the same 0 (reserves) / 1 (treasury) convention as cert.Reward.Source and models.MIREffect.Pot.
type MIRDelegState ¶ added in v0.72.0
type MIRDelegState struct {
// Reserves and Treasury are the chain account pots, which do not move
// within a Shelley-through-Babbage epoch.
Reserves uint64
Treasury uint64
// DeltaReserves and DeltaTreasury are the signed net pot-to-pot
// transfers committed earlier in the epoch (deltaReserves and
// deltaTreasury).
DeltaReserves *big.Int
DeltaTreasury *big.Int
// Pending is iRReserves and iRTreasury for every credential named by a
// distribution committed earlier in the epoch, folded with the rule the
// requesting protocol version uses: summed from protocol version 5,
// replaced by the later certificate's amount before it.
Pending map[MIRCredentialKey]*big.Int
// Cutoff is firstSlot(nextEpoch) - stabilityWindow. A certificate is
// valid only in a slot strictly below it.
Cutoff uint64
}
MIRDelegState is the slice of cardano-ledger's DELEG environment and InstantaneousRewards state that the move instantaneous rewards predicates read: the chain account pots, the instantaneous rewards and pot transfers already committed earlier in the epoch, and the slot at which a certificate becomes too late for the epoch.
type MIRDelegStateProvider ¶ added in v0.72.0
type MIRDelegStateProvider interface {
MIRDelegState(slot uint64, additive bool) (MIRDelegState, error)
}
MIRDelegStateProvider is satisfied by the dingo ledger state. The move instantaneous rewards predicates need epoch-scoped state that the gouroboros LedgerState interface does not expose. Exported so *ledger.LedgerView can assert conformance at compile time; a signature drift here would otherwise silently disable every predicate that reads it.
type MIRProducesNegativeUpdateError ¶ added in v0.70.15
type MIRProducesNegativeUpdateError struct {
CredentialTag uint8
Credential lcommon.Blake2b224
Pot uint
Existing *big.Int
Delta *big.Int
}
MIRProducesNegativeUpdateError indicates a move instantaneous rewards certificate whose delta, folded into the InstantaneousRewards accumulated for its credential so far this epoch, would drive that credential's pending reward below zero.
Reference: MIRProducesNegativeUpdate in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (MIRProducesNegativeUpdateError) Error ¶ added in v0.70.15
func (e MIRProducesNegativeUpdateError) Error() string
type MIRTransferNotCurrentlyAllowedError ¶ added in v0.72.0
MIRTransferNotCurrentlyAllowedError indicates a pot-to-pot move instantaneous rewards transfer at a protocol version before the Alonzo hard fork.
Reference: MIRTransferNotCurrentlyAllowed in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (MIRTransferNotCurrentlyAllowedError) Error ¶ added in v0.72.0
func (e MIRTransferNotCurrentlyAllowedError) Error() string
type MinPoolMarginProvider ¶ added in v0.67.0
MinPoolMarginProvider is satisfied by the dingo ledger state to expose the CIP-23 minimum pool margin to era validation, mirroring phase2ValidationSkipper. Exported so implementers (e.g. *ledger.LedgerView) can assert conformance at compile time; a signature drift here would otherwise silently disable the CIP-23 pool-margin-floor certificate rule at runtime.
type NetworkMagicMismatchByronError ¶ added in v0.72.0
NetworkMagicMismatchByronError is returned when a Byron transaction pays to an address belonging to a different network than the one this node is validating for. Expected and Actual are nil for the mainnet encoding, which carries no network-magic attribute at all, and non-nil for a testnet or custom network, which carries its magic explicitly.
func (NetworkMagicMismatchByronError) Error ¶ added in v0.72.0
func (e NetworkMagicMismatchByronError) Error() string
type OutputNegativeByronError ¶ added in v0.70.13
OutputNegativeByronError is returned when a Byron transaction output has a negative value.
func (OutputNegativeByronError) Error ¶ added in v0.70.13
func (e OutputNegativeByronError) Error() string
type OutputNotPositiveByronError
deprecated
added in
v0.22.0
OutputNotPositiveByronError is retained for API compatibility.
Deprecated: Byron consensus permits zero-value outputs, so validation no longer returns this error.
func (OutputNotPositiveByronError) Error ¶ added in v0.22.0
func (e OutputNotPositiveByronError) Error() string
type OutputSetEmptyByronError ¶ added in v0.22.0
type OutputSetEmptyByronError struct{}
OutputSetEmptyByronError is returned when a Byron transaction has no outputs.
func (OutputSetEmptyByronError) Error ¶ added in v0.22.0
func (OutputSetEmptyByronError) Error() string
type ParameterChangeProtocolVersionError ¶ added in v0.73.0
type ParameterChangeProtocolVersionError struct {
ProposalIndex int
}
ParameterChangeProtocolVersionError indicates that a ParameterChange governance action set protocol-version key 14, which the reference excludes from PParamsUpdate entirely.
func (ParameterChangeProtocolVersionError) Error ¶ added in v0.73.0
func (e ParameterChangeProtocolVersionError) Error() string
type PlutusEvalContextCache ¶ added in v0.75.0
type PlutusEvalContextCache struct {
// contains filtered or unexported fields
}
PlutusEvalContextCache holds one *cek.EvalContext per distinct (language version, protocol major version, cost-model parameter list, synthetic-V2-cost-model flag) combination.
cek.EvalContext's own doc comment establishes the reuse guarantee this relies on: a built *cek.EvalContext is immutable and safe to share and reuse concurrently, across any number of goroutines and evaluations, for as long as the (LanguageVersion, ProtoVersion.Major, cost model parameter list) tuple that built it is unchanged. Since NewEvalContext is a pure function of exactly that tuple (plus the synthetic-V2 flag this cache also keys on -- see the field's call sites), reusing an entry across any two calls that share the full key is always correct, regardless of which protocol-parameter snapshot, era, or transaction either call came from. That is why this cache needs no correctness invalidation: a governance-enacted cost-model change simply produces a new key, and distinct eras (including the previous-era pparams path era-boundary transactions use) that happen to share a key are, by construction, supposed to share the resulting context.
Each such change would otherwise retain its superseded context for the life of the node, so the cache holds at most plutusEvalContextCacheMaxEntries entries and evicts the least recently used one to admit a new key. Eviction only drops the cache's reference: a caller already holding the evicted *cek.EvalContext keeps using it, and a later call for that key rebuilds it.
func NewPlutusEvalContextCache ¶ added in v0.75.0
func NewPlutusEvalContextCache() *PlutusEvalContextCache
NewPlutusEvalContextCache returns an empty cache ready for use.
type PlutusEvalContextCacheProvider ¶ added in v0.75.0
type PlutusEvalContextCacheProvider interface {
PlutusEvalContextCache() *PlutusEvalContextCache
}
PlutusEvalContextCacheProvider is implemented by LedgerState implementations that hold a PlutusEvalContextCache spanning many redeemer evaluations (see ledger.LedgerView.PlutusEvalContextCache). Exported so implementers can assert conformance at compile time, mirroring MinPoolMarginProvider and CommitteeCredentialState above. A LedgerState that does not implement this -- including most unit-test stand-ins -- simply gets an uncached *cek.EvalContext per call via plutusEvalContext, identical to this cache's absence.
type StakeKeyAlreadyRegisteredError ¶ added in v0.72.0
type StakeKeyAlreadyRegisteredError struct {
Credential lcommon.Credential
}
StakeKeyAlreadyRegisteredError indicates a legacy stake registration certificate for a credential that is already registered, in ledger state or by an earlier certificate of the same transaction.
Reference: StakeKeyAlreadyRegisteredDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (StakeKeyAlreadyRegisteredError) Error ¶ added in v0.72.0
func (e StakeKeyAlreadyRegisteredError) Error() string
type StakeKeyNonZeroAccountBalanceError ¶ added in v0.72.0
type StakeKeyNonZeroAccountBalanceError struct {
Credential lcommon.Credential
Balance uint64
}
StakeKeyNonZeroAccountBalanceError indicates a legacy stake deregistration certificate for a reward account that still holds rewards after the transaction's withdrawals.
Reference: StakeKeyNonZeroAccountBalanceDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (StakeKeyNonZeroAccountBalanceError) Error ¶ added in v0.72.0
func (e StakeKeyNonZeroAccountBalanceError) Error() string
type StakeKeyNotRegisteredError ¶ added in v0.72.0
type StakeKeyNotRegisteredError struct {
Credential lcommon.Credential
}
StakeKeyNotRegisteredError indicates a legacy stake deregistration certificate for a credential that is not registered at that point in the transaction.
Reference: StakeKeyNotRegisteredDELEG in delegTransition, eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs.
func (StakeKeyNotRegisteredError) Error ¶ added in v0.72.0
func (e StakeKeyNotRegisteredError) Error() string
type TxTooLargeByronError ¶ added in v0.73.0
TxTooLargeByronError is returned when a serialized Byron TxAux exceeds the active ppMaxTxSize (TxValidationTxTooLarge).
func (TxTooLargeByronError) Error ¶ added in v0.73.0
func (e TxTooLargeByronError) Error() string
type UnknownAddressAttributesByronError ¶ added in v0.73.0
UnknownAddressAttributesByronError is returned when the unknown attributes of an output address reach the 128-byte limit (TxValidationUnknownAddressAttributes).
func (UnknownAddressAttributesByronError) Error ¶ added in v0.73.0
func (e UnknownAddressAttributesByronError) Error() string
type UnknownAttributesByronError ¶ added in v0.73.0
type UnknownAttributesByronError struct {
Size int
}
UnknownAttributesByronError is returned when the unknown transaction attributes reach the 128-byte limit (TxValidationUnknownAttributes).
func (UnknownAttributesByronError) Error ¶ added in v0.73.0
func (e UnknownAttributesByronError) Error() string
type ValueNotConservedByronError ¶ added in v0.22.0
ValueNotConservedByronError is returned when a Byron transaction's consumed value does not equal its produced value plus fee (sum of inputs != sum of outputs + fee).
func (ValueNotConservedByronError) Error ¶ added in v0.22.0
func (e ValueNotConservedByronError) Error() string
type WitnessWrongKeyByronError ¶ added in v0.73.0
WitnessWrongKeyByronError is returned when the witness at an input's position does not authorize that input's address (TxValidationWitnessWrongKey).
func (WitnessWrongKeyByronError) Error ¶ added in v0.73.0
func (e WitnessWrongKeyByronError) Error() string