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

dot/rpc: Implement RPC method author_hasKey #877

Merged
merged 9 commits into from
May 25, 2020

Conversation

edwardmack
Copy link
Member

@edwardmack edwardmack commented May 20, 2020

Changes

Tests:

go test ./dot/rpc/... 

Checklist:

  • I have read CONTRIBUTING and CODE_OF_CONDUCT
  • I have provided as much information as possible and necessary
  • I have reviewed my own pull request before requesting a review
  • I have linked any relevant issues in my pull request comments
  • All integration tests and required coverage checks are passing

Issues:

dot/core/service.go Outdated Show resolved Hide resolved
return false, err
}
cKeyType := keystore.DetermineKeyType(keyType)
var err2 error
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need err2?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I had an issue with shadowing, but I see now that I didn't... Updated.

@@ -496,6 +497,31 @@ func (s *Service) InsertKey(kp crypto.Keypair) {
s.keys.Insert(kp)
}

// HasKey returns true if given hex encoded public key string is found in keystore, false otherwise, error if there
// are issues decoding string
func (s *Service) HasKey(pubKeyStr string, keyType string) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this would probably be better as a function in the keystore package that can be wrapped by core

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, updated.

Copy link
Contributor

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Nothing to add, just the comments from @noot. The main request for me would be moving HasKey to keystore to make it reusable elsewhere. Otherwise, looking good. Nothing blocking.

@edwardmack
Copy link
Member Author

I've moved HasKey to keystore, and addressed other comments. This is ready for another look.

@edwardmack edwardmack merged commit a64e35a into development May 25, 2020
@edwardmack edwardmack deleted the ed/312-rpc-author_keys branch May 25, 2020 13:54
ryanchristo pushed a commit that referenced this pull request Jun 24, 2020
* add stub for rpc call author_hasKey

* implement rpc author_hasKey

* add tests

* update service test

* add tests

* Move HasKey function to keystore package.

Updated key handling for grandpa to use Ed25519 type keys.
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.

4 participants