gasutils

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSpendOnFeeDenom = 100
View Source
const MinGasPremium = 100e3

Variables

This section is empty.

Functions

func GasEstimateCallWithGas

func GasEstimateCallWithGas(
	ctx context.Context,
	cstore ChainStoreAPI,
	smgr StateManagerAPI,
	mpool MessagePoolAPI,
	msgIn *types.Message,
	currTs *types.TipSet,
) (*api.InvocResult, []types.ChainMsg, *types.TipSet, error)

GasEstimateCallWithGas invokes a message "msgIn" on the earliest available tipset with pending messages in the message pool. The function returns the result of the message invocation, the pending messages, the tipset used for the invocation, and an error if occurred. The returned information can be used to make subsequent calls to CallWithGas with the same parameters.

func GasEstimateFeeCap

func GasEstimateFeeCap(cstore ChainStoreAPI, msg *types.Message, maxqueueblks int64) (types.BigInt, error)

func GasEstimateGasLimit

func GasEstimateGasLimit(
	ctx context.Context,
	cstore ChainStoreAPI,
	smgr StateManagerAPI,
	mpool *messagepool.MessagePool,
	msgIn *types.Message,
	currTs *types.TipSet,
) (int64, error)

func GasEstimateGasPremium

func GasEstimateGasPremium(ctx context.Context, cstore ChainStoreAPI, cache *GasPriceCache, nblocksincl uint64) (types.BigInt, error)

Types

type ChainStoreAPI

type ChainStoreAPI interface {
	GetHeaviestTipSet() *types.TipSet
	GetTipSetFromKey(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
	LoadTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
	MessagesForTipset(ctx context.Context, ts *types.TipSet) ([]types.ChainMsg, error)
}

type GasMeta

type GasMeta struct {
	Price big.Int
	Limit int64
}

type GasPriceCache

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

func NewGasPriceCache

func NewGasPriceCache() *GasPriceCache

func (*GasPriceCache) GetTSGasStats

func (g *GasPriceCache) GetTSGasStats(ctx context.Context, cstore ChainStoreAPI, ts *types.TipSet) ([]GasMeta, error)

type MessagePoolAPI

type MessagePoolAPI interface {
	PendingFor(ctx context.Context, a address.Address) ([]*types.SignedMessage, *types.TipSet)
}

type StateManagerAPI

type StateManagerAPI interface {
	ParentState(ts *types.TipSet) (*state.StateTree, error)
	CallWithGas(ctx context.Context, msg *types.Message, priorMsgs []types.ChainMsg, ts *types.TipSet, applyTsMessages bool) (*api.InvocResult, error)
	ResolveToDeterministicAddress(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error)
}

Jump to

Keyboard shortcuts

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