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

Add & update IBC queriers for relayer use #5901

Merged
merged 10 commits into from
Apr 2, 2020
Merged

Conversation

cwgoes
Copy link
Contributor

@cwgoes cwgoes commented Apr 1, 2020

Closes #5829
Closes #5617

Note that for #5617 all channels are still iterated over, since we don't store a reverse mapping from connection identifiers to a set of channels. I think this is fine for now - we don't really want to store that in Merklized state since there is no reason to use it in the state machine.

@codecov
Copy link

codecov bot commented Apr 1, 2020

Codecov Report

Merging #5901 into ibc-alpha will decrease coverage by 0.05%.
The diff coverage is 25.64%.

@@              Coverage Diff              @@
##           ibc-alpha    #5901      +/-   ##
=============================================
- Coverage      59.30%   59.25%   -0.06%     
=============================================
  Files            397      397              
  Lines          22988    23015      +27     
=============================================
+ Hits           13634    13638       +4     
- Misses          8434     8457      +23     
  Partials         920      920              

x/ibc/03-connection/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/keeper_test.go Outdated Show resolved Hide resolved
@cwgoes cwgoes marked this pull request as ready for review April 1, 2020 11:33
@cwgoes cwgoes changed the title Update IBC queries Add & update IBC queriers for relayer use Apr 1, 2020
@fedekunze fedekunze added the x/ibc label Apr 1, 2020
@@ -15,10 +15,16 @@ const (
QueryClientConnections = "client_connections"
)

// IdentifiedConnectionEnd defines the union of a connection end & an identifier.
type IdentifiedConnectionEnd struct {
ConnectionEnd
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think (?) this should use a pointer *ConnectionEnd. I'd also double-check that the JSON field is "connection_end" instead of "ConnectionEnd"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, the idea was to embed the JSON fields - does that not work?

Copy link
Member

Choose a reason for hiding this comment

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

This is working on the relayer fwiw, but would be helpful to add a json tag: json:"connection_end"

Copy link
Member

Choose a reason for hiding this comment

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

[
  {
    "ConnectionEnd": {
      "state": "OPEN",
      "client_id": "ibconeclient",
      "counterparty": {
        "client_id": "ibczeroclient",
        "connection_id": "ibczeroconnection",
        "prefix": {
          "type": "ibc/commitment/MerklePrefix",
          "value": {
            "key_prefix": "aWJj"
          }
        }
      },
      "versions": [
        "1.0.0"
      ]
    },
    "identifier": "ibconeconnection"
  }
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah my bad - updated!

Copy link
Collaborator

@fedekunze fedekunze Apr 1, 2020

Choose a reason for hiding this comment

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

open to suggestion but wouldn't it be cleaner to add the identifier to the IdentifiedConnectionEnd flattened?

[
  {
      "identifier": "ibconeconnection",
      "state": "OPEN",
      "client_id": "ibconeclient",
      "counterparty": {
        "client_id": "ibczeroclient",
        "connection_id": "ibczeroconnection",
        "prefix": {
          "type": "ibc/commitment/MerklePrefix",
          "value": {
            "key_prefix": "aWJj"
          }
        }
      },
      "versions": [
        "1.0.0"
      ]
  }
]

Copy link
Contributor Author

@cwgoes cwgoes Apr 2, 2020

Choose a reason for hiding this comment

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

That was what I originally tried to do - how does one do that in Go (is that what the pointer is for)?

x/ibc/04-channel/keeper/querier.go Outdated Show resolved Hide resolved
@jackzampolin
Copy link
Member

This is ready to go!

@jackzampolin jackzampolin merged commit fa2ea30 into ibc-alpha Apr 2, 2020
@jackzampolin jackzampolin deleted the cwgoes/query-updates branch April 2, 2020 16:09
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 this pull request may close these issues.

4 participants