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

keys: define proto type #5997

Closed
wants to merge 52 commits into from
Closed

keys: define proto type #5997

wants to merge 52 commits into from

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Apr 15, 2020

Description

This is a simpler approach to defining keys then redefining all the types.

cc @alexanderbez, @fedekunze let me know if your are fine with this approach

note: if a release of tendermint is used we will manually have to switch over the keys as [size]byte is used. this will be removed in the next release

Closes: #5819

Replaces #5868


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)

@tac0turtle tac0turtle changed the title cast types keys: castype instead of redefine key types Apr 15, 2020
@tac0turtle tac0turtle mentioned this pull request Apr 15, 2020
11 tasks
@tac0turtle
Copy link
Member Author

@alexanderbez make proto-gen doesnt work when the folder structure is like so:

 multisig
    ├── bitarray
    │   ├── compact_bit_array.go
    │   ├── compact_bit_array_test.go
    │   └── types.proto
    ├── codec.go
    ├── multisignature.go
    ├── threshold_pubkey.go
    ├── threshold_pubkey_test.go
    └── types.proto

any suggestions on how to overcome this?

@alexanderbez
Copy link
Contributor

@marbar3778 wdym it doesn't work? Do you have output or logs you can provide? AFAIK, codgen doesn't care where the *.proto files reside.

@tac0turtle
Copy link
Member Author

tac0turtle commented Apr 20, 2020

logs:

20/04/21 00:02:48 protoc-gen-gogo: error:inconsistent package import paths: "github.com/cosmos/cosmos-sdk/crypto/keys/multisig", "github.com/cosmos/cosmos-sdk/crypto/keys/multisig/bitarry"
--gocosmos_out: protoc-gen-gocosmos: Plugin failed with status code 1.

i had the same issue in tendermint but had to separate things into different pkgs so didn't solve the issue.

@alexanderbez
Copy link
Contributor

Mhh I'm not familiar with that error. However, bitarry has nothing to do with multisigs, right? Ideally, it should reside under types/.

@alessio
Copy link
Contributor

alessio commented Apr 20, 2020

Mhh I'm not familiar with that error. However, bitarry has nothing to do with multisigs, right? Ideally, it should reside under types/

Do we need to create a sub directory for it? Can we just merge it into the root types directory please?

@tac0turtle
Copy link
Member Author

Do we need to create a sub directory for it? Can we just merge it into the root types directory please?

did that in my latest push

@alessio
Copy link
Contributor

alessio commented Apr 20, 2020

And how about placing multisig directory just under crypto instead of crypto/keys?

@alessio
Copy link
Contributor

alessio commented Apr 21, 2020

@marbar3778 tests are failing:

--- FAIL: TestThresholdMultisigValidCases (0.02s)
    threshold_pubkey_test.go:78: 
        	Error Trace:	threshold_pubkey_test.go:78
        	Error:      	Should be true
        	Test:       	TestThresholdMultisigValidCases
        	Messages:   	multisig failed after k good signatures, tc 0
FAIL
coverage: 28.1% of statements
FAIL	github.com/cosmos/cosmos-sdk/crypto/multisig	0.800s

(otherwise this looks good to me)

@tac0turtle tac0turtle changed the title keys: castype instead of redefine key types keys: define proto type Apr 22, 2020
Copy link
Member

@aaronc aaronc left a comment

Choose a reason for hiding this comment

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

LGTM. Just asked for the future deprecation notice to be clarified.

"github.com/tendermint/tendermint/crypto/sr25519"
)

//TODO: Deprecate this file when tendermint 0.34 is released
Copy link
Member

Choose a reason for hiding this comment

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

Can you say a little bit more about why and what the condition is? Basically if interfacetype can be used right?

@aaronc
Copy link
Member

aaronc commented Apr 27, 2020

Note that this might change based on our transition to Any (#6030, #6081).

Using a string for PubKey type would be most consistent with usage of Any. However, maybe it makes more sense to make it an enum or stick to a oneof.

Not sure where the best place is to discuss this is, maybe this PR? Or maybe we merge this and refactor later?

@tac0turtle
Copy link
Member Author

havent been keeping up with the proto work. Will close this pr and possibly open once I understand what is the new path for proto

@tac0turtle tac0turtle closed this May 12, 2020
@tac0turtle tac0turtle deleted the marko/pubkeys branch June 3, 2020 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Encoding C:Keys Keybase, KMS and HSMs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: move keys to cosmos-sdk
6 participants