Documentation ¶
Index ¶
- Constants
- Variables
- func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, ...)
- func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount
- func ComputeRBF(curPrem abi.TokenAmount, replaceByFeeRatio types.Percent) abi.TokenAmount
- func DefaultConfig() *types.MpoolConfig
- type MessagePool
- func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error
- func (mp *MessagePool) CheckMessages(ctx context.Context, protos []*api.MessagePrototype) ([][]api.MessageCheckStatus, error)
- func (mp *MessagePool) CheckPendingMessages(ctx context.Context, from address.Address) ([][]api.MessageCheckStatus, error)
- func (mp *MessagePool) CheckReplaceMessages(ctx context.Context, replace []*types.Message) ([][]api.MessageCheckStatus, error)
- func (mp *MessagePool) Clear(ctx context.Context, local bool)
- func (mp *MessagePool) Close() error
- func (mp *MessagePool) ForEachPendingMessage(f func(cid.Cid) error) error
- func (mp *MessagePool) GetActor(_ context.Context, addr address.Address, _ types.TipSetKey) (*types.Actor, error)
- func (mp *MessagePool) GetConfig() *types.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) 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) Push(ctx context.Context, m *types.SignedMessage, publish bool) (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 *types.MpoolConfig) error
- func (mp *MessagePool) Updates(ctx context.Context) (<-chan api.MpoolUpdate, error)
- func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error
- type MessagePoolEvt
- type MessagePoolEvtMessage
- type MpoolNonceAPI
- type Provider
Constants ¶
const MaxBlocks = 15
const MaxMessageSize = 64 << 10 // 64KiB
Variables ¶
var ( ReplaceByFeePercentageMinimum types.Percent = 110 ReplaceByFeePercentageDefault types.Percent = 125 )
var ( MemPoolSizeLimitHiDefault = 30000 MemPoolSizeLimitLoDefault = 20000 PruneCooldownDefault = time.Minute GasLimitOverestimation = 1.25 ConfigKey = datastore.NewKey("/mpool/config") )
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") ErrExistingNonce = errors.New("message with nonce already exists") )
NOTE: When adding a new error type, please make sure to add the new error type in func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) in /chain/sub/incoming.go
var ( HeadChangeCoalesceMinDelay = 2 * time.Second HeadChangeCoalesceMaxDelay = 6 * time.Second HeadChangeCoalesceMergeInterval = time.Second )
var MaxActorPendingMessages = 1000
var MaxNonceGap = uint64(4)
var MaxUntrustedActorPendingMessages = 10
var RepublishBatchDelay = 100 * time.Millisecond
var RepublishInterval = time.Duration(10*build.BlockDelaySecs+build.PropagationDelaySecs) * time.Second
Functions ¶
func CapGasFee ¶ added in v0.7.1
func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSpec *api.MessageSendSpec)
func ComputeMinRBF ¶ added in v0.6.2
func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount
func ComputeRBF ¶ added in v1.20.2
func ComputeRBF(curPrem abi.TokenAmount, replaceByFeeRatio types.Percent) abi.TokenAmount
func DefaultConfig ¶ added in v0.5.0
func DefaultConfig() *types.MpoolConfig
Types ¶
type MessagePool ¶
type MessagePool struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, api Provider, ds dtypes.MetadataDS, us stmgr.UpgradeSchedule, netName dtypes.NetworkName, j journal.Journal) (*MessagePool, error)
func (*MessagePool) Add ¶
func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error
func (*MessagePool) CheckMessages ¶ added in v1.11.0
func (mp *MessagePool) CheckMessages(ctx context.Context, protos []*api.MessagePrototype) ([][]api.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 v1.11.0
func (mp *MessagePool) CheckPendingMessages(ctx context.Context, from address.Address) ([][]api.MessageCheckStatus, error)
CheckPendingMessages performs a set of logical sets for all messages pending from a given actor
func (*MessagePool) CheckReplaceMessages ¶ added in v1.11.0
func (mp *MessagePool) CheckReplaceMessages(ctx context.Context, replace []*types.Message) ([][]api.MessageCheckStatus, error)
CheckReplaceMessages performs a set of logical checks for related messages while performing a replacement.
func (*MessagePool) Clear ¶ added in v0.5.0
func (mp *MessagePool) Clear(ctx context.Context, local bool)
func (*MessagePool) Close ¶
func (mp *MessagePool) Close() error
func (*MessagePool) ForEachPendingMessage ¶ added in v1.11.1
func (mp *MessagePool) ForEachPendingMessage(f func(cid.Cid) error) error
func (*MessagePool) GetActor ¶ added in v1.11.0
func (mp *MessagePool) GetActor(_ 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 ¶ added in v0.5.0
func (mp *MessagePool) GetConfig() *types.MpoolConfig
func (*MessagePool) HeadChange ¶
func (*MessagePool) MessagesForBlocks ¶
func (mp *MessagePool) MessagesForBlocks(ctx context.Context, blks []*types.BlockHeader) ([]*types.SignedMessage, error)
func (*MessagePool) Pending ¶
func (mp *MessagePool) Pending(ctx context.Context) ([]*types.SignedMessage, *types.TipSet)
func (*MessagePool) PendingFor ¶ added in v0.5.0
func (mp *MessagePool) PendingFor(ctx context.Context, a address.Address) ([]*types.SignedMessage, *types.TipSet)
func (*MessagePool) Prune ¶ added in v0.5.0
func (mp *MessagePool) Prune()
func (*MessagePool) Push ¶
func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage, publish bool) (cid.Cid, error)
Push checks the signed message for any violations, adds the message to the message pool and publishes the message if the publish flag is set
func (*MessagePool) PushUntrusted ¶ added in v0.9.0
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 ¶ added in v0.5.0
func (mp *MessagePool) SelectMessages(ctx context.Context, ts *types.TipSet, tq float64) ([]*types.SignedMessage, error)
func (*MessagePool) SetConfig ¶ added in v0.5.0
func (mp *MessagePool) SetConfig(ctx context.Context, cfg *types.MpoolConfig) error
func (*MessagePool) Updates ¶
func (mp *MessagePool) Updates(ctx context.Context) (<-chan api.MpoolUpdate, error)
func (*MessagePool) VerifyMsgSig ¶ added in v0.3.1
func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error
type MessagePoolEvt ¶ added in v0.7.1
type MessagePoolEvt struct { Action string Messages []MessagePoolEvtMessage Error error `json:",omitempty"` }
MessagePoolEvt is the journal entry for message pool events.
type MessagePoolEvtMessage ¶ added in v0.7.1
type MpoolNonceAPI ¶ added in v1.19.0
type Provider ¶
type Provider interface { SubscribeHeadChanges(func(rev, app []*types.TipSet) error) *types.TipSet PutMessage(ctx context.Context, m types.ChainMsg) (cid.Cid, error) PubSubPublish(string, []byte) error GetActorBefore(address.Address, *types.TipSet) (*types.Actor, error) GetActorAfter(address.Address, *types.TipSet) (*types.Actor, error) StateDeterministicAddressAtFinality(context.Context, address.Address, *types.TipSet) (address.Address, error) StateNetworkVersion(context.Context, abi.ChainEpoch) network.Version MessagesForBlock(context.Context, *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) MessagesForTipset(context.Context, *types.TipSet) ([]types.ChainMsg, error) LoadTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error) ChainComputeBaseFee(ctx context.Context, ts *types.TipSet) (types.BigInt, error) IsLite() bool }
func NewProvider ¶
func NewProvider(sm *stmgr.StateManager, ps *pubsub.PubSub) Provider
func NewProviderLite ¶ added in v1.11.0
func NewProviderLite(sm *stmgr.StateManager, ps *pubsub.PubSub, noncer MpoolNonceAPI) Provider