Skip to content

Commit

Permalink
separate out MsgCreateValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
brewmaster012 committed Jan 21, 2024
1 parent cdff7a5 commit f7d8005
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
anteHandler = newCosmosAnteHandlerForSystemTx(options)
}

// if tx is MsgCreatorValidator, use the newCosmosAnteHandlerForSystemTx handler to
// exempt gas fee requirement in genesis because it's not possible to pay gas fee in genesis
if len(tx.GetMsgs()) == 1 {
if _, ok := tx.GetMsgs()[0].(*stakingtypes.MsgCreateValidator); ok && ctx.BlockHeight() == 0 {
anteHandler = newCosmosAnteHandlerForSystemTx(options)
}
}

default:
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
}
Expand Down Expand Up @@ -174,8 +182,6 @@ func AssertSystemTxIntoCreatorTx(tx sdk.Tx) CreatorMsg {
return mm
} else if mm, ok := innerMsg.(*observertypes.MsgAddBlameVote); ok {
return mm
} else if _, ok := innerMsg.(*stakingtypes.MsgCreateValidator); ok {
return mm
}

return nil
Expand Down

0 comments on commit f7d8005

Please sign in to comment.