* new proto types for proposal info * new proposal type * nits * lane input * lint * feat(ABCI): Deprecating `CheckOrderHandler` with new Proposal MetaData (#127) * refactor without checkorder * nits * more nits * lint * nits * feat(ABCI): Updating MEV lane to have no `CheckOrder` handler + testing (#128) * updating mev lane * nits * preventing adding multiple bid txs in prepare * update
38 lines
1015 B
Go
38 lines
1015 B
Go
package block
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
type (
|
|
// IgnoreDecorator is an AnteDecorator that wraps an existing AnteDecorator. It allows
|
|
// for the AnteDecorator to be ignored for specified lanes.
|
|
IgnoreDecorator struct {
|
|
decorator sdk.AnteDecorator
|
|
lanes []Lane
|
|
}
|
|
)
|
|
|
|
// NewIgnoreDecorator returns a new IgnoreDecorator instance.
|
|
func NewIgnoreDecorator(decorator sdk.AnteDecorator, lanes ...Lane) *IgnoreDecorator {
|
|
return &IgnoreDecorator{
|
|
decorator: decorator,
|
|
lanes: lanes,
|
|
}
|
|
}
|
|
|
|
// AnteHandle implements the sdk.AnteDecorator interface. If the transaction belongs to
|
|
// one of the lanes, the next AnteHandler is called. Otherwise, the decorator's AnteHandler
|
|
// is called.
|
|
func (sd IgnoreDecorator) AnteHandle(
|
|
ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler,
|
|
) (sdk.Context, error) {
|
|
for _, lane := range sd.lanes {
|
|
if lane.Match(ctx, tx) {
|
|
return next(ctx, tx, simulate)
|
|
}
|
|
}
|
|
|
|
return sd.decorator.AnteHandle(ctx, tx, simulate, next)
|
|
}
|