ChainSafe / ChainSafe/gossamer

[RPC] `insertKey` method is not expecting a Substrate URI

Open
#1,709 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Issue summary

- I noticed that at `insertKey` RPC method the **polkadot ui** are sending the `suri` (aka Substrate URI, aka `//Allice`, `//Bob`...) but our RPC method is expecting a hexadecimal seed (if you type `subkey inspect //Allice` you will get the hex seed for the suri `//Allice`), the error the ui got is:

```
could not byteify non 0x prefixed string: null
```

- The `api.rpc.author.insertKey` polkadot js API is expecting a `suri` as paramater as well:
```
insertKey: RpcPromiseResult
(keyType: string | Text, suri: string | Text, publicKey: string | Bytes | Uint8Array)
```

## Screenshots
1) Sending a `suri` but got error response
![image](https://user-images.githubusercontent.com/17255488/127388830-ce7670ca-a356-4ce7-85b1-50d9d09b27c1.png)
the log what gossamer node are receiving:
![image](https://user-images.githubusercontent.com/17255488/127389611-557187ca-8706-4aa0-8f74-631499380bde.png)

2) Trying to send a hex seed, got the same error response:
![image](https://user-images.githubusercontent.com/17255488/127389367-8496ec0b-ed28-4d01-9f74-386decce8181.png)
the log what gossamer node are receiving:
![image](https://user-images.githubusercontent.com/17255488/127389259-db5150a5-bddb-4ccf-b575-0a971325380f.png)

## Other information and links

- Substrate example `insertKey` RPC method: https://github.com/paritytech/substrate/blob/1d5abf01abafdb6c15bcd0172f5de09fd87c5fbf/client/rpc/src/author/mod.rs#L94
- Substrate example `insert_unknow` implementation: https://github.com/paritytech/substrate/blob/7dcc77b982f59eaf6cec19499d981164b04a255d/client/keystore/src/local.rs#L291
- I guess the [`insertKey` RPC spec](https://github.com/w3f/PSPs/blob/master/PSPs/drafts/psp-6.md#185-author_insertkey) is not updated with this info, there says `seed` and the example shows a seed being passed as request parameter

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.