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

fix: replace missing interfaces to x/profiles module protobuf codec into app codec #1270

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

dadamu
Copy link
Contributor

@dadamu dadamu commented Dec 1, 2023

Description

Closes: #XXXX

This PR fixes the registry with empty interfaces, it causes the LinkChainAccountPacketData can not be parsed properly with the error:

unable to resolve type URL /cosmos.crypto.secp256k1.PubKey
unable to resolve type URL /desmos.profiles.v3.Bech32Address

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@dadamu dadamu requested a review from a team as a code owner December 1, 2023 08:04
@github-actions github-actions bot added the x/profiles Module that allows to create and manage decentralized social profiles label Dec 1, 2023
@dadamu dadamu changed the title fix: register missing interfaces to x/profiles module codec fix: register missing interfaces to x/profiles module protobuf codec Dec 1, 2023
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (d113646) 81.49% compared to head (01aa47c) 81.49%.
Report is 3 commits behind head on master.

Files Patch % Lines
x/profiles/ibc_module.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1270   +/-   ##
=======================================
  Coverage   81.49%   81.49%           
=======================================
  Files         218      218           
  Lines       18270    18273    +3     
=======================================
+ Hits        14889    14892    +3     
  Misses       2772     2772           
  Partials      609      609           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

//
// The actual codec used for serialization should be provided to x/profiles and
// defined at the application level.
func ModuleCdc() *codec.ProtoCodec {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this changed from a variable to a method? If we do this, each time we wall ModuleCdc we are de-facto re-registering all the interfaces and returning a new coded. Which might impact performance issues. Why wasn't this kept as a variable and an init method used instead if needed?

Copy link
Contributor Author

@dadamu dadamu Dec 4, 2023

Choose a reason for hiding this comment

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

The init of models.pb.go runs after the codec.go init.
It causes that the interfaces registration of x/profiles is before proto message name registration so the typeURL of x/profiles types are always /, finally, it leads the error as follows:

panic: concrete type *types.Base58Address has already been registered under typeURL /, cannot register *types.HexAddress under same typeURL. This usually means that there are conflicting modules registering different concrete types for a same interface implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realize that the current app codec is already proto codec which registered all the required modules, so we can use it directly without any problems instead of maintaining another one for x/profiles

@dadamu dadamu changed the title fix: register missing interfaces to x/profiles module protobuf codec fix: replace missing interfaces to x/profiles module protobuf codec into app codec Dec 4, 2023
@RiccardoM RiccardoM merged commit 4f604d3 into master Dec 4, 2023
34 of 35 checks passed
@RiccardoM RiccardoM deleted the paul/fix-profiles-module-cdc branch December 4, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x/profiles Module that allows to create and manage decentralized social profiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants