Skip to content

Commit

Permalink
add opchild bridge ante (#74)
Browse files Browse the repository at this point in the history
* add opchild bridge ante

* add keeper checking on ante

---------

Co-authored-by: beer-1 <[email protected]>
  • Loading branch information
sh-cha and beer-1 authored Nov 15, 2024
1 parent d27fc24 commit 00edbc4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

opchildante "github.com/initia-labs/OPinit/x/opchild/ante"
opchildtypes "github.com/initia-labs/OPinit/x/opchild/types"
opchildkeeper "github.com/initia-labs/OPinit/x/opchild/keeper"
accnumante "github.com/initia-labs/initia/app/ante/accnum"
"github.com/initia-labs/initia/app/ante/sigverify"
moveante "github.com/initia-labs/initia/x/move/ante"
Expand All @@ -27,8 +27,8 @@ type HandlerOptions struct {
ante.HandlerOptions
Codec codec.BinaryCodec
IBCkeeper *ibckeeper.Keeper
OPChildKeeper opchildtypes.AnteKeeper
AuctionKeeper auctionkeeper.Keeper
OPChildKeeper *opchildkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper
TxEncoder sdk.TxEncoder
MevLane auctionante.MEVLane
FreeLane block.Lane
Expand All @@ -41,14 +41,21 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}

if options.BankKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
}

if options.SignModeHandler == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}
if options.OPChildKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "opchild keeper is required for ante builder")
}
if options.IBCkeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "IBC keeper is required for ante builder")
}
if options.AuctionKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "auction keeper is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
Expand Down Expand Up @@ -92,7 +99,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
sigverify.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCkeeper),
auctionante.NewAuctionDecorator(options.AuctionKeeper, options.TxEncoder, options.MevLane),
auctionante.NewAuctionDecorator(*options.AuctionKeeper, options.TxEncoder, options.MevLane),
opchildante.NewRedundantBridgeDecorator(options.OPChildKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
2 changes: 1 addition & 1 deletion app/blocksdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func setupBlockSDK(
Codec: app.appCodec,
OPChildKeeper: app.OPChildKeeper,
TxEncoder: app.txConfig.TxEncoder(),
AuctionKeeper: *app.AuctionKeeper,
AuctionKeeper: app.AuctionKeeper,
MevLane: mevLane,
FreeLane: freeLane,
},
Expand Down

0 comments on commit 00edbc4

Please sign in to comment.