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

Cannot relay acknowledgement from the first empty VSC packet back to provider #240

Closed
danwt opened this issue Jul 18, 2022 · 5 comments
Closed
Assignees
Labels
type: bug Issues that need priority attention -- something isn't working

Comments

@danwt
Copy link
Contributor

danwt commented Jul 18, 2022

When I test acknowledgements, there is an error delivering the first ACK from the consumer back to the provider. That is: the first empty VSC packet is required in order to complete the init handshake. The ack for this fails to be delivered using the ibc-go testing framework.

I need to debug more but this is not a priority. Here is the ack data

github.com/cosmos/interchain-security/x/ccv/difftest_test.Ack {ack: []uint8 len: 17, cap: 24, [123,34,114,101,115,117,108,116,34,58,34,65,81,61,61,34,125], packet: github.com/cosmos/ibc-go/v3/modules/core/04-channel/types.Packet {Sequence: 1, SourcePort: "provider", SourceChannel: "channel-0", DestinationPort: "consumer", DestinationChannel: "channel-0", Data: []uint8 len: 64, cap: 64, [123,34,118,97,108,105,100,97,116,111,114,95,117,112,100,97,116,101,115,34,58,91,93,44,34,118,97,108,115,101,116,95,117,112,100,97,116,101,95,105,100,34,58,34,49,54,34,44,34,115,108,97,115,104,95,97,99,107,115,34,58,91,93,125], TimeoutHeight: (*"github.com/cosmos/ibc-go/v3/modules/core/02-client/types.Height")(0x140010be5f0), TimeoutTimestamp: 1580342545000000000}, commits: 2}

here is the error

--- FAIL: TestDTTestSuite (0.07s)
    --- FAIL: TestDTTestSuite/TestAssumptions (0.07s)
        test_helpers.go:260:
            	Error Trace:	test_helpers.go:260
            	            				relay.go:89
            	            				diff_test.go:531
            	            				diff_test.go:610
            	            				diff_test.go:649
            	            				diff_test.go:390
            	            				suite.go:148
            	Error:      	Received unexpected error:

            	            	github.com/cosmos/cosmos-sdk/x/capability/keeper.ScopedKeeper.LookupModules
            	            		/Users/danwt/Documents/work/cosmos-sdk/x/capability/keeper/keeper.go:440
            	            	github.com/cosmos/ibc-go/v3/modules/core/04-channel/keeper.Keeper.LookupModuleByChannel
            	            		/Users/danwt/Documents/work/informal-ibc-go/modules/core/04-channel/keeper/keeper.go:435
            	            	github.com/cosmos/ibc-go/v3/modules/core/keeper.Keeper.Acknowledgement
            	            		/Users/danwt/Documents/work/informal-ibc-go/modules/core/keeper/msg_server.go:590
            	            	github.com/cosmos/ibc-go/v3/modules/core/04-channel/types._Msg_Acknowledgement_Handler.func1
            	            		/Users/danwt/Documents/work/informal-ibc-go/modules/core/04-channel/types/tx.pb.go:1360
            	            	github.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).RegisterService.func2.1
            	            		/Users/danwt/Documents/work/cosmos-sdk/baseapp/msg_service_router.go:113
            	            	github.com/cosmos/ibc-go/v3/modules/core/04-channel/types._Msg_Acknowledgement_Handler
            	            		/Users/danwt/Documents/work/informal-ibc-go/modules/core/04-channel/types/tx.pb.go:1362
            	            	github.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).RegisterService.func2
            	            		/Users/danwt/Documents/work/cosmos-sdk/baseapp/msg_service_router.go:117
            	            	github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runMsgs
            	            		/Users/danwt/Documents/work/cosmos-sdk/baseapp/baseapp.go:720
            	            	github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx
            	            		/Users/danwt/Documents/work/cosmos-sdk/baseapp/baseapp.go:677
            	            	github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Deliver
            	            		/Users/danwt/Documents/work/cosmos-sdk/baseapp/test_helpers.go:33
            	            	github.com/cosmos/ibc-go/v3/testing/simapp.SignAndDeliver
            	            		/Users/danwt/Documents/work/informal-ibc-go/testing/simapp/test_helpers.go:257
            	            	github.com/cosmos/interchain-security/x/ccv/difftest.TryRecvAck
            	            		/Users/danwt/Documents/work/interchain-security/x/ccv/difftest/relay.go:89
            	            	command-line-arguments_test.(*DTTestSuite).idempotentDeliverAcks
            	            		/Users/danwt/Documents/work/interchain-security/x/ccv/difftest/diff_test.go:531
            	            	command-line-arguments_test.(*DTTestSuite).endBlock
            	            		/Users/danwt/Documents/work/interchain-security/x/ccv/difftest/diff_test.go:610
            	            	command-line-arguments_test.(*DTTestSuite).jumpNBlocks
            	            		/Users/danwt/Documents/work/interchain-security/x/ccv/difftest/diff_test.go:649
            	            	command-line-arguments_test.(*DTTestSuite).SetupTest
            	            		/Users/danwt/Documents/work/interchain-security/x/ccv/difftest/diff_test.go:390
            	            	github.com/stretchr/testify/suite.Run.func1
            	            		/Users/danwt/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:148
            	            	failed to execute message; message index: 0: could not retrieve module from port-id: capabilities/ports/provider/channels/channel-0: capability not found
            	Test:       	TestDTTestSuite/TestAssumptions
