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

Update x/auth to use Any #6165

Merged
merged 25 commits into from
May 20, 2020
Merged

Conversation

sahith-narahari
Copy link
Contributor

@sahith-narahari sahith-narahari commented May 7, 2020

Description

ref: #6081

@auto-comment
Copy link

auto-comment bot commented May 7, 2020

👋 Thanks for creating a PR!

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.


For contributor use:

  • 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

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

Thank you for your contribution to the Cosmos-SDK! 🚀

@codecov
Copy link

codecov bot commented May 10, 2020

Codecov Report

Merging #6165 into master will increase coverage by 0.02%.
The diff coverage is 72.47%.

@@            Coverage Diff             @@
##           master    #6165      +/-   ##
==========================================
+ Coverage   54.72%   54.75%   +0.02%     
==========================================
  Files         443      442       -1     
  Lines       26918    26960      +42     
==========================================
+ Hits        14732    14763      +31     
- Misses      11152    11162      +10     
- Partials     1034     1035       +1     

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

great work @sahith-narahari!

x/auth/module.go Outdated Show resolved Hide resolved
x/auth/vesting/types/codec.go Show resolved Hide resolved
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.

looks good. minor comments

x/auth/client/tx.go Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/module.go Show resolved Hide resolved
x/auth/module.go Outdated Show resolved Hide resolved
x/auth/simulation/decoder.go Outdated Show resolved Hide resolved
x/auth/vesting/types/vesting_account.go Outdated Show resolved Hide resolved
x/auth/types/codec.go Outdated Show resolved Hide resolved
x/auth/types/codec.go Outdated Show resolved Hide resolved
x/auth/vesting/types/codec.go Outdated Show resolved Hide resolved
x/auth/vesting/types/codec.go Outdated Show resolved Hide resolved
@aaronc aaronc added the T: Proto Breaking Protobuf breaking changes: generally don't do this! label May 19, 2020
&ModuleAccount{},
)
}

// RegisterKeyTypeCodec registers an external concrete type defined in
// another module for the internal ModuleCdc.
func RegisterKeyTypeCodec(o interface{}, name string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fedekunze would you still need this for ethermint, even after removing auth/Codec

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK

@aaronc aaronc added the A:automerge Automatically merge PR once all prerequisites pass. label May 20, 2020
@aaronc aaronc requested review from fedekunze and removed request for hschoenburg May 20, 2020 17:31
Comment on lines 29 to 31
//
// TODO:/XXX: Using a package-level global isn't ideal and we should consider
// refactoring the module manager to allow passing in the correct module codec.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
//
// TODO:/XXX: Using a package-level global isn't ideal and we should consider
// refactoring the module manager to allow passing in the correct module codec.

Comment on lines +22 to +27
registry.RegisterInterface(
"cosmos_sdk.auth.v1.AccountI",
(*AccountI)(nil),
&BaseAccount{},
&ModuleAccount{},
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: if I want to add another account type? do I register is as follows? @aaronc :

	registry.RegisterInterface(
		"cosmos_sdk.auth.v1.AccountI",
		(*AccountI)(nil),
		&EthermintAccount{},
	)

Copy link
Collaborator

@fedekunze fedekunze May 20, 2020

Choose a reason for hiding this comment

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

asking because the interface will already be registered if the auth is called first

Copy link
Member

Choose a reason for hiding this comment

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

you can just use RegisterImplementations. the name in RegisterInterface is just informational. maybe we should get rid of the ability to add implementations with that method so that it's less confusing

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, it's definitely confusing

@mergify mergify bot merged commit bf8809e into cosmos:master May 20, 2020
@sahith-narahari sahith-narahari deleted the sahith/auth-proto-any branch May 21, 2020 08:55
@clevinson clevinson added this to the v0.39 milestone Jun 11, 2020
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* Migrate keeper codec to use marshaler

* Migrate AccountI to types

* Did go imports

* Fix tests for x/auth

* Cleanup std/codec

* Sort imports

* Fix legacy codec

* Add godoc for RegisterInterfaces

* Add RegisterInterfaces to std

* Fix typo

* Fixed merge changes

* Eliminate vesting import in auth

* Fix lint issues

* Fix tests

* Addressed comments

* Rename interfaces in RegisterInterfaces

* Removed codec.proto from std

* Minor code cleanup

Co-authored-by: Aaron Craelius <[email protected]>
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:x/auth T: Proto Breaking Protobuf breaking changes: generally don't do this!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants