Message Pool #
The Message Pool is a subsystem in the Filecoin blockchain system. The message pool acts as the interface between Filecoin nodes and a peer-to-peer network used for off-chain message transmission. It is used by nodes to maintain a set of messages to transmit to the Filecoin VM (for “on-chain” execution).
import addr "github.com/filecoin-project/go-address"
import msg "github.com/filecoin-project/specs/systems/filecoin_vm/message"
type MessagePoolSubsystem struct {
// needs access to:
// - BlockchainSubsystem
// - needs access to StateTree
// - needs access to Messages mined into blocks (probably past finality)
// to remove from the MessagePool
// - NetworkSubsystem
// - needs access to MessagePubsub
//
// Important remaining questions:
// - how does BlockchainSubsystem.BlockReceiver handle asking for messages?
// - how do we note messages are now part of the blockchain
// - how are they cleared from the mempool
// - do we need to have some sort of purge?
// Stats returns information about the MessagePool contents.
Stats() MessagePoolStats
// FindMessage receives a descriptor query q, and returns a set of
// messages currently in the mempool that match the Query constraints.
// q may have all, any, or no constraints specified.
// FindMessage(q MessageQuery) union {
// [base.Message],
// Error
// }
// MostProfitableMessages returns messages that are most profitable
// to mine for this miner.
//
// Note: This is where algorithms about chosing best messages given
// many leaders should go.
GetMostProfitableMessages(miner addr.Address) [msg.SignedMessage]
// messageSyncer to manager incoming and outgoing messages
Syncer MessageSyncer
}
type MessagePoolStats struct {
// Size is the amount of messages in the MessagePool
Size UInt
}
// MessageQuery is a descriptor used to find messages matching one or more
// of the constraints specified.
type MessageQuery struct {
/*
From base.Address
To base.Address
Method ActorMethodId
Params ActorMethodParams
ValueMin TokenAmount
ValueMax TokenAmount
GasPriceMin TokenAmount
GasPriceMax TokenAmount
GasLimitMin TokenAmount
GasLimitMax TokenAmount
*/
}
Clients that use a message pool include:
- storage market provider and client nodes - for transmission of deals on chain
- storage miner nodes - for transmission of PoSts, sector commitments, deals, and other operations tracked on chain
- verifier nodes - for transmission of potential faults on chain
- relayer nodes - for forwarding and discarding messages appropriately.
The message pool subsystem is made of two components:
- The Message Syncer – which receives and propagates messages.
- Message Storage – which caches messages according to a given policy.
TODOs:
- discuss how messages are meant to propagate slowly/async
- explain algorithms for choosing profitable txns