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 (ted *TestEconomicsData) SetStatusHandler(_ 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 ¶
func NewAPIEconomicsData(data *economicsData) (*apiEconomicsData, error)
NewAPIEconomicsData will create a wrapped object over the provided economics data
func NewBuiltInFunctionsCost ¶
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 ¶
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 ¶
type ArgsNewEconomicsData struct { BuiltInFunctionsCostHandler BuiltInFunctionsCostHandler Economics *config.EconomicsConfig EpochNotifier process.EpochNotifier EnableEpochsHandler common.EnableEpochsHandler }
ArgsNewEconomicsData defines the arguments needed for new economics economicsData
type BuiltInFunctionsCostHandler ¶
type BuiltInFunctionsCostHandler interface { ComputeBuiltInCost(tx data.TransactionWithFeeHandler) uint64 IsBuiltInFuncCall(tx data.TransactionWithFeeHandler) bool IsInterfaceNil() bool }
BuiltInFunctionsCostHandler is able to calculate the cost of a built-in function call
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) 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) 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) 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) ComputeMoveBalanceFee ¶
func (ed TestEconomicsData) ComputeMoveBalanceFee(tx data.TransactionWithFeeHandler) *big.Int
ComputeMoveBalanceFee computes the provided transaction's 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) DeveloperPercentage ¶
func (ed TestEconomicsData) DeveloperPercentage() float64
DeveloperPercentage will return the developer percentage value
func (TestEconomicsData) EpochConfirmed ¶
EpochConfirmed is called whenever a new epoch is confirmed
func (TestEconomicsData) GasPerDataByte ¶
func (ed TestEconomicsData) GasPerDataByte() uint64
GasPerDataByte will return 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) GasPriceModifier ¶
func (ed TestEconomicsData) GasPriceModifier() float64
GasPriceModifier will return the gas price modifier
func (TestEconomicsData) GenesisTotalSupply ¶
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 ¶
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 will return leader reward percentage
func (TestEconomicsData) MaxGasLimitPerBlock ¶
MaxGasLimitPerBlock will return maximum gas limit allowed per block
func (TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard ¶
func (ed TestEconomicsData) MaxGasLimitPerBlockForSafeCrossShard() uint64
MaxGasLimitPerBlockForSafeCrossShard will return maximum gas limit per block for safe cross shard
func (TestEconomicsData) MaxGasLimitPerMiniBlock ¶
MaxGasLimitPerMiniBlock will return maximum gas limit allowed per mini block
func (TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard ¶
func (ed TestEconomicsData) MaxGasLimitPerMiniBlockForSafeCrossShard() uint64
MaxGasLimitPerMiniBlockForSafeCrossShard will return maximum gas limit per mini block for safe cross shard
func (TestEconomicsData) MaxGasLimitPerTx ¶
func (ed TestEconomicsData) MaxGasLimitPerTx() uint64
MaxGasLimitPerTx will return maximum gas limit per tx
func (TestEconomicsData) MaxInflationRate ¶
MaxInflationRate will return the maximum inflation rate
func (TestEconomicsData) MinGasLimit ¶
func (ed TestEconomicsData) MinGasLimit() uint64
MinGasLimit will return min gas limit
func (TestEconomicsData) MinGasPrice ¶
func (ed TestEconomicsData) MinGasPrice() uint64
MinGasPrice will return 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 will return the minimum inflation rate
func (TestEconomicsData) ProtocolSustainabilityAddress ¶
func (ed TestEconomicsData) ProtocolSustainabilityAddress() string
ProtocolSustainabilityAddress will return the protocol sustainability address
func (TestEconomicsData) ProtocolSustainabilityPercentage ¶
func (ed TestEconomicsData) ProtocolSustainabilityPercentage() float64
ProtocolSustainabilityPercentage will return the protocol sustainability percentage value
func (TestEconomicsData) RewardsTopUpFactor ¶
func (ed TestEconomicsData) RewardsTopUpFactor() float64
RewardsTopUpFactor returns the rewards top-up factor
func (TestEconomicsData) RewardsTopUpGradientPoint ¶
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 ¶
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 ¶
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) SplitTxGasInCategories ¶
func (ed TestEconomicsData) SplitTxGasInCategories(tx data.TransactionWithFeeHandler) (gasLimitMove, gasLimitProcess uint64)
SplitTxGasInCategories returns the gas split per categories