Documentation ΒΆ
Index ΒΆ
- Constants
- func GetMsgAuctionBidFromTx(tx sdk.Tx) (*auctiontypes.MsgAuctionBid, error)
- func TxPriority(config Factory) base.TxPriority[string]
- type DefaultAuctionFactory
- func (config *DefaultAuctionFactory) GetAuctionBidInfo(tx sdk.Tx) (*types.BidInfo, error)
- func (config *DefaultAuctionFactory) GetTimeoutHeight(tx sdk.Tx) (uint64, error)
- func (config *DefaultAuctionFactory) MatchHandler() base.MatchHandler
- func (config *DefaultAuctionFactory) WrapBundleTransaction(tx []byte) (sdk.Tx, error)
- type Factory
- type MEVLane
- type ProposalHandler
- func (h *ProposalHandler) PrepareLaneHandler() base.PrepareLaneHandler
- func (h *ProposalHandler) ProcessLaneHandler() base.ProcessLaneHandler
- func (h *ProposalHandler) VerifyBidBasic(ctx sdk.Context, bidTx sdk.Tx, proposal proposals.Proposal, ...) ([]sdk.Tx, error)
- func (h *ProposalHandler) VerifyBidTx(ctx sdk.Context, bidTx sdk.Tx, bundle []sdk.Tx) error
- type TxWithTimeoutHeight
Constants ΒΆ
const (
// LaneName defines the name of the mev lane.
LaneName = "mev"
)
Variables ΒΆ
This section is empty.
Functions ΒΆ
func GetMsgAuctionBidFromTx ΒΆ
func GetMsgAuctionBidFromTx(tx sdk.Tx) (*auctiontypes.MsgAuctionBid, error)
GetMsgAuctionBidFromTx attempts to retrieve a MsgAuctionBid from an sdk.Tx if one exists. If a MsgAuctionBid does exist and other messages are also present, an error is returned. If no MsgAuctionBid is present, <nil, nil> is returned.
func TxPriority ΒΆ
func TxPriority(config Factory) base.TxPriority[string]
TxPriority returns a TxPriority over mev lane transactions only. It is to be used in the mev index only.
Types ΒΆ
type DefaultAuctionFactory ΒΆ
type DefaultAuctionFactory struct {
// contains filtered or unexported fields
}
DefaultAuctionFactory defines a default implmentation for the auction factory interface for processing auction transactions.
func (*DefaultAuctionFactory) GetAuctionBidInfo ΒΆ
GetAuctionBidInfo defines a default function that returns the auction bid info from an auction transaction. In the default case, the auction bid info is stored in the MsgAuctionBid message.
func (*DefaultAuctionFactory) GetTimeoutHeight ΒΆ
func (config *DefaultAuctionFactory) GetTimeoutHeight(tx sdk.Tx) (uint64, error)
GetTimeoutHeight returns the timeout height of the transaction.
func (*DefaultAuctionFactory) MatchHandler ΒΆ
func (config *DefaultAuctionFactory) MatchHandler() base.MatchHandler
MatchHandler defines a default function that checks if a transaction matches the mev lane.
func (*DefaultAuctionFactory) WrapBundleTransaction ΒΆ
func (config *DefaultAuctionFactory) WrapBundleTransaction(tx []byte) (sdk.Tx, error)
WrapBundleTransaction defines a default function that wraps a transaction that is included in the bundle into a sdk.Tx. In the default case, the transaction that is included in the bundle will be the raw bytes of an sdk.Tx so we can just decode it.
type Factory ΒΆ
type Factory interface { // WrapBundleTransaction defines a function that wraps a bundle transaction into a sdk.Tx. Since // this is a potentially expensive operation, we allow each application chain to define how // they want to wrap the transaction such that it is only called when necessary (i.e. when the // transaction is being considered in the proposal handlers). WrapBundleTransaction(tx []byte) (sdk.Tx, error) // GetAuctionBidInfo defines a function that returns the bid info from an auction transaction. GetAuctionBidInfo(tx sdk.Tx) (*types.BidInfo, error) // MatchHandler defines a function that checks if a transaction matches the auction lane. MatchHandler() base.MatchHandler }
Factory defines the interface for processing auction transactions. It is a wrapper around all the functionality that each application chain must implement in order for auction processing to work.
func NewDefaultAuctionFactory ΒΆ
func NewDefaultAuctionFactory(txDecoder sdk.TxDecoder, extractor signer_extraction.Adapter) Factory
NewDefaultAuctionFactory returns a default auction factory interface implementation.
type MEVLane ΒΆ
type MEVLane struct { *base.BaseLane // Factory defines the API/functionality which is responsible for determining // if a transaction is a bid transaction and how to extract relevant // information from the transaction (bid, timeout, bidder, etc.). Factory }
MEVLane defines a MEV (Maximal Extracted Value) auction lane. The MEV auction lane hosts transactions that want to bid for inclusion at the top of the next block. The MEV auction lane stores bid transactions that are sorted by their bid price. The highest valid bid transaction is selected for inclusion in the next block. The bundled transactions of the selected bid transaction are also included in the next block.
func NewMEVLane ΒΆ
func NewMEVLane( cfg base.LaneConfig, factory Factory, matchHandler base.MatchHandler, ) *MEVLane
NewMEVLane returns a new TOB lane.
type ProposalHandler ΒΆ
type ProposalHandler struct {
// contains filtered or unexported fields
}
Implements the MEV lane's PrepareLaneHandler and ProcessLaneHandler.
func NewProposalHandler ΒΆ
func NewProposalHandler(lane *base.BaseLane, factory Factory) *ProposalHandler
NewProposalHandler returns a new mev proposal handler.
func (*ProposalHandler) PrepareLaneHandler ΒΆ
func (h *ProposalHandler) PrepareLaneHandler() base.PrepareLaneHandler
PrepareLaneHandler will attempt to select the highest bid transaction that is valid and whose bundled transactions are valid and include them in the proposal. It will return no transactions if no valid bids are found. If any of the bids are invalid, it will return them and will only remove the bids and not the bundled transactions.
func (*ProposalHandler) ProcessLaneHandler ΒΆ
func (h *ProposalHandler) ProcessLaneHandler() base.ProcessLaneHandler
ProcessLaneHandler will ensure that block proposals that include transactions from the mev lane are valid. In particular, the invariant checks that we perform are:
- If the first transaction does not match the lane, no other MEV transactions should be included in the proposal.
- The bid transaction must be valid.
- The bundled transactions must be valid.
- The bundled transactions must match the transactions in the block proposal in the same order they were defined in the bid transaction.
- The bundled transactions must not be bid transactions.
func (*ProposalHandler) VerifyBidBasic ΒΆ
func (h *ProposalHandler) VerifyBidBasic( ctx sdk.Context, bidTx sdk.Tx, proposal proposals.Proposal, limit proposals.LaneLimits, ) ([]sdk.Tx, error)
VerifyBidBasic will verify that the bid transaction and all of its bundled transactions respect the basic invariants of the lane (e.g. size, gas limit).
func (*ProposalHandler) VerifyBidTx ΒΆ
VerifyBidTx will verify that the bid transaction and all of its bundled transactions are valid.
type TxWithTimeoutHeight ΒΆ
TxWithTimeoutHeight is used to extract timeouts from sdk.Tx transactions. In the case where, timeouts are explicitly set on the sdk.Tx, we can use this interface to extract the timeout.