Documentation ¶
Index ¶
- Constants
- Variables
- func CapGasFee(mff DefaultMaxFeeFunc, msg *types.Message, sendSepc *types.MessageSendSpec)
- func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount
- type DefaultMaxFeeFunc
- type GasMeta
- type GasPriceCache
- type MessagePool
- func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error
- func (mp *MessagePool) CheckMessages(ctx context.Context, protos []*types.MessagePrototype) ([][]types.MessageCheckStatus, error)
- func (mp *MessagePool) CheckPendingMessages(ctx context.Context, from address.Address) ([][]types.MessageCheckStatus, error)
- func (mp *MessagePool) CheckReplaceMessages(ctx context.Context, replace []*types.Message) ([][]types.MessageCheckStatus, error)
- func (mp *MessagePool) Clear(ctx context.Context, local bool)
- func (mp *MessagePool) Close() error
- func (mp *MessagePool) DeleteByAdress(address address.Address) error
- func (mp *MessagePool) GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*types.EstimateMessage, ...) ([]*types.EstimateResult, error)
- func (mp *MessagePool) GasEstimateCallWithGas(ctx context.Context, msgIn *types.Message, currTS *types.TipSet) (*types.InvocResult, []types.ChainMsg, *types.TipSet, error)
- func (mp *MessagePool) GasEstimateFeeCap(ctx context.Context, msg *types.Message, maxqueueblks int64, ...) (big.Int, error)
- func (mp *MessagePool) GasEstimateGasLimit(ctx context.Context, msgIn *types.Message, tsk types.TipSetKey) (int64, error)
- func (mp *MessagePool) GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, ...) (big.Int, error)
- func (mp *MessagePool) GasEstimateMessageGas(ctx context.Context, estimateMessage *types.EstimateMessage, _ types.TipSetKey) (*types.Message, error)
- func (mp *MessagePool) GetActor(ctx context.Context, addr address.Address, _ types.TipSetKey) (*types.Actor, error)
- func (mp *MessagePool) GetConfig() *MpoolConfig
- func (mp *MessagePool) GetNonce(ctx context.Context, addr address.Address, _ types.TipSetKey) (uint64, error)
- func (mp *MessagePool) HeadChange(ctx context.Context, revert []*types.TipSet, apply []*types.TipSet) error
- func (mp *MessagePool) MessagesForBlocks(ctx context.Context, blks []*types.BlockHeader) ([]*types.SignedMessage, error)
- func (mp *MessagePool) MultipleSelectMessages(ctx context.Context, ts *types.TipSet, tqs []float64) (msgss [][]*types.SignedMessage, err error)
- func (mp *MessagePool) Pending(ctx context.Context) ([]*types.SignedMessage, *types.TipSet)
- func (mp *MessagePool) PendingFor(ctx context.Context, a address.Address) ([]*types.SignedMessage, *types.TipSet)
- func (mp *MessagePool) Prune()
- func (mp *MessagePool) PublishMsg(ctx context.Context, smsg *types.SignedMessage) error
- func (mp *MessagePool) PublishMsgForWallet(ctx context.Context, addr address.Address) error
- func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Cid, error)
- func (mp *MessagePool) PushUntrusted(ctx context.Context, m *types.SignedMessage) (cid.Cid, error)
- func (mp *MessagePool) RecoverSig(msg *types.Message) *types.SignedMessage
- func (mp *MessagePool) Remove(ctx context.Context, from address.Address, nonce uint64, applied bool)
- func (mp *MessagePool) SelectMessages(ctx context.Context, ts *types.TipSet, tq float64) ([]*types.SignedMessage, error)
- func (mp *MessagePool) SetConfig(ctx context.Context, cfg *MpoolConfig) error
- func (mp *MessagePool) Updates(ctx context.Context) (<-chan types.MpoolUpdate, error)
- func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error
- type MessagePoolEvt
- type MessagePoolEvtMessage
- type MessageSigner
- type MpoolConfig
- type MpoolLocker
- type MpoolNonceAPI
- type Provider
Constants ¶
const MaxBlocks = 15
const MaxMessageSize = 64 << 10 // 64KiB
const MinGasPremium = 100e3
const RbfDenom = 256
Variables ¶
var ( ReplaceByFeeRatioDefault = 1.25 MemPoolSizeLimitHiDefault = 30000 MemPoolSizeLimitLoDefault = 20000 PruneCooldownDefault = time.Minute GasLimitOverestimation = 1.25 ConfigKey = datastore.NewKey("/mpool/config") )
var ( MaxActorPendingMessages = 1000 MaxUntrustedActorPendingMessages = 10 )
var ( ErrMessageTooBig = errors.New("message too big") ErrMessageValueTooHigh = errors.New("cannot send more filecoin than will ever exist") ErrNonceTooLow = errors.New("message nonce too low") ErrGasFeeCapTooLow = errors.New("gas fee cap too low") ErrNotEnoughFunds = errors.New("not enough funds to execute transaction") ErrInvalidToAddr = errors.New("message had invalid to address") ErrSoftValidationFailure = errors.New("validation failure") ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") ErrTooManyPendingMessages = errors.New("too many pending messages for actor") ErrNonceGap = errors.New("unfulfilled nonce gap") )
var ( HeadChangeCoalesceMinDelay = 2 * time.Second HeadChangeCoalesceMaxDelay = 6 * time.Second HeadChangeCoalesceMergeInterval = time.Second )
var MaxNonceGap = uint64(4)
var RepublishBatchDelay = 100 * time.Millisecond
var RepublishInterval time.Duration
Functions ¶
func CapGasFee ¶
func CapGasFee(mff DefaultMaxFeeFunc, msg *types.Message, sendSepc *types.MessageSendSpec)
func ComputeMinRBF ¶
func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount
Types ¶
type DefaultMaxFeeFunc ¶
type DefaultMaxFeeFunc func() (abi.TokenAmount, error)
type GasPriceCache ¶ added in v0.9.7
type GasPriceCache struct {
// contains filtered or unexported fields
}
func NewGasPriceCache ¶ added in v0.9.7
func NewGasPriceCache() *GasPriceCache
func (*GasPriceCache) GetTSGasStats ¶ added in v0.9.7
type MessagePool ¶
type MessagePool struct { GetMaxFee DefaultMaxFeeFunc PriceCache *GasPriceCache // contains filtered or unexported fields }
func New ¶
func New(ctx context.Context, api Provider, sm *statemanger.Stmgr, ds repo.Datastore, networkParams *config.NetworkParamsConfig, mpoolCfg *config.MessagePoolConfig, netName string, j journal.Journal, ) (*MessagePool, error)
func (*MessagePool) Add ¶
func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error
func (*MessagePool) CheckMessages ¶ added in v0.9.7
func (mp *MessagePool) CheckMessages(ctx context.Context, protos []*types.MessagePrototype) ([][]types.MessageCheckStatus, error)
CheckMessages performs a set of logic checks for a list of messages, prior to submitting it to the mpool
func (*MessagePool) CheckPendingMessages ¶ added in v0.9.7
func (mp *MessagePool) CheckPendingMessages(ctx context.Context, from address.Address) ([][]types.MessageCheckStatus, error)
CheckPendingMessages performs a set of logical sets for all messages pending from a given actor
func (*MessagePool) CheckReplaceMessages ¶ added in v0.9.7
func (mp *MessagePool) CheckReplaceMessages(ctx context.Context, replace []*types.Message) ([][]types.MessageCheckStatus, error)
CheckReplaceMessages performs a set of logical checks for related messages while performing a replacement.
func (*MessagePool) Close ¶
func (mp *MessagePool) Close() error
func (*MessagePool) DeleteByAdress ¶
func (mp *MessagePool) DeleteByAdress(address address.Address) error
func (*MessagePool) GasBatchEstimateMessageGas ¶ added in v0.9.7
func (mp *MessagePool) GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*types.EstimateMessage, fromNonce uint64, tsk types.TipSetKey) ([]*types.EstimateResult, error)
func (*MessagePool) GasEstimateCallWithGas ¶ added in v1.10.0
func (mp *MessagePool) GasEstimateCallWithGas( ctx context.Context, msgIn *types.Message, currTS *types.TipSet, ) (*types.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 (*MessagePool) GasEstimateFeeCap ¶
func (*MessagePool) GasEstimateGasLimit ¶
func (*MessagePool) GasEstimateGasPremium ¶
func (*MessagePool) GasEstimateMessageGas ¶
func (mp *MessagePool) GasEstimateMessageGas(ctx context.Context, estimateMessage *types.EstimateMessage, _ types.TipSetKey) (*types.Message, error)
func (*MessagePool) GetActor ¶ added in v0.9.7
func (mp *MessagePool) GetActor(ctx context.Context, addr address.Address, _ types.TipSetKey) (*types.Actor, error)
GetActor should not be used. It is only here to satisfy interface mess caused by lite node handling
func (*MessagePool) GetConfig ¶
func (mp *MessagePool) GetConfig() *MpoolConfig
func (*MessagePool) HeadChange ¶
func (*MessagePool) MessagesForBlocks ¶
func (mp *MessagePool) MessagesForBlocks(ctx context.Context, blks []*types.BlockHeader) ([]*types.SignedMessage, error)
func (*MessagePool) MultipleSelectMessages ¶ added in v0.9.4
func (mp *MessagePool) MultipleSelectMessages(ctx context.Context, ts *types.TipSet, tqs []float64) (msgss [][]*types.SignedMessage, err error)
select the message multiple times and try not to repeat it each time
func (*MessagePool) Pending ¶
func (mp *MessagePool) Pending(ctx context.Context) ([]*types.SignedMessage, *types.TipSet)
func (*MessagePool) PendingFor ¶
func (mp *MessagePool) PendingFor(ctx context.Context, a address.Address) ([]*types.SignedMessage, *types.TipSet)
func (*MessagePool) Prune ¶
func (mp *MessagePool) Prune()
func (*MessagePool) PublishMsg ¶ added in v0.9.6
func (mp *MessagePool) PublishMsg(ctx context.Context, smsg *types.SignedMessage) error
func (*MessagePool) PublishMsgForWallet ¶
func (mp *MessagePool) PublishMsgForWallet(ctx context.Context, addr address.Address) error
func (*MessagePool) Push ¶
func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Cid, error)
func (*MessagePool) PushUntrusted ¶
func (mp *MessagePool) PushUntrusted(ctx context.Context, m *types.SignedMessage) (cid.Cid, error)
this method is provided for the gateway to push messages. differences from Push:
- strict checks are enabled
- extra strict add checks are used when adding the messages to the msgSet that means: no nonce gaps, at most 10 pending messages for the actor
func (*MessagePool) RecoverSig ¶
func (mp *MessagePool) RecoverSig(msg *types.Message) *types.SignedMessage
func (*MessagePool) Remove ¶
func (mp *MessagePool) Remove(ctx context.Context, from address.Address, nonce uint64, applied bool)
func (*MessagePool) SelectMessages ¶
func (mp *MessagePool) SelectMessages(ctx context.Context, ts *types.TipSet, tq float64) ([]*types.SignedMessage, error)
func (*MessagePool) SetConfig ¶
func (mp *MessagePool) SetConfig(ctx context.Context, cfg *MpoolConfig) error
func (*MessagePool) Updates ¶
func (mp *MessagePool) Updates(ctx context.Context) (<-chan types.MpoolUpdate, error)
func (*MessagePool) VerifyMsgSig ¶
func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error
type MessagePoolEvt ¶
type MessagePoolEvt struct { Action string Messages []MessagePoolEvtMessage Error error `json:",omitempty"` }
MessagePoolEvt is the journal entry for message pool events.
type MessagePoolEvtMessage ¶
type MessageSigner ¶ added in v1.1.0
type MessageSigner struct {
// contains filtered or unexported fields
}
MessageSigner keeps track of nonces per address, and increments the nonce when signing a message
func NewMessageSigner ¶ added in v1.1.0
func NewMessageSigner(wallet wallet.WalletIntersection, mpool MpoolNonceAPI, ds datastore.Batching) *MessageSigner
func (*MessageSigner) SignMessage ¶ added in v1.1.0
func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, cb func(*types.SignedMessage) error) (*types.SignedMessage, error)
SignMessage increments the nonce for the message From address, and signs the message
type MpoolConfig ¶
type MpoolConfig struct { PriorityAddrs []address.Address SizeLimitHigh int SizeLimitLow int ReplaceByFeeRatio float64 PruneCooldown time.Duration GasLimitOverestimation float64 }
func DefaultConfig ¶
func DefaultConfig() *MpoolConfig
func (*MpoolConfig) Clone ¶
func (mc *MpoolConfig) Clone() *MpoolConfig
type MpoolLocker ¶
type MpoolLocker struct {
// contains filtered or unexported fields
}
func NewMpoolLocker ¶
func NewMpoolLocker() *MpoolLocker
type MpoolNonceAPI ¶ added in v1.1.0
type Provider ¶
type Provider interface { ChainHead(ctx context.Context) (*types.TipSet, error) ChainTipSet(context.Context, types.TipSetKey) (*types.TipSet, error) SubscribeHeadChanges(context.Context, func(rev, app []*types.TipSet) error) *types.TipSet PutMessage(context.Context, types.ChainMsg) (cid.Cid, error) PubSubPublish(context.Context, string, []byte) error GetActorAfter(context.Context, address.Address, *types.TipSet) (*types.Actor, error) StateAccountKeyAtFinality(context.Context, address.Address, *types.TipSet) (address.Address, error) StateNetworkVersion(context.Context, abi.ChainEpoch) network.Version StateAccountKey(context.Context, address.Address, *types.TipSet) (address.Address, error) MessagesForBlock(context.Context, *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) MessagesForTipset(context.Context, *types.TipSet) ([]types.ChainMsg, error) LoadTipSet(context.Context, types.TipSetKey) (*types.TipSet, error) ChainComputeBaseFee(ctx context.Context, ts *types.TipSet) (tbig.Int, error) IsLite() bool }
func NewProvider ¶
func NewProvider(sm *statemanger.Stmgr, cs *chain.Store, cms *chain.MessageStore, cfg *config.NetworkParamsConfig, ps *pubsub.PubSub) Provider