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

Key assignment related panic cleanup #642

Merged
merged 7 commits into from
Jan 9, 2023
Merged

Conversation

shaspitz
Copy link
Contributor

@shaspitz shaspitz commented Jan 6, 2023

Description

WIP, optionally we can audit the key related panics in x/ccv/utils/utils.go in this PR as well.

EDIT:

  • utils.TMCryptoPublicKeyToConsAddr should return an error instead.

Linked issues

Works toward #621

Type of change

If you've checked more than one of the first three boxes, consider splitting this PR into multiple PRs!

  • Feature: Changes and/or adds code behavior, irrelevant to bug fixes
  • Fix: Changes and/or adds code behavior, specifically to fix a bug
  • Refactor: Changes existing code style, naming, structure, etc.
  • Testing: Adds testing
  • Docs: Adds documentation

Regression tests

If Refactor, describe the new or existing tests that verify no behavior was changed or added where refactors were introduced.

New behavior tests

If Feature or Fix, describe the new or existing tests that verify the new behavior is correct and expected.

x/ccv/provider/types/genesis.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/key_assignment.go Show resolved Hide resolved
x/ccv/provider/keeper/key_assignment.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/key_assignment.go Outdated Show resolved Hide resolved
@danwt
Copy link
Contributor

danwt commented Jan 6, 2023

Nice job @smarshall-spitzbart!
I've got to check some stuff myself to resolve the remaining TODOs

@shaspitz
Copy link
Contributor Author

shaspitz commented Jan 8, 2023

@mpoke @danwt I believe with #646 merged this PR should just be comments? Seems ready to review tho

@mpoke mpoke marked this pull request as ready for review January 9, 2023 13:55
@mpoke mpoke requested review from jtremback and sainoe as code owners January 9, 2023 13:55
@mpoke mpoke requested a review from MSalopek January 9, 2023 13:55
func TMCryptoPublicKeyToConsAddr(k tmprotocrypto.PublicKey) sdk.ConsAddress {
// TMCryptoPublicKeyToConsAddr converts a TM public key to an SDK public key
// and returns the associated consensus address
func TMCryptoPublicKeyToConsAddr(k tmprotocrypto.PublicKey) (sdk.ConsAddress, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@smarshall-spitzbart I changed this function to return error instead of panicking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @mpoke, looks great!

x/ccv/provider/keeper/key_assignment.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/key_assignment.go Outdated Show resolved Hide resolved
x/ccv/provider/types/genesis.go Outdated Show resolved Hide resolved
x/ccv/provider/types/genesis.go Outdated Show resolved Hide resolved
@shaspitz
Copy link
Contributor Author

shaspitz commented Jan 9, 2023

Re-reviewed myself and LGTM

@shaspitz shaspitz merged commit 9068248 into main Jan 9, 2023
@shaspitz shaspitz deleted the key-assignment-panic-cleanup branch January 9, 2023 17:11
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.

3 participants