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

Remove bech32 PubKey support #7477

Merged
merged 109 commits into from
Mar 25, 2021
Merged

Remove bech32 PubKey support #7477

merged 109 commits into from
Mar 25, 2021

Conversation

robert-zaremba
Copy link
Collaborator

@robert-zaremba robert-zaremba commented Oct 7, 2020

Description

  • removing bech32 pubkeys functions
  • remove bech32 from keyring
  • removing code duplication

Closes: #7447

This task essentially removes bech32 for public keys in the storage and user layer (clients, outputs etc..).
We are NOT breaking the legacy REST API because it deprecated anyway and will be removed.

Summary

  • removed bech32 from user facing code
  • updated the keyring display structure
  • changed user/client pubkey serialization
  • added new tests for ed25519 as an example on how to properly serialize interfaces (both binary and JSON).
  • few API breaking changes:
  • Created NewJSONAnyMarshaler - a helper method to use codec.(Un)marsjalJSON withing a client context:
am := codec.NewJSONAnyMarshaler(ctx.JSONMarshaler, ctx.InterfaceRegistry)
err := codec.UnmarshalIfcJSON(am, &pk, []byte(pubKey))

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

@robert-zaremba robert-zaremba force-pushed the robert/rm-bech32-pk branch 2 times, most recently from c1b2f9a to 88e04f7 Compare October 7, 2020 21:27
@tac0turtle
Copy link
Member

tac0turtle commented Oct 8, 2020

It may be good to keep the removal of bech32 and removing code duplication/test helper package as two separate PRs. They are orthogonal changes.

If someone needs to come back to this PR to view the changes having it only be the removal of bech32, like the title describes, will make the review quicker

@aaronc
Copy link
Member

aaronc commented Oct 8, 2020

It may be good to keep the removal of bech32 and removing code duplication/test helper package as two separate PRs. They are orthogonal changes.

If someone needs to come back to this PR to view the changes having it only be the removal of bech32, like the title describes, will make the review quicker

I tend to agree with this perspective. I know it's annoying and I've had to regretfully split up many of my PRs for reasons like this. In the end though, I think this approach is the best for the SDK.

@robert-zaremba
Copy link
Collaborator Author

It may be good to keep the removal of bech32 and removing code duplication/test helper package as two separate PRs. They are orthogonal changes.
If someone needs to come back to this PR to view the changes having it only be the removal of bech32, like the title describes, will make the review quicker

I tend to agree with this perspective. I know it's annoying and I've had to regretfully split up many of my PRs for reasons like this. In the end though, I think this approach is the best for the SDK.

Yes. I also agree, however when going through the code it was already in my head to refactor. I won't add more things. All this changes are related - all this edits would require doing extra error check. Instead, I moved it to a function.

@robert-zaremba
Copy link
Collaborator Author

I'm breaking this PR into 2, for the moment I've extracted a code for test refactor and will submit another PR for it.

@clevinson
Copy link
Contributor

This probably also needs to include removing this from the keyring (cc @alexanderbez )

@clevinson clevinson mentioned this pull request Oct 19, 2020
31 tasks
@robert-zaremba robert-zaremba mentioned this pull request Oct 20, 2020
9 tasks
@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2020

This pull request introduces 2 alerts when merging faa822a into 30efa5a - view on LGTM.com

new alerts:

  • 2 for Useless assignment to local variable

server/tm_cmds.go Outdated Show resolved Hide resolved
codec/json.go Outdated Show resolved Hide resolved
@orijbot
Copy link

orijbot commented Mar 24, 2021

client/keys/codec.go Outdated Show resolved Hide resolved
@orijbot
Copy link

orijbot commented Mar 24, 2021

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

Generally looks good. The PR has a bit of scope creep but should be fine. Docs will follow in a different PR right?

Copy link
Contributor

@blushi blushi 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!

@aaronc aaronc dismissed their stale review March 24, 2021 17:43

This has enough reviews and my change request was addressed

@aaronc aaronc added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 24, 2021
@orijbot
Copy link

orijbot commented Mar 24, 2021

@orijbot
Copy link

orijbot commented Mar 24, 2021

@robert-zaremba
Copy link
Collaborator Author

Any idea why the following test is failing so often?

 --- FAIL: TestPaginatedVotesQuery (0.00s)
    querier_test.go:336: 
        	Error Trace:	querier_test.go:336
        	Error:      	Not equal: 
        	            	expected: 19
        	            	actual  : 20
        	Test:       	TestPaginatedVotesQuery
FAIL

@orijbot
Copy link

orijbot commented Mar 25, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

@alessio
Copy link
Contributor

alessio commented Mar 25, 2021

Any idea why the following test is failing so often?

 --- FAIL: TestPaginatedVotesQuery (0.00s)
    querier_test.go:336: 
        	Error Trace:	querier_test.go:336
        	Error:      	Not equal: 
        	            	expected: 19
        	            	actual  : 20
        	Test:       	TestPaginatedVotesQuery
FAIL

Just a flaky test. But it's annoying and no one can really explain why this happens in the first. We definitely need to fix it.

@orijbot
Copy link

orijbot commented Mar 25, 2021

@mergify mergify bot merged commit 7568b66 into master Mar 25, 2021
@mergify mergify bot deleted the robert/rm-bech32-pk branch March 25, 2021 14:53
@orijbot
Copy link

orijbot commented Mar 25, 2021

@robert-zaremba
Copy link
Collaborator Author

yeah, finally merged after 20 attempts to get the CI go through random errors.

@orijbot
Copy link

orijbot commented Mar 25, 2021

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:Types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove bech32 PubKey support
9 participants