Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeGasOverestimationBurn ¶
ComputeGasOverestimationBurn computes amount of gas to be refunded and amount of gas to be burned Result is (refund, burn)
Types ¶
type GasCharge ¶
type GasCharge struct { Name string Extra interface{} ComputeGas int64 StorageGas int64 VirtualCompute int64 VirtualStorage int64 }
GasCharge amount of gas consumed at one time
func (GasCharge) WithVirtual ¶
type GasOutputs ¶
type GasOutputs struct { BaseFeeBurn abi.TokenAmount OverEstimationBurn abi.TokenAmount MinerPenalty abi.TokenAmount MinerTip abi.TokenAmount Refund abi.TokenAmount GasRefund int64 GasBurned int64 }
GasOutputs detail of gas after message executed
func ComputeGasOutputs ¶
func ComputeGasOutputs(gasUsed, gasLimit int64, baseFee, feeCap, gasPremium abi.TokenAmount, chargeNetworkFee bool) GasOutputs
ComputeGasOutputs compute gas outputs base on message gas parameters and gasUsed after executed
func ZeroGasOutputs ¶
func ZeroGasOutputs() GasOutputs
ZeroGasOutputs returns a logically zeroed GasOutputs.
type GasTracker ¶
type GasTracker struct { GasAvailable int64 GasUsed int64 ExecutionTrace types2.ExecutionTrace NumActorsCreated uint64 //nolint AllowInternal bool //nolint CallerValidated bool //nolint LastGasChargeTime time.Time //nolint LastGasCharge *types2.GasTrace }
GasTracker maintains the stateView of gas usage throughout the execution of a message.
func NewGasTracker ¶
func NewGasTracker(limit int64) *GasTracker
NewGasTracker initializes a new empty gas tracker
func (*GasTracker) Charge ¶
func (t *GasTracker) Charge(gas GasCharge, msg string, args ...interface{})
Charge will add the gas charge To the current Method gas context.
WARNING: this Method will panic if there is no sufficient gas left.
func (*GasTracker) TryCharge ¶
func (t *GasTracker) TryCharge(gasCharge GasCharge) bool
TryCharge charges `amount` or `RemainingGas()“, whichever is smaller.
Returns `True` if the there was enough gas To pay for `amount`.
type Pricelist ¶
type Pricelist interface { // OnChainMessage returns the gas used for storing a message of a given size in the chain. OnChainMessage(msgSize int) GasCharge // OnChainReturnValue returns the gas used for storing the response of a message in the chain. OnChainReturnValue(dataSize int) GasCharge // OnMethodInvocation returns the gas used when invoking a method. OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) GasCharge // OnIpldGet returns the gas used for storing an object OnIpldGet() GasCharge // OnIpldPut returns the gas used for storing an object OnIpldPut(dataSize int) GasCharge // OnCreateActor returns the gas used for creating an actor OnCreateActor() GasCharge // OnDeleteActor returns the gas used for deleting an actor OnDeleteActor() GasCharge OnVerifySignature(sigType crypto.SigType, planTextSize int) (GasCharge, error) OnHashing(dataSize int) GasCharge OnComputeUnsealedSectorCid(proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) GasCharge OnVerifySeal(info proof5.SealVerifyInfo) GasCharge OnVerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProofAndInfos) GasCharge OnVerifyPost(info proof5.WindowPoStVerifyInfo) GasCharge OnVerifyConsensusFault() GasCharge }
Pricelist provides prices for operations in the VM.
Note: this interface should be APPEND ONLY since last chain checkpoint
type PricesSchedule ¶
type PricesSchedule struct {
// contains filtered or unexported fields
}
PricesSchedule schedule gas prices for different network version
func NewPricesSchedule ¶
func NewPricesSchedule(forkParams *config.ForkUpgradeConfig) *PricesSchedule
NewPricesSchedule new gasprice schedule from forkParams parameters
func (*PricesSchedule) PricelistByEpoch ¶
func (schedule *PricesSchedule) PricelistByEpoch(epoch abi.ChainEpoch) Pricelist
PricelistByEpoch finds the latest prices for the given epoch