done wit bb

This commit is contained in:
David Terpay 2023-08-15 11:24:18 -04:00
parent 4cbf8d0f1a
commit 80ac448d40
No known key found for this signature in database
GPG Key ID: 627EFB00DADF0CD1
4 changed files with 23 additions and 12 deletions

View File

@ -7,7 +7,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
)
@ -25,7 +24,7 @@ type (
// retrieve the priority of a given transaction and to compare the priority
// of two transactions. The index utilizes this struct to order transactions
// in the mempool.
txPriority block.TxPriority[C]
txPriority TxPriority[C]
// txEncoder defines the sdk.Tx encoder that allows us to encode transactions
// to bytes.
@ -39,8 +38,8 @@ type (
// DefaultTxPriority returns a default implementation of the TxPriority. It prioritizes
// transactions by their fee.
func DefaultTxPriority() block.TxPriority[string] {
return block.TxPriority[string]{
func DefaultTxPriority() TxPriority[string] {
return TxPriority[string]{
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
@ -81,10 +80,10 @@ func DefaultTxPriority() block.TxPriority[string] {
}
// NewConstructorMempool returns a new ConstructorMempool.
func NewConstructorMempool[C comparable](txPriority block.TxPriority[C], txEncoder sdk.TxEncoder, maxTx int) *ConstructorMempool[C] {
func NewConstructorMempool[C comparable](txPriority TxPriority[C], txEncoder sdk.TxEncoder, maxTx int) *ConstructorMempool[C] {
return &ConstructorMempool[C]{
index: block.NewPriorityMempool(
block.PriorityNonceMempoolConfig[C]{
index: NewPriorityMempool(
PriorityNonceMempoolConfig[C]{
TxPriority: txPriority,
MaxTx: maxTx,
},

View File

@ -1,4 +1,16 @@
package block
package constructor
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
// NOTE: THIS IS A COPY OF THE PRIORITY NONCE MEMPOOL FROM COSMOS-SDK. IT HAS BEEN
// MODIFIED FOR OUR USE CASE. THIS CODE WILL BE DEPRECATED ONCE THE COSMOS-SDK
// CUTS A FINAL v0.50.0 RELEASE.
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------ //
import (
"context"

View File

@ -23,7 +23,7 @@ type FreeLane struct {
// NewFreeLane returns a new free lane.
func NewFreeLane(
cfg block.LaneConfig,
txPriority block.TxPriority[string],
txPriority constructor.TxPriority[string],
matchFn block.MatchHandler,
) *FreeLane {
lane := constructor.NewLaneConstructor[string](

View File

@ -4,13 +4,13 @@ import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
)
// TxPriority returns a TxPriority over mev lane transactions only. It
// is to be used in the mev index only.
func TxPriority(config Factory) block.TxPriority[string] {
return block.TxPriority[string]{
func TxPriority(config Factory) constructor.TxPriority[string] {
return constructor.TxPriority[string]{
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
bidInfo, err := config.GetAuctionBidInfo(tx)
if err != nil {