FAIL
FAIL	command-line-arguments	0.558s

here is the relevant code

https://github.com/cosmos/cosmos-sdk/blob/c99a6318143ddc5c66c7ad9ec6f6c1dca2170b8c/x/capability/keeper/keeper.go#L435-L445

and here is the capability name and ctx

"capabilities/ports/provider/channels/channel-0"
github.com/cosmos/cosmos-sdk/types.Context {ctx: context.Context(*context.emptyCtx) *0, ms: github.com/cosmos/cosmos-sdk/store/types.MultiStore(github.com/cosmos/cosmos-sdk/store/cachemulti.Store) {db: github.com/cosmos/cosmos-sdk/store/types.CacheKVStore(*github.com/cosmos/cosmos-sdk/store/cachekv.Store) ..., stores: map[github.com/cosmos/cosmos-sdk/store/types.StoreKey]github.com/cosmos/cosmos-sdk/store/types.CacheWrap [...], keys: map[string]github.com/cosmos/cosmos-sdk/store/types.StoreKey nil, traceWriter: io.Writer nil, traceContext: github.com/cosmos/cosmos-sdk/store/types.TraceContext nil, listeners: map[github.com/cosmos/cosmos-sdk/store/types.StoreKey][]github.com/cosmos/cosmos-sdk/store/types.WriteListener []}, header: github.com/tendermint/tendermint/proto/tendermint/types.Header {Version: (*"github.com/tendermint/tendermint/proto/tendermint/version.Consensus")(0x140010b9c08), ChainID: "testchain1", Height: 20, Time: (*time.Time)(0x140010b9c30), LastBlockId: (*"github.com/tendermint/tendermint/proto/tendermint/types.BlockID")(0x140010b9c48), LastCommitHash: []uint8 len: 0, cap: 0, nil, DataHash: []uint8 len: 0, cap: 0, nil, ValidatorsHash: []uint8 len: 32, cap: 32, [8,86,137,25,164,165,8,153,55,61,217,145,113,69,42,182,31,138,56,217,118,77,151,15,119,174,251,215,184,207,190,99], NextValidatorsHash: []uint8 len: 32, cap: 32, [8,86,137,25,164,165,8,153,55,61,217,145,113,69,42,182,31,138,56,217,118,77,151,15,119,174,251,215,184,207,190,99], ConsensusHash: []uint8 len: 0, cap: 0, nil, AppHash: []uint8 len: 32, cap: 32, [133,97,132,167,232,77,82,98,146,218,42,183,97,76,195,20,184,80,36,225,139,62,168,192,137,166,176,83,161,222,101,43], LastResultsHash: []uint8 len: 0, cap: 0, nil, EvidenceHash: []uint8 len: 0, cap: 0, nil, ProposerAddress: []uint8 len: 0, cap: 0, nil}, headerHash: github.com/tendermint/tendermint/libs/bytes.HexBytes len: 0, cap: 0, [], chainID: "testchain1", txBytes: []uint8 len: 1104, cap: 1104, [10,165,7,10,128,7,10,39,47,105,98,99,46,99,111,114,101,46,99,104,97,110,110,101,108,46,118,49,46,77,115,103,65,99,107,110,111,119,108,101,100,103,101,109,101,110,116,18,212,6,10,122,8,1,18,8,112,114,111,118,105,100,101,114,...+1040 more], logger: github.com/tendermint/tendermint/libs/log.Logger(*github.com/tendermint/tendermint/libs/log.nopLogger) *{}, voteInfo: []github.com/tendermint/tendermint/abci/types.VoteInfo len: 0, cap: 0, nil, gasMeter: github.com/cosmos/cosmos-sdk/store/types.GasMeter(*github.com/cosmos/cosmos-sdk/store/types.basicGasMeter) *{limit: 1000000, consumed: 50982}, blockGasMeter: github.com/cosmos/cosmos-sdk/store/types.GasMeter(*github.com/cosmos/cosmos-sdk/store/types.basicGasMeter) *{limit: 2000000, consumed: 95890}, checkTx: false, recheckTx: false, minGasPrice: github.com/cosmos/cosmos-sdk/types.DecCoins len: 0, cap: 0, [], consParams: *github.com/tendermint/tendermint/abci/types.ConsensusParams {Block: *(*"github.com/tendermint/tendermint/abci/types.BlockParams")(0x140013d2010), Evidence: *(*"github.com/tendermint/tendermint/proto/tendermint/types.EvidenceParams")(0x14001356060), Validator: *(*"github.com/tendermint/tendermint/proto/tendermint/types.ValidatorParams")(0x140016fc0d8), Version: *github.com/tendermint/tendermint/proto/tendermint/types.VersionParams nil}, eventManager: *github.com/cosmos/cosmos-sdk/types.EventManager {events: github.com/cosmos/cosmos-sdk/types.Events len: 0, cap: 0, []}}
@danwt danwt added the type: bug Issues that need priority attention -- something isn't working label Jul 18, 2022
@danwt danwt self-assigned this Jul 18, 2022
@danwt
Copy link
Contributor Author

