economics

package
v1.7.17 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPIEconomicsData

func NewAPIEconomicsData(data *economicsData) (*apiEconomicsData, error)

NewAPIEconomicsData will create a wrapped object over the provided economics data

func NewEconomicsData

func NewEconomicsData(args ArgsNewEconomicsData) (*economicsData, error)

NewEconomicsData will create an object with information about economics parameters

Types

type ArgsNewEconomicsData

type ArgsNewEconomicsData struct {
	TxVersionChecker    process.TxVersionCheckerHandler
	Economics           *config.EconomicsConfig
	EpochNotifier       process.EpochNotifier
	EnableEpochsHandler common.EnableEpochsHandler
}

ArgsNewEconomicsData defines the arguments needed for new economics economicsData

type EpochNotifier

type EpochNotifier interface {
	RegisterNotifyHandler(handler vmcommon.EpochSubscriberHandler)
	IsInterfaceNil() bool
}

EpochNotifier raises epoch change events

type TestEconomicsData

type TestEconomicsData struct {
	// contains filtered or unexported fields
}

TestEconomicsData extends EconomicsData and is used in integration tests as it exposes some functions that are not supposed to be used in production code Exported functions simplify the reproduction of edge cases

func NewTestEconomicsData

func NewTestEconomicsData(internalData *economicsData) *TestEconomicsData

NewTestEconomicsData -

func (TestEconomicsData) CheckValidityTxValues

func (ed TestEconomicsData) CheckValidityTxValues(tx data.TransactionWithFeeHandler) error

CheckValidityTxValues checks if the provided transaction is economically correct

func (TestEconomicsData) CheckValidityTxValuesInEpoch added in v1.7.0

func (ed TestEconomicsData) CheckValidityTxValuesInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) error

CheckValidityTxValuesInEpoch checks if the provided transaction is economically correct in a specific epoch

func (TestEconomicsData) ComputeFeeForProcessing

func (ed TestEconomicsData) ComputeFeeForProcessing(tx data.TransactionWithFeeHandler, gasToUse uint64) *big.Int

ComputeFeeForProcessing will compute the fee using the gas price modifier, the gas to use and the actual gas price

func (TestEconomicsData) ComputeFeeForProcessingInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeFeeForProcessingInEpoch(tx data.TransactionWithFeeHandler, gasToUse uint64, epoch uint32) *big.Int

ComputeFeeForProcessingInEpoch will compute the fee using the gas price modifier, the gas to use and the actual gas price in a specific epoch

func (TestEconomicsData) ComputeGasLimit

func (ed TestEconomicsData) ComputeGasLimit(tx data.TransactionWithFeeHandler) uint64

ComputeGasLimit returns the gas limit need by the provided transaction in order to be executed

func (TestEconomicsData) ComputeGasLimitBasedOnBalance

func (ed TestEconomicsData) ComputeGasLimitBasedOnBalance(tx data.TransactionWithFeeHandler, balance *big.Int) (uint64, error)

ComputeGasLimitBasedOnBalance will compute gas limit for the given transaction based on the balance

func (TestEconomicsData) ComputeGasLimitBasedOnBalanceInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeGasLimitBasedOnBalanceInEpoch(tx data.TransactionWithFeeHandler, balance *big.Int, epoch uint32) (uint64, error)

ComputeGasLimitBasedOnBalanceInEpoch will compute gas limit for the given transaction based on the balance in a specific epoch

func (TestEconomicsData) ComputeGasLimitInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeGasLimitInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) uint64

ComputeGasLimitInEpoch returns the gas limit need by the provided transaction in order to be executed in a specific epoch

