eras

package
v0.70.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
}
View Source
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,
}
View Source
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,
}
View Source
var ByronEraDesc = EraDesc{
	Id:              byron.EraIdByron,
	Name:            byron.EraNameByron,
	MinMajorVersion: 0,
	MaxMajorVersion: 1,
	EpochLengthFunc: EpochLengthByron,
	ValidateTxFunc:  ValidateTxByron,
}
View Source
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,
}
View Source
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).

View Source
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,
}
View Source
var ErrExUnitsOverflow = errors.New(
	"execution units overflow int64",
)

ErrExUnitsOverflow is returned when ExUnits summation would overflow int64.

View Source
var ErrIncompatibleProtocolParams = errors.New("pparams are not expected type")
View Source
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,
}
View Source
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

func BuildEraParams(
	cfg *cardano.CardanoNodeConfig,
	era EraDesc,
) (hardfork.EraParams, error)

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 BuildShapeForEras(
	cfg *cardano.CardanoNodeConfig,
	eraList []EraDesc,
) (hardfork.Shape, error)

func BuildShapeWithDijkstra added in v0.51.0

func BuildShapeWithDijkstra(
	cfg *cardano.CardanoNodeConfig,
	enableDijkstra bool,
) (hardfork.Shape, error)

func CalculateConwayMinFee added in v0.52.0

func CalculateConwayMinFee(
	txSize uint64,
	exUnits lcommon.ExUnits,
	minFeeA uint,
	minFeeB uint,
	pricesMem *big.Rat,
	pricesSteps *big.Rat,
	refScriptSize uint64,
	refScriptCostPerByte *big.Rat,
) uint64

func CalculateConwayRefScriptFee added in v0.52.0

func CalculateConwayRefScriptFee(
	refScriptSize uint64,
	costPerByte *big.Rat,
) uint64

func CalculateEtaVAllegra

func CalculateEtaVAllegra(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVAlonzo

func CalculateEtaVAlonzo(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVBabbage

func CalculateEtaVBabbage(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVConway

func CalculateEtaVConway(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVDijkstra added in v0.51.0

func CalculateEtaVDijkstra(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVMary

func CalculateEtaVMary(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

func CalculateEtaVShelley

func CalculateEtaVShelley(
	nodeConfig *cardano.CardanoNodeConfig,
	prevBlockNonce []byte,
	block ledger.Block,
) ([]byte, error)

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 DecodePParamsUpdateAllegra

func DecodePParamsUpdateAllegra(data []byte) (any, error)

func DecodePParamsUpdateAlonzo

func DecodePParamsUpdateAlonzo(data []byte) (any, error)

func DecodePParamsUpdateBabbage

func DecodePParamsUpdateBabbage(data []byte) (any, error)

func DecodePParamsUpdateConway

func DecodePParamsUpdateConway(data []byte) (any, error)

func DecodePParamsUpdateDijkstra added in v0.51.0

func DecodePParamsUpdateDijkstra(data []byte) (any, error)

func DecodePParamsUpdateMary

func DecodePParamsUpdateMary(data []byte) (any, error)

func DecodePParamsUpdateShelley

func DecodePParamsUpdateShelley(data []byte) (any, error)

func EpochLengthByron

func EpochLengthByron(
	nodeConfig *cardano.CardanoNodeConfig,
) (uint, uint, error)

func EpochLengthShelley

func EpochLengthShelley(
	nodeConfig *cardano.CardanoNodeConfig,
) (uint, uint, 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

func IsCompatibleEra(txEraId, ledgerEraId uint) bool

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 IsCompatibleEraIn(
	eraList []EraDesc,
	txEraId, ledgerEraId uint,
) bool

func IsValidEraAdvancement added in v0.38.0

func IsValidEraAdvancement(currentEraId, nextEraId uint) bool

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 IsValidEraAdvancementIn(
	eraList []EraDesc,
	currentEraId, nextEraId uint,
) bool

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 ReferenceScriptSizeFromUtxos(
	utxos []lcommon.Utxo,
) (uint64, error)

func ReferencedScriptSize added in v0.52.0

func ReferencedScriptSize(
	tx lcommon.Transaction,
	ls lcommon.LedgerState,
) (uint64, error)

func SafeAddExUnits added in v0.22.0

func SafeAddExUnits(
	a, b lcommon.ExUnits,
) (lcommon.ExUnits, error)

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 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 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

func ValidateTxExUnits(
	totalExUnits lcommon.ExUnits,
	maxTxExUnits lcommon.ExUnits,
) error

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 ValidateTxPlutusConway added in v0.52.0

func ValidateTxPlutusConway(
	tx lcommon.Transaction,
	_ uint64,
	ls lcommon.LedgerState,
	pp *conway.ConwayProtocolParameters,
) 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

type ByronProtocolMagicProvider interface {
	ByronProtocolMagic() (uint32, error)
}

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

type DuplicateInputByronError struct {
	TxId  string
	Index uint32
}

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

func ActiveEras(enableDijkstra bool) []EraDesc

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

func EraForVersion(majorVersion uint) (*EraDesc, bool)

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 EraForVersionIn(
	eraList []EraDesc,
	majorVersion uint,
) (*EraDesc, bool)

func GetEraById added in v0.18.0

func GetEraById(eraId uint) *EraDesc

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

func GetEraByIdIn(eraList []EraDesc, eraId uint) *EraDesc

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

type MinPoolMarginProvider added in v0.67.0

type MinPoolMarginProvider interface {
	MinPoolMargin() *big.Rat
}

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

type OutputNotPositiveByronError struct {
	Index  int
	Amount *big.Int
}

OutputNotPositiveByronError is returned when a Byron transaction output has a non-positive value.

func (OutputNotPositiveByronError) Error added in v0.22.0

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

type ValueNotConservedByronError added in v0.22.0

type ValueNotConservedByronError struct {
	Consumed *big.Int
	Produced *big.Int
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL