Documentation
¶
Index ¶
- 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 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 DuplicateInputByronError
- type EraDesc
- type InputSetEmptyByronError
- type MinPoolMarginProvider
- type OutputNotPositiveByronError
- type OutputSetEmptyByronError
- type ValueNotConservedByronError
Constants ¶
This section is empty.
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, 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, 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, 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, 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 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's witness set. These are the budgets the transaction builder committed to (not the evaluated actuals). Returns an error 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 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 DuplicateInputByronError ¶ added in v0.22.0
DuplicateInputByronError is returned when a Byron transaction contains duplicate inputs.
func (DuplicateInputByronError) Error ¶ added in v0.22.0
func (e DuplicateInputByronError) 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)
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 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 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 OutputNotPositiveByronError ¶ added in v0.22.0
OutputNotPositiveByronError is returned when a Byron transaction output has a non-positive value.
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 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