func (TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValue

func (ed TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValue(tx data.TransactionWithFeeHandler, refundValue *big.Int) (uint64, *big.Int)

ComputeGasUsedAndFeeBasedOnRefundValue will compute gas used value and transaction fee using refund value from a SCR

func (TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValueInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValueInEpoch(tx data.TransactionWithFeeHandler, refundValue *big.Int, epoch uint32) (uint64, *big.Int)

ComputeGasUsedAndFeeBasedOnRefundValueInEpoch will compute gas used value and transaction fee using refund value from a SCR in a specific epoch

func (TestEconomicsData) ComputeMoveBalanceFee

func (ed TestEconomicsData) ComputeMoveBalanceFee(tx data.TransactionWithFeeHandler) *big.Int

ComputeMoveBalanceFee computes the provided transaction's fee

func (TestEconomicsData) ComputeMoveBalanceFeeInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeMoveBalanceFeeInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) *big.Int

ComputeMoveBalanceFeeInEpoch computes the provided transaction's fee in a specific epoch

func (TestEconomicsData) ComputeRelayedTxFees added in v1.7.14

func (ed TestEconomicsData) ComputeRelayedTxFees(tx data.TransactionWithFeeHandler) (*big.Int, *big.Int, error)

ComputeRelayedTxFees returns the both the total fee for the entire relayed tx and the relayed only fee

func (TestEconomicsData) ComputeTxFee

func (ed TestEconomicsData) ComputeTxFee(tx data.TransactionWithFeeHandler) *big.Int

ComputeTxFee computes the provided transaction's fee using enable from epoch approach

func (TestEconomicsData) ComputeTxFeeBasedOnGasUsed

func (ed TestEconomicsData) ComputeTxFeeBasedOnGasUsed(tx data.TransactionWithFeeHandler, gasUsed uint64) *big.Int

ComputeTxFeeBasedOnGasUsed will compute transaction fee

func (TestEconomicsData) ComputeTxFeeBasedOnGasUsedInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeTxFeeBasedOnGasUsedInEpoch(tx data.TransactionWithFeeHandler, gasUsed uint64, epoch uint32) *big.Int

ComputeTxFeeBasedOnGasUsedInEpoch will compute transaction fee in a specific epoch

func (TestEconomicsData) ComputeTxFeeInEpoch added in v1.7.0

func (ed TestEconomicsData) ComputeTxFeeInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) *big.Int

ComputeTxFeeInEpoch computes the provided transaction's fee in a specific epoch

func (TestEconomicsData) DeveloperPercentage

func (ed TestEconomicsData) DeveloperPercentage() float64

DeveloperPercentage returns the developer percentage value

func (TestEconomicsData) DeveloperPercentageInEpoch added in v1.7.0

func (ed TestEconomicsData) DeveloperPercentageInEpoch(epoch uint32) float64

DeveloperPercentageInEpoch returns the developer percentage value in a specific epoch

func (TestEconomicsData) EpochConfirmed

func (ed TestEconomicsData) EpochConfirmed(epoch uint32, _ uint64)

EpochConfirmed is called whenever a new epoch is confirmed

func (TestEconomicsData) ExtraGasLimitGuardedTx added in v1.5.0

func (ed TestEconomicsData) ExtraGasLimitGuardedTx() uint64

ExtraGasLimitGuardedTx returns the extra gas limit required by the guarded transactions

func (TestEconomicsData) ExtraGasLimitGuardedTxInEpoch added in v1.7.0

func (ed TestEconomicsData) ExtraGasLimitGuardedTxInEpoch(epoch uint32) uint64

ExtraGasLimitGuardedTxInEpoch returns the extra gas limit required by the guarded transactions in a specific epoch

func (TestEconomicsData) GasPerDataByte

func (ed TestEconomicsData) GasPerDataByte() uint64

GasPerDataByte returns the gas required for a economicsData byte

func (TestEconomicsData) GasPriceForMove

func (ed TestEconomicsData) GasPriceForMove(tx data.TransactionWithFeeHandler) uint64

GasPriceForMove returns the gas price for transferring funds

func (TestEconomicsData) GasPriceForProcessing

func (ed TestEconomicsData) GasPriceForProcessing(tx data.TransactionWithFeeHandler) uint64

GasPriceForProcessing computes the price for the gas in addition to balance movement and data

func (TestEconomicsData) GasPriceForProcessingInEpoch added in v1.7.0

func (ed TestEconomicsData) GasPriceForProcessingInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) uint64

GasPriceForProcessingInEpoch computes the price for the gas in addition to balance movement and data in a specific epoch

func (TestEconomicsData) GasPriceModifier

func (ed TestEconomicsData) GasPriceModifier() float64

GasPriceModifier returns the gas price modifier

func (TestEconomicsData) GasPriceModifierInEpoch added in v1.7.0

func (ed TestEconomicsData) GasPriceModifierInEpoch(epoch uint32) float64

GasPriceModifierInEpoch returns the gas price modifier in a specific epoch

func (TestEconomicsData) GenesisTotalSupply

func (ed TestEconomicsData) GenesisTotalSupply() *big.Int

GenesisTotalSupply returns the genesis total supply

func (*TestEconomicsData) GetMinGasLimit

func (ted *TestEconomicsData) GetMinGasLimit(epoch uint32) uint64

GetMinGasLimit returns the minimum gas limit for a transaction to be accepted

