THIS PR WILL NOT PASS CI UNTIL THE OTHER PRS ARE MERGED INTO HERE.
Overview
The lane constructor is a generic struct that developers should utilize to create new lanes. It wraps all of the required interface functionality defined in lane_interface.go into a generic type of lane. What this means is that users no longer have to worry about re-implementing a lot of the basic things needed to build a lane.
Instead of implementing the entire set of interfaces, they only have to implement a set of a few handlers (if any) and a single tx priority object.
MatchHandler
This lets the constructor know which lanes to match transactions to. You implement that and pass it into the lane and now it will always accept those transactions.
PrepareLaneHandler
This allows the lane to reap transactions from its mempool, have arbitrary inclusion functionality, and returns the txs you want to include in the proposal, the txs you need to remove from the lane, and an error if something is wrong. You'll see that the LaneConstructor utilizes this and then updates the proposal as well as that lane's mempool. This allows developers to not have to worry about mempool bloat and imo simplies the amount of responsibility on the developer in general.
ProcessLaneHandler
This does something similar to the above except it just ingresses transactions and validates them according to the logic of the lane. It must always return the remaining transactions after it is done processing the ones that belong to it. These transactions will then be passed onto the next lane.
CheckOrderHandler
This validates that transactions that belong to the lane and are included in proposals are ordered correctly. The constructor lane also wraps this functionality
A good amount of this PR is just moving things around and creating the final file structure that makes sense.
LaneConstructorMempool
This just ingresses a TxPriority object that lets the mempool do all of the logic it needs with as minimal amount of info as possible. I found a small bug in the priority nonce mempool implementation that the SDK has so I am going to keep it here for the time being.
THIS PR WILL NOT PASS CI UNTIL THE OTHER PRS ARE MERGED INTO HERE.
Overview
The lane constructor is a generic struct that developers should utilize to create new lanes. It wraps all of the required interface functionality defined in
lane_interface.go
into a generic type of lane. What this means is that users no longer have to worry about re-implementing a lot of the basic things needed to build a lane.Instead of implementing the entire set of interfaces, they only have to implement a set of a few handlers (if any) and a single tx priority object.
MatchHandler
This lets the constructor know which lanes to match transactions to. You implement that and pass it into the lane and now it will always accept those transactions.
PrepareLaneHandler
This allows the lane to reap transactions from its mempool, have arbitrary inclusion functionality, and returns the txs you want to include in the proposal, the txs you need to remove from the lane, and an error if something is wrong. You'll see that the
LaneConstructor
utilizes this and then updates the proposal as well as that lane's mempool. This allows developers to not have to worry about mempool bloat and imo simplies the amount of responsibility on the developer in general.ProcessLaneHandler
This does something similar to the above except it just ingresses transactions and validates them according to the logic of the lane. It must always return the remaining transactions after it is done processing the ones that belong to it. These transactions will then be passed onto the next lane.
CheckOrderHandler
This validates that transactions that belong to the lane and are included in proposals are ordered correctly. The constructor lane also wraps this functionality
A good amount of this PR is just moving things around and creating the final file structure that makes sense.
LaneConstructorMempool
This just ingresses a
TxPriority
object that lets the mempool do all of the logic it needs with as minimal amount of info as possible. I found a small bug in the priority nonce mempool implementation that the SDK has so I am going to keep it here for the time being.