Skip to content

UnreceivedPackets grpc query handler only works for unordered channels #1532

Closed
@plafer

Description

@plafer

Summary of Bug

UnreceivedPackets builds the response only by looking for a corresponding packet receipt for every sequence number included in the query (see here). This only works for unordered channels, as ordered channels use nextSequenceRecv rather than packet receipts. Therefore, on ordered channels, the query response will include all sequence numbers that were present in the query, as no receipt will be found for any of them.

Version

v3.0.0

Steps to Reproduce

I used the interchain accounts demo repo to confirm the problem, as interchain accounts use ordered channels. After installation,

In terminal 1,

$ make init
$ make start-rly

In terminal 2,

export DEMOWALLET_1=$(icad keys show demowallet1 -a --keyring-backend test --home ./data/test-1) && echo $DEMOWALLET_1;
export DEMOWALLET_2=$(icad keys show demowallet2 -a --keyring-backend test --home ./data/test-2) && echo $DEMOWALLET_2;

# This will have hermes relay the channel handshake in terminal 1
icad tx intertx register --from $DEMOWALLET_1 --connection-id connection-0 --chain-id test-1 --home ./data/test-1 --node tcp://localhost:16657 --keyring-backend test -y

# Once the channel is opened on both chains...
export ICA_ADDR=$(icad query intertx interchainaccounts connection-0 $DEMOWALLET_1 --home ./data/test-1 --node tcp://localhost:16657 -o json | jq -r '.interchain_account_address') && echo $ICA_ADDR

At this point, hit ^C in terminal 1 to stop hermes from relaying packets. We will create a sendPacket on test-1, recv it on test-2, and then query unreceived packets on test-2 to confirm that the chain claims that our packet has not been received, even though it has.

In terminal 2, send the packet.

icad tx intertx submit \
'{
    "@type":"/cosmos.bank.v1beta1.MsgSend",
    "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz",
    "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw",
    "amount": [
        {
            "denom": "stake",
            "amount": "1000"
        }
    ]
}' --connection-id connection-0 --from $DEMOWALLET_1 --chain-id test-1 --home ./data/test-1 --node tcp://localhost:16657 --keyring-backend test -y

In terminal 1,

# Confirm that we see 1 unreceived packet
hermes -c network/hermes/config.toml query packet unreceived-packets test-2 icahost channel-0

# Recv the packet on test-2 (make sure you run this before the packet times out)
hermes -c network/hermes/config.toml tx raw packet-recv test-2 test-1 icacontroller-cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud channel-0

# Confirm that we *still* see 1 unreceived packet
hermes -c network/hermes/config.toml query packet unreceived-packets test-2 icahost channel-0

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

client-UXhelp wantedIssues for which we would appreciate help/support from the communitytype: bugSomething isn't working as expected

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions