From f7d8005c30071c97deadf0f8377203688bc5b203 Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Sat, 20 Jan 2024 18:47:15 -0800 Subject: [PATCH] separate out MsgCreateValidator --- app/ante/ante.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/ante/ante.go b/app/ante/ante.go index d055d29035..99bf012cf3 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -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) } @@ -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