danwt commented Jul 18, 2022

This could be a false positive or a problem with the way the test is setup.

@danwt danwt moved this to Todo in Replicated Security Jul 18, 2022
danwt pushed a commit that referenced this issue Jul 18, 2022
@danwt
Copy link
Contributor Author

danwt commented Jul 18, 2022

Replication commit

cd x/ccv/difftest
go test -run TestDTTestSuite/TestAssumptions diff_test.go

danwt pushed a commit that referenced this issue Jul 18, 2022
@mpoke
Copy link
Contributor

mpoke commented Jul 28, 2022

When I test acknowledgements, there is an error delivering the first ACK from the consumer back to the provider. That is: the first empty VSC packet is required in order to complete the init handshake. The ack for this fails to be delivered using the ibc-go testing framework.

Why "the first empty VSC packet"?

The first VSC packet is sent either here

(in case there are pending VSCs) or here once GetChainToChannel(ctx, chainID) returns a channelID, which is set here
err := am.keeper.SetConsumerChain(ctx, channelID)

@danwt
Copy link
Contributor Author

danwt commented Aug 15, 2022

Hey I will look into this again. I was using an empty vsc packet in the tests to explicitly complete the last step of the handshake.

I will check if this is a real bug or if it's just because of the way the test is written.

danwt pushed a commit that referenced this issue Aug 16, 2022
danwt pushed a commit that referenced this issue Aug 17, 2022
@danwt
Copy link
Contributor Author

danwt commented Aug 17, 2022

I had a single character typo.

@danwt danwt closed this as completed Aug 17, 2022
Repository owner moved this from Todo to Done in Replicated Security Aug 17, 2022
danwt pushed a commit that referenced this issue Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issues that need priority attention -- something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants