Skip to content

fix: remove potential panic on *MsgCreateClient.String#1383

Merged
mergify[bot] merged 5 commits intomainfrom
adam/string-panic
Sep 15, 2022
Merged

fix: remove potential panic on *MsgCreateClient.String#1383
mergify[bot] merged 5 commits intomainfrom
adam/string-panic

Conversation

@toteki
Copy link
Copy Markdown
Contributor

@toteki toteki commented Sep 14, 2022

The following appeared during bloom-beta-1 testing (specifically ibc setup).

reflect.Value.Interface: cannot return value obtained from unexported field or method
stack:
goroutine 1923512 [running]:
runtime/debug.Stack()
\t/mnt/s/go/src/runtime/debug/stack.go:24 +0x65
github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x1f67b80, 0x2d97600})
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/recovery.go:71 +0x27
github.com/cosmos/cosmos-sdk/baseapp.newRecoveryMiddleware.func1({0x1f67b80?, 0x2d97600?})
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/recovery.go:39 +0x30
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x1f67b80, 0x2d97600}, 0xc00d122fc0?)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/recovery.go:28 +0x37
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x1f67b80, 0x2d97600}, 0x2dc8100?)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/recovery.go:33 +0x5e
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1()
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/baseapp.go:605 +0xf0
panic({0x1f67b80, 0x2d97600})
\t/mnt/s/go/src/runtime/panic.go:838 +0x207
github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle.func1()
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/setup.go:59 +0x1e6
panic({0x1f67b80, 0x2d97600})
\t/mnt/s/go/src/runtime/panic.go:838 +0x207
reflect.valueInterface({0x1fcc2c0?, 0xc0236ba528?, 0x8f?}, 0x58?)
\t/mnt/s/go/src/reflect/value.go:1441 +0xd8
reflect.Value.Interface(...)
\t/mnt/s/go/src/reflect/value.go:1430
github.com/gogo/protobuf/proto.(*TextMarshaler).writeAny(0x0?, 0xc02d12ad40, {0x1fcc2c0?, 0xc0236ba528?, 0x2dce670?}, 0xc028b88f00)
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:615 +0xa38
github.com/gogo/protobuf/proto.(*TextMarshaler).writeStruct(0x3e980b6, 0xc02d12ad40, {0x21d70e0?, 0xc0236ba4e0?, 0x7f4bf67ce108?})
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:453 +0x8ad
github.com/gogo/protobuf/proto.(*TextMarshaler).writeAny(0x2091d99?, 0xc02d12ad40, {0x228f940?, 0xc02d12a060?, 0x2dce670?}, 0xc028b88900)
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:606 +0x8c5
github.com/gogo/protobuf/proto.(*TextMarshaler).writeStruct(0x3e980b6, 0xc02d12ad40, {0x21916a0?, 0xc02d12a060?, 0xc026d16468?})
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:453 +0x8ad
github.com/gogo/protobuf/proto.(*TextMarshaler).Marshal(0x3e980b6, {0x2d97e60?, 0xc02766c000?}, {0x2daf0d0?, 0xc02d12a060?})
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:896 +0x367
github.com/gogo/protobuf/proto.(*TextMarshaler).Text(0xc026d16438?, {0x2daf0d0, 0xc02d12a060})
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:908 +0x56
github.com/gogo/protobuf/proto.CompactTextString(...)
\t/home/umeeandre/go/pkg/mod/github.com/regen-network/protobuf@v1.3.3-alpha.regen.1/proto/text.go:930
github.com/cosmos/ibc-go/v5/modules/core/02-client/types.(*MsgCreateClient).String(0xc00021e648?)
\t/home/umeeandre/go/pkg/mod/github.com/cosmos/ibc-go/v5@v5.0.0-rc1/modules/core/02-client/types/tx.pb.go:44 +0x2a
github.com/umee-network/umee/v3/ante.FeeAndPriority({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/mnt/s/Umee/umee-3.0.0-beta1/ante/fee.go:46 +0x475
github.com/cosmos/cosmos-sdk/x/auth/ante.DeductFeeDecorator.AnteHandle({{_, _}, {_, _}, {_, _}, _}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/fee.go:56 +0x18d
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle({{_, _}}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/basic.go:142 +0x34f
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle({{_, _}}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/basic.go:66 +0x2d7
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle({}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/basic.go:205 +0x297
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle({}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/basic.go:34 +0x157
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/umee-network/umee/v3/ante.(*SpamPreventionDecorator).AnteHandle(_, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, ...}, ...}, ...)
\t/mnt/s/Umee/umee-3.0.0-beta1/ante/spam_prevention.go:47 +0x203
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle({_}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/ext.go:52 +0x137
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle({}, {{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/x/auth/ante/setup.go:64 +0x593
github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x2db8940, 0xc00012a000}, {0x2dc8100, 0xc026c968c0}, {{0xb, 0x0}, {0xc02875c270, 0xc}, 0x3a79, {0x1829c70e, ...}, ...}, ...}, ...)
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/types/handler.go:40 +0x136
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc001398380, 0x0, {0xc00018f600, 0x29a, 0x29a})
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/baseapp.go:657 +0x736
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CheckTx(0xc001398380, {{0xc00018f600?, 0xc011e83710?, 0xc011e83818?}, 0xeb8888?})
\t/home/umeeandre/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.1-umee/baseapp/abci.go:261 +0x86
github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync(0xc0012bf320, {{0xc00018f600?, 0xdfb2e0?, 0xc0011b6820?}, 0xeb89a0?})
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/abci/client/local_client.go:104 +0x118
github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync(0xc0011b6820?, {{0xc00018f600?, 0x0?, 0x0?}, 0x96d33930?})
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/proxy/app_conn.go:126 +0x26
github.com/tendermint/tendermint/mempool/v0.(*CListMempool).CheckTx(0xc00122bd40, {0xc00018f600, 0x29a, 0x29a}, 0x0?, {0x20?, {0x0?, 0x50003?}})
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/mempool/v0/clist_mempool.go:254 +0x32d
github.com/tendermint/tendermint/rpc/core.BroadcastTxSync(0xc02d12a000, {0xc00018f600, 0x29a, 0x29a})
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/rpc/core/mempool.go:36 +0xf6
reflect.Value.call({0x1fe7360?, 0x2a14e50?, 0x30?}, {0x22e631b, 0x4}, {0xc02c70c630, 0x2, 0x18?})
\t/mnt/s/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x1fe7360?, 0x2a14e50?, 0x38a?}, {0xc02c70c630, 0x2, 0x2})
\t/mnt/s/go/src/reflect/value.go:339 +0xbf
github.com/tendermint/tendermint/rpc/jsonrpc/server.makeJSONRPCHandler.func1({0x2db5b80, 0xc026d16018}, 0xc00d23da00)
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/rpc/jsonrpc/server/http_json_handler.go:96 +0x1075
github.com/tendermint/tendermint/rpc/jsonrpc/server.handleInvalidJSONRPCPaths.func1({0x2db5b80?, 0xc026d16018?}, 0x7f4bf67ce108?)
\t/home/umeeandre/go/pkg/mod/github.com/tendermint/tendermint@v0.34.21/rpc/jsonrpc/server/http_json_handler.go:122 +0x5d
net/http.HandlerFunc.ServeHTTP(0xc026c96080?, {0x2db5b80?, 0xc026d16018?}, 0xc000eb9878?)

This panic seems to be from *MsgCreateClient.String() and is obscuring the actual error being wrapped by sdkerrors.Wrap(err, msgs[0].String()) in FeeAndPriority`.

Removing the wrap will let us see the actual error. Since I don't see other antehandlers trying to String() offending messages, I think it's fine to do this.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@toteki toteki added the T:Bug A regression or bug in the Umee codebase. label Sep 14, 2022
@toteki toteki requested a review from a team as a code owner September 14, 2022 23:07
@toteki toteki requested a review from a team as a code owner September 14, 2022 23:16
Copy link
Copy Markdown
Contributor

@RafilxTenfen RafilxTenfen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mergify mergify bot merged commit 970184f into main Sep 15, 2022
@mergify mergify bot deleted the adam/string-panic branch September 15, 2022 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:Automerge T:Bug A regression or bug in the Umee codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants