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

x/ibc migrate genesis proto #6878

Merged
merged 39 commits into from
Aug 7, 2020
Merged

Conversation

atheeshp
Copy link
Contributor

ref: #5917

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

Merging #6878 into master will increase coverage by 0.15%.
The diff coverage is 45.79%.

@@            Coverage Diff             @@
##           master    #6878      +/-   ##
==========================================
+ Coverage   61.86%   62.01%   +0.15%     
==========================================
  Files         421      519      +98     
  Lines       25498    32060    +6562     
==========================================
+ Hits        15775    19883    +4108     
- Misses       8371    10559    +2188     
- Partials     1352     1618     +266     

@fedekunze
Copy link
Collaborator

Thanks @atheeshp! @colin-axner and I can take it from here. We are working on the final migrations to switch ibc to be full-proto compatible

@fedekunze fedekunze added C:Encoding C:genesis relating to chain genesis x/ibc labels Aug 6, 2020
@fedekunze fedekunze mentioned this pull request Aug 6, 2020
9 tasks
@atheeshp
Copy link
Contributor Author

atheeshp commented Aug 6, 2020

Thanks @atheeshp! @colin-axner and I can take it from here. We are working on the final migrations to switch ibc to be full-proto compatible

Sure, go on.

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

tested ACK

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

🎉

@colin-axner
Copy link
Contributor

sims on import/export are still failing for me locally. Is there something we need to do to flip the switch to proto from amino?

@sahith-narahari
Copy link
Contributor

sims on import/export are still failing for me locally. Is there something we need to do to flip the switch to proto from amino?

@colin-axner I'm taking a look now, will let you know if I can find what's causing this

@sahith-narahari
Copy link
Contributor

@colin-axner @fedekunze I see ClientState is not a proto message, is there a reason for not migrating these types.

type ClientState struct {

type ClientState struct {

@fedekunze
Copy link
Collaborator

fedekunze commented Aug 7, 2020

We need to remove them. They have already been migrated to protobuf

@sahith-narahari I see that your diff if outdated? Those types are already migrated on this branch

@sahith-narahari
Copy link
Contributor

Oh yes, you're right. Sorry, my bad

@colin-axner
Copy link
Contributor

colin-axner commented Aug 7, 2020

we are going to automerge this since the same sims failing are still failing on master. We will open up a followup pr to try to fix the sims (since the changes should be outside the scope of this pr), which I suspect requires using proto instead of amino, unless we should still be able to be amino compatible while using Any in our keeper? From what I can tell debugging the issue seems to be that amino encoding doesn't decode our types into a pointer which causes marshaling in our keeper to fail

@colin-axner colin-axner added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 7, 2020
@mergify mergify bot merged commit ceba0cb into master Aug 7, 2020
@mergify mergify bot deleted the atheesh/5917-ibc-migrate-genesis-proto branch August 7, 2020 08:33
@aaronc aaronc mentioned this pull request Aug 7, 2020
16 tasks
@colin-axner
Copy link
Contributor

colin-axner commented Aug 7, 2020

so specifically the issue here is:

we want to marshal/unmarshal *types.ClientState but with the hybrid codec it unmarshal it to types.ClientState which causes an encoding error. With the proto codec this works fine as our unit test proves, but I can't switch the sims to encode/decode via proto only because:

cannot protobuf JSON encode unsupported type: simapp.GenesisState since GenesisState isn't defined as a proto message.

My understanding between the compatibility of amino and proto is very limited. I have been under the impression, IBC will not support any amino compatibility. Maybe there is still work to be done to switch to proto for genesis? Is there a way to proto define map[string]json.RawMessage? Is there a way IBC can temporarily support amino via codec registration just to pass sims before the switch is made? Is it expected that amino support encoding *codectypes.Any correctly?

Would love help with this, I'm just running in circles atm.

cc/ @sahith-narahari

larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* migrated channel genesis types to proto

* connection genesis types migrated to proto

* client proto migration

* failing tests due to tendermint part incomplete

* add genesis test

* x/ibc: ClientState Any

* add genesis test

* suite NotPanics

* comment tests

* update export logic

* refactor

* update test

* fix non-determinism

* castrepeated

* x/ibc: migrate simulations to protobuf

* add proto genesis

* add UnpackInterfaces func to genclientstate

* add unpackinterfaces for consensus states

* formatting

* fix genesis tests

* add modified genesis test

* update comments

* remove localhost register codec

* use app registry

* fix bug

* Update simapp/app.go

* Update x/ibc/02-client/types/genesis.go

* unmarshaler interface

Co-authored-by: Colin Axner <colinaxner@berkeley.edu>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Encoding C:genesis relating to chain genesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants