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

adr-028 address generation #8415

Merged
merged 30 commits into from
Feb 15, 2021
Merged

adr-028 address generation #8415

merged 30 commits into from
Feb 15, 2021

Conversation

robert-zaremba
Copy link
Collaborator

@robert-zaremba robert-zaremba commented Jan 22, 2021

Description

ADR-028 implementation

closes: ADR-028 address generation algorithm #8414
closes: Extensible address format #5694


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 changed the title Robert/adr 28 poc adr-028 address generation Jan 22, 2021
@robert-zaremba robert-zaremba marked this pull request as draft January 22, 2021 14:52
@lgtm-com
Copy link

lgtm-com bot commented Jan 22, 2021

This pull request introduces 1 alert when merging 5eb4e97 into 31fdee0 - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@lgtm-com
Copy link

lgtm-com bot commented Jan 27, 2021

This pull request introduces 1 alert when merging 90a0a39 into e2f510a - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #8415 (0d6325c) into master (a534a96) will increase coverage by 0.02%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8415      +/-   ##
==========================================
+ Coverage   61.46%   61.48%   +0.02%     
==========================================
  Files         656      658       +2     
  Lines       37542    37569      +27     
==========================================
+ Hits        23074    23100      +26     
  Misses      12059    12059              
- Partials     2409     2410       +1     
Impacted Files Coverage Δ
codec/amino.go 72.22% <ø> (ø)
crypto/keyring/legacy.go 44.77% <ø> (ø)
crypto/keys/ed25519/ed25519.go 69.38% <ø> (+2.04%) ⬆️
types/errors/handle.go 0.00% <0.00%> (ø)
x/auth/types/account.go 75.42% <ø> (ø)
crypto/keys/secp256k1/secp256k1.go 86.27% <100.00%> (-0.52%) ⬇️
types/address/hash.go 100.00% <100.00%> (ø)
x/staking/types/validator.go 62.50% <100.00%> (-0.39%) ⬇️

@robert-zaremba
Copy link
Collaborator Author

The issue you described for ed25519 also effects secp25k1. There are networks using secp256k1 as consensus key.

secp256k1 is not a problem, because it's addresses won't change - in ADR-28 defines an exempt for secp256k1.

@robert-zaremba
Copy link
Collaborator Author

Let's continue a discussion re ed25519 in #8543

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

lgtm

// It's needed for Any serialization and SDK compatibility.
// It must not be used in a non Tendermint key context because it doesn't implement
// ADR-28. Nevertheless, you will like to use ed25519 in app user level
// then you must create a new proto message and follow ADR-28 for Address construction.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it could be useful to explicity say in the comments how the address is formed for these pubkeys.

Comment on lines +23 to +25
hasher := sha256.New()
hasher.Write(unsafeStrToByteArray(typ))
th := hasher.Sum(nil)
Copy link
Member

Choose a reason for hiding this comment

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

Let's cache this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be cached in a public key structure, not here. O you have some better idea?

@clevinson clevinson assigned blushi and unassigned amaury1093 Feb 10, 2021
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.

Looks good overall! Just small nits and tests refactoring request.
I was also wondering about Submodule account addresses, don't we wanna add that too in here?

crypto/keys/ed25519/ed25519.go Outdated Show resolved Hide resolved
types/address/hash_test.go Outdated Show resolved Hide resolved
types/address/hash_test.go Show resolved Hide resolved
@@ -0,0 +1,90 @@
package address
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use test packages, please?

Suggested change
package address
package address_test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are unit tests.

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.

I was also wondering about Submodule account addresses, don't we wanna add that too in here?

It doesn't seem like this question has been addressed.

Lint command is still failing.

@robert-zaremba
Copy link
Collaborator Author

I was also wondering about Submodule account addresses, don't we wanna add that too in here?

It doesn't seem like this question has been addressed.

Sorry, I missed it. You mean the Submodule function from the ADR? We don't have a clear use-case for it. It's left in the ADR as a note for further investigation.

The linter was complaining locally re gocritics, not sure why it's there. I will check it.

@robert-zaremba robert-zaremba added the A:automerge Automatically merge PR once all prerequisites pass. label Feb 15, 2021
@mergify mergify bot merged commit adbf5a7 into master Feb 15, 2021
@mergify mergify bot deleted the robert/adr-28-poc branch February 15, 2021 15:32
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:Crypto
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants