Documentation ¶
Index ¶
- func NewAPIEconomicsData(data *economicsData) (*apiEconomicsData, error)
- func NewBuiltInFunctionsCost(args *ArgsBuiltInFunctionCost) (*builtInFunctionsCost, error)
- func NewEconomicsData(args ArgsNewEconomicsData) (*economicsData, error)
- type ArgsBuiltInFunctionCost
- type ArgsNewEconomicsData
- type BuiltInFunctionsCostHandler
- type EpochNotifier
- type TestEconomicsData
- func (ed TestEconomicsData) CheckValidityTxValues(tx data.TransactionWithFeeHandler) error
- func (ed TestEconomicsData) ComputeFeeForProcessing(tx data.TransactionWithFeeHandler, gasToUse uint64) *big.Int
- func (ed TestEconomicsData) ComputeGasLimit(tx data.TransactionWithFeeHandler) uint64
- func (ed TestEconomicsData) ComputeGasLimitBasedOnBalance(tx data.TransactionWithFeeHandler, balance *big.Int) (uint64, error)
- func (ed TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValue(tx data.TransactionWithFeeHandler, refundValue *big.Int) (uint64, *big.Int)
- func (ed TestEconomicsData) ComputeMoveBalanceFee(tx data.TransactionWithFeeHandler) *big.Int
- func (ed TestEconomicsData) ComputeTxFee(tx data.TransactionWithFeeHandler) *big.Int
- func (ed TestEconomicsData) ComputeTxFeeBasedOnGasUsed(tx data.TransactionWithFeeHandler, gasUsed uint64) *big.Int
- func (ed TestEconomicsData) DeveloperPercentage() float64
- func (ed TestEconomicsData) EpochConfirmed(epoch uint32, _ uint64)
- func (ed TestEconomicsData) GasPerDataByte() uint64
- func (ed TestEconomicsData) GasPriceForMove(tx data.TransactionWithFeeHandler) uint64
- func (ed TestEconomicsData) GasPriceForProcessing(tx data.TransactionWithFeeHandler) uint64
- func (ed TestEconomicsData) GasPriceModifier() float64
- func (ed TestEconomicsData) GenesisTotalSupply() *big.Int
- func (ted *TestEconomicsData) GetMinGasLimit() uint64
- func (ted *TestEconomicsData) GetMinGasPrice() uint64
- func (ed TestEconomicsData) IsInterfaceNil() bool
- func (ed TestEconomicsData) LeaderPercentage() float64
- func (ed TestEconomicsData) MaxGasLimitPerBlock(shardID uint32) uint64
- func (ed TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard() uint64
- func (ed TestEconomicsData) MaxGasLimitPerMiniBlock(shardID uint32) uint64
- func (ed TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard() uint64
- func (ed TestEconomicsData) MaxGasLimitPerTx() uint64
- func (ed TestEconomicsData) MaxInflationRate(year uint32) float64
- func (ed TestEconomicsData) MinGasLimit() uint64
- func (ed TestEconomicsData) MinGasPrice() uint64
- func (ed TestEconomicsData) MinGasPriceForProcessing() uint64
- func (ed TestEconomicsData) MinInflationRate() float64
- func (ed TestEconomicsData) ProtocolSustainabilityAddress() string
- func (ed TestEconomicsData) ProtocolSustainabilityPercentage() float64
- func (ed TestEconomicsData) RewardsTopUpFactor() float64
- func (ed TestEconomicsData) RewardsTopUpGradientPoint() *big.Int
- func (ted *TestEconomicsData) SetGasPerDataByte(gasPerDataByte uint64)
- func (ted *TestEconomicsData) SetMaxGasLimitPerBlock(maxGasLimitPerBlock uint64)
- func (ted *TestEconomicsData) SetMaxInflationRate(maximumInflation float64)
- func (ted *TestEconomicsData) SetMinGasLimit(minGasLimit uint64)
- func (ted *TestEconomicsData) SetMinGasPrice(minGasPrice uint64)
- func (ed TestEconomicsData) SetStatusHandler(statusHandler core.AppStatusHandler) error
- func (ted *TestEconomicsData) SetTotalSupply(totalSupply *big.Int)
- func (ed TestEconomicsData) SplitTxGasInCategories(tx data.TransactionWithFeeHandler) (gasLimitMove, gasLimitProcess uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAPIEconomicsData ¶ added in v1.3.0
func NewAPIEconomicsData(data *economicsData) (*apiEconomicsData, error)
NewAPIEconomicsData will create a wrapped object over the provided economics data
func NewBuiltInFunctionsCost ¶ added in v1.1.46
func NewBuiltInFunctionsCost(args *ArgsBuiltInFunctionCost) (*builtInFunctionsCost, error)
NewBuiltInFunctionsCost will create a new instance of builtInFunctionsCost
func NewEconomicsData ¶
func NewEconomicsData(args ArgsNewEconomicsData) (*economicsData, error)
NewEconomicsData will create an object with information about economics parameters
Types ¶
type ArgsBuiltInFunctionCost ¶ added in v1.1.46
type ArgsBuiltInFunctionCost struct { GasSchedule core.GasScheduleNotifier ArgsParser process.ArgumentsParser }
ArgsBuiltInFunctionCost holds all components that are needed to create a new instance of builtInFunctionsCost
type ArgsNewEconomicsData ¶ added in v1.1.1
type ArgsNewEconomicsData struct { BuiltInFunctionsCostHandler BuiltInFunctionsCostHandler Economics *config.EconomicsConfig EpochNotifier EpochNotifier PenalizedTooMuchGasEnableEpoch uint32 GasPriceModifierEnableEpoch uint32 }
ArgsNewEconomicsData defines the arguments needed for new economics economicsData
type BuiltInFunctionsCostHandler ¶ added in v1.1.46
type BuiltInFunctionsCostHandler interface { ComputeBuiltInCost(tx data.TransactionWithFeeHandler) uint64 IsBuiltInFuncCall(tx data.TransactionWithFeeHandler) bool IsInterfaceNil() bool }
BuiltInFunctionsCostHandler is able to calculated the cost of a built in function call
type EpochNotifier ¶ added in v1.3.37
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 ¶ added in v1.1.15
func NewTestEconomicsData(internalData *economicsData) *TestEconomicsData
NewTestEconomicsData -
func (TestEconomicsData) CheckValidityTxValues ¶ added in v1.1.15
func (ed TestEconomicsData) CheckValidityTxValues(tx data.TransactionWithFeeHandler) error
CheckValidityTxValues checks if the provided transaction is economically correct
func (TestEconomicsData) ComputeFeeForProcessing ¶ added in v1.1.15
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) ComputeGasLimit ¶ added in v1.1.15
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 ¶ added in v1.2.4
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) ComputeGasUsedAndFeeBasedOnRefundValue ¶ added in v1.1.18
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) ComputeMoveBalanceFee ¶ added in v1.1.15
func (ed TestEconomicsData) ComputeMoveBalanceFee(tx data.TransactionWithFeeHandler) *big.Int
ComputeMoveBalanceFee computes the provided transaction's fee
func (TestEconomicsData) ComputeTxFee ¶ added in v1.1.15
func (ed TestEconomicsData) ComputeTxFee(tx data.TransactionWithFeeHandler) *big.Int
ComputeTxFee computes the provided transaction's fee using enable from epoch approach
func (TestEconomicsData) ComputeTxFeeBasedOnGasUsed ¶ added in v1.1.18
func (ed TestEconomicsData) ComputeTxFeeBasedOnGasUsed(tx data.TransactionWithFeeHandler, gasUsed uint64) *big.Int
ComputeTxFeeBasedOnGasUsed will compute transaction fee
func (TestEconomicsData) DeveloperPercentage ¶ added in v1.1.15
func (ed TestEconomicsData) DeveloperPercentage() float64
DeveloperPercentage will return the developer percentage value
func (TestEconomicsData) EpochConfirmed ¶ added in v1.1.15
EpochConfirmed is called whenever a new epoch is confirmed
func (TestEconomicsData) GasPerDataByte ¶ added in v1.1.15
func (ed TestEconomicsData) GasPerDataByte() uint64
GasPerDataByte will return the gas required for a economicsData byte
func (TestEconomicsData) GasPriceForMove ¶ added in v1.1.15
func (ed TestEconomicsData) GasPriceForMove(tx data.TransactionWithFeeHandler) uint64
GasPriceForMove returns the gas price for transferring funds
func (TestEconomicsData) GasPriceForProcessing ¶ added in v1.1.15
func (ed TestEconomicsData) GasPriceForProcessing(tx data.TransactionWithFeeHandler) uint64
GasPriceForProcessing computes the price for the gas in addition to balance movement and data
func (TestEconomicsData) GasPriceModifier ¶ added in v1.1.15
func (ed TestEconomicsData) GasPriceModifier() float64
GasPriceModifier will return the gas price modifier
func (TestEconomicsData) GenesisTotalSupply ¶ added in v1.1.15
GenesisTotalSupply will return the genesis total supply
func (*TestEconomicsData) GetMinGasLimit ¶
func (ted *TestEconomicsData) GetMinGasLimit() 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 ¶ added in v1.1.15
func (ed TestEconomicsData) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (TestEconomicsData) LeaderPercentage ¶ added in v1.1.15
func (ed TestEconomicsData) LeaderPercentage() float64
LeaderPercentage will return leader reward percentage
func (TestEconomicsData) MaxGasLimitPerBlock ¶ added in v1.1.15
MaxGasLimitPerBlock will return maximum gas limit allowed per block
func (TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard ¶ added in v1.2.23
func (ed TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard() uint64
MaxGasLimitPerBlockForSafeCrossShard will return maximum gas limit per block for safe cross shard
func (TestEconomicsData) MaxGasLimitPerMiniBlock ¶ added in v1.2.23
MaxGasLimitPerMiniBlock will return maximum gas limit allowed per mini block
func (TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard ¶ added in v1.2.23
func (ed TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard() uint64
MaxGasLimitPerMiniBlockForSafeCrossShard will return maximum gas limit per mini block for safe cross shard
func (TestEconomicsData) MaxGasLimitPerTx ¶ added in v1.3.0
func (ed TestEconomicsData) MaxGasLimitPerTx() uint64
MaxGasLimitPerTx will return maximum gas limit per tx
func (TestEconomicsData) MaxInflationRate ¶ added in v1.1.15
MaxInflationRate will return the maximum inflation rate
func (TestEconomicsData) MinGasLimit ¶ added in v1.1.15
func (ed TestEconomicsData) MinGasLimit() uint64
MinGasLimit will return min gas limit
func (TestEconomicsData) MinGasPrice ¶ added in v1.1.15
func (ed TestEconomicsData) MinGasPrice() uint64
MinGasPrice will return min gas price
func (TestEconomicsData) MinGasPriceForProcessing ¶ added in v1.1.15
func (ed TestEconomicsData) MinGasPriceForProcessing() uint64
MinGasPriceForProcessing returns the minimum allowed gas price for processing
func (TestEconomicsData) MinInflationRate ¶ added in v1.1.15
func (ed TestEconomicsData) MinInflationRate() float64
MinInflationRate will return the minimum inflation rate
func (TestEconomicsData) ProtocolSustainabilityAddress ¶ added in v1.1.15
func (ed TestEconomicsData) ProtocolSustainabilityAddress() string
ProtocolSustainabilityAddress will return the protocol sustainability address
func (TestEconomicsData) ProtocolSustainabilityPercentage ¶ added in v1.1.15
func (ed TestEconomicsData) ProtocolSustainabilityPercentage() float64
ProtocolSustainabilityPercentage will return the protocol sustainability percentage value
func (TestEconomicsData) RewardsTopUpFactor ¶ added in v1.1.15
func (ed TestEconomicsData) RewardsTopUpFactor() float64
RewardsTopUpFactor returns the rewards top-up factor
func (TestEconomicsData) RewardsTopUpGradientPoint ¶ added in v1.1.15
RewardsTopUpGradientPoint returns the rewards top-up gradient point
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)
SetMaxGasLimitPerBlock sets the maximum gas limit allowed per one block
func (*TestEconomicsData) SetMaxInflationRate ¶ added in v1.1.15
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)
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 ¶ added in v1.1.28
func (ed TestEconomicsData) SetStatusHandler(statusHandler core.AppStatusHandler) error
SetStatusHandler will set the provided status handler if not nil
func (*TestEconomicsData) SetTotalSupply ¶ added in v1.0.115
func (ted *TestEconomicsData) SetTotalSupply(totalSupply *big.Int)
SetTotalSupply sets the total supply when booting the network
func (TestEconomicsData) SplitTxGasInCategories ¶ added in v1.1.15
func (ed TestEconomicsData) SplitTxGasInCategories(tx data.TransactionWithFeeHandler) (gasLimitMove, gasLimitProcess uint64)
SplitTxGasInCategories returns the gas split per categories