Skip to content

dot/rpc: Implement RPC method author_hasKey#877

Merged
edwardmack merged 9 commits intodevelopmentfrom
ed/312-rpc-author_keys
May 25, 2020
Merged

dot/rpc: Implement RPC method author_hasKey#877
edwardmack merged 9 commits intodevelopmentfrom
ed/312-rpc-author_keys

Conversation

@edwardmack
Copy link
Copy Markdown
Contributor

@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:

Comment thread dot/core/service.go Outdated
Comment thread dot/core/service.go Outdated
return false, err
}
cKeyType := keystore.DetermineKeyType(keyType)
var err2 error
Copy link
Copy Markdown
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
Copy Markdown
Contributor 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.

Comment thread dot/core/service.go

// 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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