func (*TestEconomicsData) GetMinGasPrice

func (ted *TestEconomicsData) GetMinGasPrice() uint64

GetMinGasPrice returns the current min gas price

func (TestEconomicsData) IsInterfaceNil

func (ed TestEconomicsData) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (TestEconomicsData) LeaderPercentage

func (ed TestEconomicsData) LeaderPercentage() float64

LeaderPercentage returns leader reward percentage

func (TestEconomicsData) LeaderPercentageInEpoch added in v1.7.0

func (ed TestEconomicsData) LeaderPercentageInEpoch(epoch uint32) float64

LeaderPercentageInEpoch returns leader reward percentage in a specific epoch

func (TestEconomicsData) MaxGasLimitPerBlock

func (ed TestEconomicsData) MaxGasLimitPerBlock(shardID uint32) uint64

MaxGasLimitPerBlock returns maximum gas limit allowed per block

func (TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard

func (ed TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard() uint64

MaxGasLimitPerBlockForSafeCrossShard returns maximum gas limit per block for safe cross shard

func (TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShardInEpoch added in v1.7.0

func (ed TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShardInEpoch(epoch uint32) uint64

MaxGasLimitPerBlockForSafeCrossShardInEpoch returns maximum gas limit per block for safe cross shard in a specific epoch

func (TestEconomicsData) MaxGasLimitPerBlockInEpoch added in v1.7.0

func (ed TestEconomicsData) MaxGasLimitPerBlockInEpoch(shardID uint32, epoch uint32) uint64

MaxGasLimitPerBlockInEpoch returns maximum gas limit allowed per block in a specific epoch

func (TestEconomicsData) MaxGasLimitPerMiniBlock

func (ed TestEconomicsData) MaxGasLimitPerMiniBlock(shardID uint32) uint64

MaxGasLimitPerMiniBlock returns maximum gas limit allowed per mini block

func (TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard

func (ed TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard() uint64

MaxGasLimitPerMiniBlockForSafeCrossShard returns maximum gas limit per mini block for safe cross shard

func (TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShardInEpoch added in v1.7.0

func (ed TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShardInEpoch(epoch uint32) uint64

MaxGasLimitPerMiniBlockForSafeCrossShardInEpoch returns maximum gas limit per mini block for safe cross shard in a specific epoch

func (TestEconomicsData) MaxGasLimitPerMiniBlockInEpoch added in v1.7.0

func (ed TestEconomicsData) MaxGasLimitPerMiniBlockInEpoch(shardID uint32, epoch uint32) uint64

MaxGasLimitPerMiniBlockInEpoch returns maximum gas limit allowed per mini block in a specific epoch

func (TestEconomicsData) MaxGasLimitPerTx

func (ed TestEconomicsData) MaxGasLimitPerTx() uint64

MaxGasLimitPerTx returns maximum gas limit per tx

func (TestEconomicsData) MaxGasLimitPerTxInEpoch added in v1.7.0

func (ed TestEconomicsData) MaxGasLimitPerTxInEpoch(epoch uint32) uint64

MaxGasLimitPerTxInEpoch returns maximum gas limit per tx in a specific epoch

func (TestEconomicsData) MaxGasPriceSetGuardian added in v1.5.0

func (ed TestEconomicsData) MaxGasPriceSetGuardian() uint64

MaxGasPriceSetGuardian returns the maximum gas price for set guardian transactions

func (TestEconomicsData) MaxInflationRate

func (ed TestEconomicsData) MaxInflationRate(year uint32) float64

MaxInflationRate returns the maximum inflation rate

func (TestEconomicsData) MinGasLimit

func (ed TestEconomicsData) MinGasLimit() uint64

MinGasLimit returns min gas limit

func (TestEconomicsData) MinGasLimitInEpoch added in v1.7.0

func (ed TestEconomicsData) MinGasLimitInEpoch(epoch uint32) uint64

MinGasLimitInEpoch returns min gas limit in a specific epoch

func (TestEconomicsData) MinGasPrice

func (ed TestEconomicsData) MinGasPrice() uint64

MinGasPrice returns min gas price

func (TestEconomicsData) MinGasPriceForProcessing

func (ed TestEconomicsData) MinGasPriceForProcessing() uint64

MinGasPriceForProcessing returns the minimum allowed gas price for processing

func (TestEconomicsData) MinInflationRate

func (ed TestEconomicsData) MinInflationRate() float64

MinInflationRate returns the minimum inflation rate

func (TestEconomicsData) ProtocolSustainabilityAddress

func (ed TestEconomicsData) ProtocolSustainabilityAddress() string

ProtocolSustainabilityAddress returns the protocol sustainability address

func (TestEconomicsData) ProtocolSustainabilityAddressInEpoch added in v1.7.0

func (ed TestEconomicsData) ProtocolSustainabilityAddressInEpoch(epoch uint32) string

ProtocolSustainabilityAddressInEpoch returns the protocol sustainability address in a specific epoch

func (TestEconomicsData) ProtocolSustainabilityPercentage

func (ed TestEconomicsData) ProtocolSustainabilityPercentage() float64

ProtocolSustainabilityPercentage returns the protocol sustainability percentage value

func (TestEconomicsData) ProtocolSustainabilityPercentageInEpoch added in v1.7.0

func (ed TestEconomicsData) ProtocolSustainabilityPercentageInEpoch(epoch uint32) float64

ProtocolSustainabilityPercentageInEpoch returns the protocol sustainability percentage value in a specific epoch

func (TestEconomicsData) RewardsTopUpFactor

func (ed TestEconomicsData) RewardsTopUpFactor() float64

RewardsTopUpFactor returns the rewards top-up factor

func (TestEconomicsData) RewardsTopUpFactorInEpoch added in v1.7.0

func (ed TestEconomicsData) RewardsTopUpFactorInEpoch(epoch uint32) float64

RewardsTopUpFactorInEpoch returns the rewards top-up factor in a specific epoch

func (TestEconomicsData) RewardsTopUpGradientPoint

func (ed TestEconomicsData) RewardsTopUpGradientPoint() *big.Int

RewardsTopUpGradientPoint returns the rewards top-up gradient point

func (TestEconomicsData) RewardsTopUpGradientPointInEpoch added in v1.7.0

func (ed TestEconomicsData) RewardsTopUpGradientPointInEpoch(epoch uint32) *big.Int

RewardsTopUpGradientPointInEpoch returns the rewards top-up gradient point in a specific epoch

func (*TestEconomicsData) SetGasPerDataByte

func (ted *TestEconomicsData) SetGasPerDataByte(gasPerDataByte uint64)

SetGasPerDataByte sets gas per data byte for a transaction to be accepted

func (*TestEconomicsData) SetMaxGasLimitPerBlock

func (ted *TestEconomicsData) SetMaxGasLimitPerBlock(maxGasLimitPerBlock uint64, epoch uint32)

SetMaxGasLimitPerBlock sets the maximum gas limit allowed per one block

func (*TestEconomicsData) SetMaxInflationRate

func (ted *TestEconomicsData) SetMaxInflationRate(maximumInflation float64)

SetMaxInflationRate sets the maximum inflation rate for a transaction to be accepted

func (*TestEconomicsData) SetMinGasLimit

func (ted *TestEconomicsData) SetMinGasLimit(minGasLimit uint64, epoch uint32)

SetMinGasLimit sets the minimum gas limit for a transaction to be accepted

func (*TestEconomicsData) SetMinGasPrice

func (ted *TestEconomicsData) SetMinGasPrice(minGasPrice uint64)

SetMinGasPrice sets the minimum gas price for a transaction to be accepted

func (*TestEconomicsData) SetStatusHandler

func (ted *TestEconomicsData) SetStatusHandler(_ core.AppStatusHandler) error

SetStatusHandler returns nil

func (*TestEconomicsData) SetTotalSupply

func (ted *TestEconomicsData) SetTotalSupply(totalSupply *big.Int)

SetTotalSupply sets the total supply when booting the network

func (TestEconomicsData) SetTxTypeHandler added in v1.7.14

func (ed TestEconomicsData) SetTxTypeHandler(txTypeHandler process.TxTypeHandler) error

SetTxTypeHandler sets the provided tx type handler

func (TestEconomicsData) SplitTxGasInCategories

func (ed TestEconomicsData) SplitTxGasInCategories(tx data.TransactionWithFeeHandler) (gasLimitMove, gasLimitProcess uint64)

SplitTxGasInCategories returns the gas split per categories

func (TestEconomicsData) SplitTxGasInCategoriesInEpoch added in v1.7.0

func (ed TestEconomicsData) SplitTxGasInCategoriesInEpoch(tx data.TransactionWithFeeHandler, epoch uint32) (gasLimitMove, gasLimitProcess uint64)

SplitTxGasInCategoriesInEpoch returns the gas split per categories in a specific epoch

Jump to

Keyboard shortcuts

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