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

Panic in ics-20 packet delivery, when upstream ack is nil #1695

Closed
joe-bowman opened this issue Jul 12, 2024 · 1 comment · Fixed by #1696
Closed

Panic in ics-20 packet delivery, when upstream ack is nil #1695

joe-bowman opened this issue Jul 12, 2024 · 1 comment · Fixed by #1696

Comments

@joe-bowman
Copy link
Contributor

2024-07-11T19:50:39.995892Z ERROR ThreadId(819) worker.batch{chain=osmosis-1}:supervisor.handle_batch{chain=osmosis-1}:supervisor.process_batch{chain=osmosis-1}:worker.packet.cmd{src_chain=osmosis-1 src_port=transfer src_channel=channel-522 dst_chain=quicksilver-2}: will retry: schedule execution encountered error: link failed with underlying error: gRPC call `send_tx_simulate` failed with status: status: Unknown, message: "recovered: runtime error: invalid memory address or nil pointer dereference\nstack:\ngoroutine 43097162 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.func1({0x25003a0, 0x4c4a060})\n\tgithub.com/cosmos/[email protected]/baseapp/recovery.go:71 +0x25\ngithub.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.newRecoveryMiddleware.func2({0x25003a0?, 0x4c4a060?})\n\tgithub.com/cosmos/[email protected]/baseapp/recovery.go:39 +0x2d\ngithub.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x25003a0, 0x4c4a060}, 0x7d0?)\n\tgithub.com/cosmos/[email protected]/baseapp/recovery.go:28 +0x2f\ngithub.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x25003a0, 0x4c4a060}, 0x64?)\n\tgithub.com/cosmos/[email protected]/baseapp/recovery.go:33 +0x53\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1()\n\tgithub.com/cosmos/[email protected]/baseapp/baseapp.go:642 +0x138\npanic({0x25003a0?, 0x4c4a060?})\n\truntime/panic.go:770 +0x132\ngithub.com/quicksilver-zone/quicksilver/x/interchainstaking.TransferMiddleware.OnRecvPacket({{_, _}, _}, {{0x3681668, 0x4dc67c0}, {0x3695c10, 0xc035526640}, {{0xb, 0x0}, {0xc05d420790, ...}, ...}, ...}, ...)\n\tgithub.com/quicksilver-zone/quicksilver/x/interchainstaking/transfer_middleware.go:97 +0x185\ngithub.com/cosmos/ibc-go/v6/modules/core/keeper.Keeper.RecvPacket({{0x0, 0x0}, {0x3695b30, 0xc00138f950}, {{0x3663538, 0xc003929900}, {0x3695b30, 0xc00138f950}, {{0x3695b30, 0xc00138f950}, ...}, ...}, ...}, ...)\n\tgithub.com/cosmos/ibc-go/[email protected]/modules/core/keeper/msg_server.go:410 +0x598\ngithub.com/cosmos/ibc-go/v6/modules/core/04-channel/types._Msg_RecvPacket_Handler.func1({0x36819b0?, 0xc0278e72c0?}, {0x27d4240?, 0xc0f9f2c0b0?})\n\tgithub.com/cosmos/ibc-go/[email protected]/modules/core/04-channel/types/tx.pb.go:1322 +0xcb\ngithub.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).RegisterService.func2.1({0x36816d8, 0xc0fa3c42c8}, {0xc16faa84a0?, 0x412aa5?}, 0x2a0?, 0xc0fa21f350)\n\tgithub.com/cosmos/[email protected]/baseapp/msg_service_router.go:118 +0x8a\ngithub.com/cosmos/ibc-go/v6/modules/core/04-channel/types._Msg_RecvPacket_Handler({0x2876860, 0xc003976000}, {0x36816d8, 0xc0fa3c42c8}, 0x2fab6a0, 0xc0fa3a2320)\n\tgithub.com/cosmos/ibc-go/[email protected]/modules/core/04-channel/types/tx.pb.go:1324 +0x143\ngithub.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).RegisterService.func2({{0x3681668, 0x4dc67c0}, {0x3695c10, 0xc0f2bacf80}, {{0xb, 0x0}, {0xc05d420790, 0xd}, 0x7c6b5e, {0x2c3892a4, ...}, ...}, ...}, ...)\n\tgithub.com/cosmos/[email protected]/baseapp/msg_service_router.go:145 +0x2e3\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runMsgs(_, {{0x3681668, 0x4dc67c0}, {0x3695c10, 0xc0f2bacf80}, {{0xb, 0x0}, {0xc05d420790, 0xd}, 0x7c6b5e, ...}, ...}, ...)\n\tgithub.com/cosmos/[email protected]/baseapp/baseapp.go:788 +0x2c5\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc003956fc0, 0x2, {0xc1088aa000, 0x8541, 0xa000})\n\tgithub.com/cosmos/[email protected]/baseapp/baseapp.go:728 +0xd05\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Simulate(...)\n\tgithub.com/cosmos/[email protected]/baseapp/test_helpers.go:25\ngithub.com/cosmos/cosmos-sdk/x/auth/tx.txServer.Simulate({{{0x0, 0x0, 0x0}, {0x36aa610, 0xc00cd8e420}, 0x0, {0x0, 0x0}, {0x369dd20, 0xc001320db0}, ...}, ...}, ...)\n\tgithub.com/cosmos/[email protected]/x/auth/tx/service.go:132 +0x12f\ngithub.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler.func1({0x36819b0?, 0xc157401740?}, {0x27a6c60?, 0xc0f9499bc0?})\n\tgithub.com/cosmos/[email protected]/types/tx/service.pb.go:933 +0xcb\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func1({0x36819b0, 0xc0f1c792c0}, {0x27a6c60, 0xc0f9499bc0}, 0xc0f9499be0?, 0xc0f94629c0)\n\tgithub.com/cosmos/[email protected]/baseapp/grpcserver.go:68 +0x391\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2.ChainUnaryServer.2.1({0x36819b0?, 0xc0f1c792c0?}, {0x27a6c60?, 0xc0f9499bc0?})\n\tgithub.com/grpc-ecosystem/[email protected]/chain.go:48 +0x45\ngithub.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1({0x36819b0?, 0xc0f1c792c0?}, {0x27a6c60?, 0xc0f9499bc0?}, 0x0?, 0xc0f94629c0?)\n\tgithub.com/grpc-ecosystem/[email protected]/recovery/interceptors.go:33 +0xb0\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2.ChainUnaryServer.2({0x36819b0, 0xc0f1c792c0}, {0x27a6c60, 0xc0f9499bc0}, 0xc0f9499be0, 0x28?)\n\tgithub.com/grpc-ecosystem/[email protected]/chain.go:53 +0x123\ngithub.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler({0x272c460, 0xc012e8a1c0}, {0x36819b0, 0xc0f1c792c0}, 0xc0f7c69300, 0xc0f1c792f0)\n\tgithub.com/cosmos/[email protected]/types/tx/service.pb.go:935 +0x143\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2({0x272c460, 0xc012e8a1c0}, {0x36819b0, 0xc0f1c792c0}, 0xc0f7c69300, 0xc0f9e8c000?)\n\tgithub.com/cosmos/[email protected]/baseapp/grpcserver.go:82 +0x112\ngoogle.golang.org/grpc.(*Server).processUnaryRPC(0xc027132000, {0x36819b0, 0xc13e6580c0}, {0x3693920, 0xc0e69a3500}, 0xc0f9e8c000, 0xc027127e90, 0xc02713e000, 0x0)\n\tgoogle.golang.org/[email protected]/server.go:1379 +0xdf8\ngoogle.golang.org/grpc.(*Server).handleStream(0xc027132000, {0x3693920, 0xc0e69a3500}, 0xc0f9e8c000)\n\tgoogle.golang.org/[email protected]/server.go:1790 +0xe8b\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1()\n\tgoogle.golang.org/[email protected]/server.go:1029 +0x8b\ncreated by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42172150\n\tgoogle.golang.org/[email protected]/server.go:1040 +0x125\n: panic [cosmos/[email protected]/baseapp/recovery.go:69] With gas wanted: '18446744073709551615' and gas used: '553463' ", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "x-cosmos-block-height": "8153950"} }
@joe-bowman joe-bowman changed the title Panic in ics-20 packet delivery Panic in ics-20 packet delivery, when upstream ack is nil Jul 12, 2024
@joe-bowman
Copy link
Contributor Author

The relevant line from the code is:

	ack := im.app.OnRecvPacket(ctx, packet, relayer)
	if ack.Success() {

PacketForwardMiddleware will return nil here, so it seems that PFM transfers will cause this logic to error.

Amending the code as such allows nil returns to fall through as PFM intended. The logic below this point is only relevant to transfers from ICA accounts, that do not utilise PFM, so we can safely short-circuit here and return nil.

	ack := im.app.OnRecvPacket(ctx, packet, relayer)
	if ack == nil {
		// transfer middleware can return nil
		return nil
	}
	if ack.Success() {

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.

1 participant