Skip to content

dot/rpc: Implement RPC author_insertKey#765

Merged
edwardmack merged 8 commits intodevelopmentfrom
ed/312-rpc-author_insertKey
Apr 10, 2020
Merged

dot/rpc: Implement RPC author_insertKey#765
edwardmack merged 8 commits intodevelopmentfrom
ed/312-rpc-author_insertKey

Conversation

@edwardmack
Copy link
Copy Markdown
Contributor

@edwardmack edwardmack commented Apr 9, 2020

This PR introduces implementation of RPC call author_insertKey, which inserts the given key into the core keystore. Defined in https://github.com/w3f/PSPs/blob/psp-rpc-api/psp-002.md#author_insertKey

Changes

  • Implement RPC method author_insertKey
  • Create tests for author_insertKey

Tests:

go test ./dot/rpc/...

AND

curl -H "Content-Type: application/json" -X POST http://127.0.0.1:8545 -d '{"id":1, "jsonrpc":"2.0", "method": "author_insertKey", "params":["babe", "0xb7e9185065667390d2ad952a5324e8c365c9bf503dcf97c67a5ce861afe97309", "0x6246ddf254e0b4b4e7dffefc8adf69d212b98ac2b579c362b473fec8c40b4c0a"]}'

Issues:

@noot
Copy link
Copy Markdown
Contributor

noot commented Apr 9, 2020

@edwardmack I think just putting them into the keystore as you're doing right now is okay, and yeah they should be sr25519 keys. in the future we should probably have separate keystores for babe, grandpa, etc. let's make an issue for that

@edwardmack edwardmack marked this pull request as ready for review April 10, 2020 16:23
Comment thread dot/rpc/modules/author_test.go Outdated
}

// newTestService creates a new test core service
func newTestService(t *testing.T, cfg *core.Config) *core.Service {
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.

maybe we could move this to dot/core/test_helpers.go and export it? just so we don't need to duplicate code

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!

Copy link
Copy Markdown
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

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

looking good!

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.

This looks good to me. Nice work!

@edwardmack edwardmack merged commit 3f02bed into development Apr 10, 2020
@edwardmack edwardmack deleted the ed/312-rpc-author_insertKey branch April 10, 2020 17:40
ryanchristo pushed a commit that referenced this pull request Jun 24, 2020
* add InsertKey interface

* implement author_insertKey

* lint issues

* added tests for author_insertKey

* remove unnecessary logging

* fix imports merge conflict

* move newTestSerice to test_helper.go and make public
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.

3 participants