Mempool interface design #51
Replies: 2 comments
-
@AndrewWestberg I know you're focused on other things right now, but if there's anything I've forgotten, feel free to chime in! |
Beta Was this translation helpful? Give feedback.
-
In my design, I didn't require transactions in the mempool to be valid. This is a departure from the haskell node. For example, the mempool might keep around transactions after they are on chain in the event of a rollback so they can be re-applied. They might also only be valid once some new future state arrives. Certain interfaces could be designed to provide exactly what the client needs though. For example, a block producing node should be able to request only valid transactions for a particular ledger state it wants to build on top of. |
Beta Was this translation helpful? Give feedback.
-
I'm starting a discussion to capture previous and ongoing discussion related to the mempool interface, as @KtorZ likes Github discussions and I want him to tell me he's proud of me.
A block producing node checks every slot (i.e. once per second) whether it is allowed to produce a block; to maximize the likelihood that its block gets adopted, it's important for this block to be produced on top of the latest tip, consist of valid transactions, and be produced and propagated as quickly as possible.
To this end, most blockchain nodes have a component called the mempool, which is, abstractly, a collection of transactions that have been seen, validated (for some definition of validation), and are ready to be either propagated or forged into a block.
For a relay node, this mempool's purpose is to propagate transactions across the network so they reach the next block producing node;
For a data node, this mempool's purpose is to expose upcoming transactions to the dApps reading from the data node, so that they can perhaps build speculative transactions chained on top of this one.
For a block producing node, this mempool's purpose is to enable the forging module to select transactions for a block being forged.
Some other priorities that at least impact the design of the mempool:
There are some interesting performance / modularity tradeoffs to consider:
Given all the above, we discussed some basic capabilities that a mempool module/trait might need:
Additionally, we called these out as potentially useful, but not part of the core trait responsibilities:
Beta Was this translation helpful? Give feedback.
All reactions