Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Submitting transaction with the "--fee-granter" flag fails during simulate because of panic in feemarket PostHandle() #114

Closed
dusan-maksimovic opened this issue Jun 12, 2024 · 1 comment · Fixed by #118

Comments

@dusan-maksimovic
Copy link

dusan-maksimovic commented Jun 12, 2024

When submitting transaction with the "--fee-granter" flag, an unexpected error is raised. For example:

gaiad tx bank send wallet2 cosmos1p5238sjdqttvswa0zx2awvacjy98yrh3wxzkem 10stake --from wallet2 --fee-granter cosmos1e35997edcs7rc28sttwd436u0e83jw6ct4f3f4

(Also, notice at the bottom of the stack trace this line, which seems weird as well: "With gas wanted: '18446744073709551615' ")

Error:

Error: rpc error: code = Unknown desc = rpc error: code = Unknown desc = recovered: runtime error: invalid memory address or nil pointer dereference stack: goroutine 793 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.func3({0x27c7b60, 0x5174780}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/recovery.go:71 +0x25 github.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.newRecoveryMiddleware.func5({0x27c7b60?, 0x5174780?}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/recovery.go:39 +0x2d github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x27c7b60, 0x5174780}, 0x3e8?) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/recovery.go:28 +0x2f github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x27c7b60, 0x5174780}, 0xc004e32480?) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/recovery.go:33 +0x53 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1() /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/baseapp.go:646 +0x138 panic({0x27c7b60?, 0x5174780?}) /usr/local/go/src/runtime/panic.go:770 +0x132 math/big.(*Int).Sign(...) /usr/local/go/src/math/big/int.go:49 cosmossdk.io/math.Int.IsZero(...) /home/dusan/go/pkg/mod/cosmossdk.io/math@v1.3.0/int.go:232 github.com/cosmos/cosmos-sdk/types.Coin.IsZero(...) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/coin.go:61 github.com/cosmos/cosmos-sdk/types.removeZeroCoins({0xc004cd1590?, 0x4186db?, 0x15?}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/coin.go:793 +0x30 github.com/cosmos/cosmos-sdk/types.sanitizeCoins({0xc004cd1590?, 0x18?, 0x7ff257a6bf18?}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/coin.go:190 +0x18 github.com/cosmos/cosmos-sdk/types.NewCoins({0xc004cd1590?, 0x14?, 0x15?}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/coin.go:181 +0x1f github.com/skip-mev/feemarket/x/feemarket/post.FeeMarketDeductDecorator.DeductFeeAndTip({{_, _}, {_, _}, {_, _}, {_, _}}, {{0x3964220, 0x5317e40}, ...}, ...) /home/dusan/go/pkg/mod/github.com/skip-mev/feemarket@v1.0.0-sdk47/x/feemarket/post/fee.go:162 +0x325 github.com/skip-mev/feemarket/x/feemarket/post.FeeMarketDeductDecorator.PostHandle({{_, _}, {_, _}, {_, _}, {_, _}}, {{0x3964220, 0x5317e40}, ...}, ...) /home/dusan/go/pkg/mod/github.com/skip-mev/feemarket@v1.0.0-sdk47/x/feemarket/post/fee.go:113 +0xac5 github.com/cosmos/cosmos-sdk/types.ChainPostDecorators.func1({{0x3964220, 0x5317e40}, {0x397cd30, 0xc004c94f00}, {{0xb, 0x0}, {0xc004a9411c, 0x4}, 0x45, {0x18d94c1f, ...}, ...}, ...}, ...) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/handler.go:72 +0x13e github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc0003b65a0, 0x2, {0xc002986dc0, 0x121, 0x140}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/baseapp.go:760 +0xfb3 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Simulate(...) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/test_helpers.go:25 github.com/cosmos/cosmos-sdk/x/auth/tx.txServer.Simulate({{{0x0, 0x0, 0x0}, {0x397ee40, 0xc000748d60}, 0x0, {0xc000da1540, 0x4}, {0x3995380, 0xc000bb7450}, ...}, ...}, ...) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/x/auth/tx/service.go:132 +0x12f github.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler({0x2a9b820, 0xc0003b74a0}, {0x39643e0, 0xc002c56848}, 0xc002c310e0, 0x0) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/types/tx/service.pb.go:1416 +0x1a6 github.com/cosmos/cosmos-sdk/baseapp.(*GRPCQueryRouter).RegisterService.func1({{0x3964220, 0x5317e40}, {0x397cd30, 0xc004c94c80}, {{0xb, 0x0}, {0xc004a9411c, 0x4}, 0x45, {0x18d94c1f, ...}, ...}, ...}, ...) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/grpcrouter.go:82 +0x184 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).handleQueryGRPC(0xc0003b65a0, 0xc002685110, {{0xc0032bc000, 0x124, 0x280}, {0xc0045a1bf0, 0x23}, 0x45, 0x0}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/abci.go:698 +0x1a5 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Query(0xc0003b65a0, {{0xc0032bc000, 0x124, 0x280}, {0xc0045a1bf0, 0x23}, 0x45, 0x0}) /home/dusan/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/abci.go:545 +0x776 github.com/cometbft/cometbft/abci/client.(*localClient).QuerySync(0xc003290240, {{0xc0032bc000, 0x124, 0x280}, {0xc0045a1bf0, 0x23}, 0x0, 0x0}) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/abci/client/local_client.go:259 +0x163 github.com/cometbft/cometbft/proxy.(*appConnQuery).QuerySync(0xc000ccc288, {{0xc0032bc000, 0x124, 0x280}, {0xc0045a1bf0, 0x23}, 0x0, 0x0}) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/proxy/app_conn.go:193 +0x1ca github.com/cometbft/cometbft/rpc/core.ABCIQuery(0xc0006ab140?, {0xc0045a1bf0?, 0x4?}, {0xc0032bc000?, 0x2?, 0x2?}, 0x0?, 0x13?) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/rpc/core/abci.go:20 +0x9a reflect.Value.call({0x2825c20?, 0x32e5238?, 0x2bced20?}, {0x2be03fa, 0x4}, {0xc000f7f380, 0x5, 0x5?}) /usr/local/go/src/reflect/value.go:596 +0xca6 reflect.Value.Call({0x2825c20?, 0x32e5238?, 0x29b?}, {0xc000f7f380?, 0x2bced20?, 0xc00471d510?}) /usr/local/go/src/reflect/value.go:380 +0xb9 github.com/cometbft/cometbft/rpc/jsonrpc/server.RegisterRPCFuncs.makeJSONRPCHandler.func3({0x3954460, 0xc004cd05e8}, 0xc002c52a20) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/rpc/jsonrpc/server/http_json_handler.go:108 +0xce6 github.com/cometbft/cometbft/rpc/jsonrpc/server.RegisterRPCFuncs.handleInvalidJSONRPCPaths.func4({0x3954460?, 0xc004cd05e8?}, 0x40?) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/rpc/jsonrpc/server/http_json_handler.go:140 +0x42 net/http.HandlerFunc.ServeHTTP(0xc0015d05b0?, {0x3954460?, 0xc004cd05e8?}, 0xc00471d990?) /usr/local/go/src/net/http/server.go:2166 +0x29 net/http.(*ServeMux).ServeHTTP(0x0?, {0x3954460, 0xc004cd05e8}, 0xc002c52a20) /usr/local/go/src/net/http/server.go:2683 +0x1ad github.com/cometbft/cometbft/rpc/jsonrpc/server.maxBytesHandler.ServeHTTP({{0x3934040?, 0xc0015d05b0?}, 0xd?}, {0x3954460, 0xc004cd05e8}, 0xc002c52a20) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/rpc/jsonrpc/server/http_server.go:256 +0xfb github.com/cometbft/cometbft/rpc/jsonrpc/server.Serve.RecoverAndLogHandler.func1({0x3946aa0, 0xc001068000}, 0xc002c52a20) /home/dusan/go/pkg/mod/github.com/cometbft/cometbft@v0.37.6/rpc/jsonrpc/server/http_server.go:229 +0x26c net/http.HandlerFunc.ServeHTTP(0x418a85?, {0x3946aa0?, 0xc001068000?}, 0xc001068001?) /usr/local/go/src/net/http/server.go:2166 +0x29 net/http.serverHandler.ServeHTTP({0x3941640?}, {0x3946aa0?, 0xc001068000?}, 0x6?) /usr/local/go/src/net/http/server.go:3137 +0x8e net/http.(*conn).serve(0xc00245f7a0, {0x3964920, 0xc00228c4e0}) /usr/local/go/src/net/http/server.go:2039 +0x5e8 created by net/http.(*Server).Serve in goroutine 109 /usr/local/go/src/net/http/server.go:3285 +0x4b4 : panic [cosmos/cosmos-sdk@v0.47.14-ics-lsm/baseapp/recovery.go:69] With gas wanted: '18446744073709551615' and gas used: '77686' : unknown request

The issue seems to be caused by usage of uninitialized fee variable here:

err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, sdk.NewCoins(fee), sdkTx.GetMsgs())

Affected versions

  • v1.0.1
  • v1.0.1-sdk47
@MSalopek
Copy link
Contributor

We found this issue while integrating the module on the cosmos-hub.

WIP: cosmos/gaia#3028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants