Skip to content

Commit

Permalink
fix(polkadot.js) fix -infinity in keys error by adding genesis field (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
noot authored May 13, 2021
1 parent c1b26d3 commit 180962b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chain/dev/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ grandpa = ""
sync = ""

[init]
genesis = "./chain/dev/genesis-spec.json"
genesis = "./chain/dev/genesis.json"

[account]
key = "alice"
Expand Down
2 changes: 1 addition & 1 deletion chain/dev/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
// InitConfig

// DefaultGenesis is the default genesis configuration path
DefaultGenesis = string("./chain/dev/genesis-spec.json")
DefaultGenesis = string("./chain/dev/genesis.json")

// AccountConfig

Expand Down
35 changes: 35 additions & 0 deletions chain/dev/genesis.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dot/rpc/modules/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (sm *StateModule) GetStorage(r *http.Request, req *StateStorageRequest, res
)

reqBytes, _ := common.HexToBytes(req.Key) // no need to catch error here

if req.Bhash != nil {
item, err = sm.storageAPI.GetStorageByBlockHash(*req.Bhash, reqBytes)
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions dot/rpc/subscription/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *WSConn) HandleComm() {
logger.Warn("websocket failed to read message", "error", err)
return
}
logger.Debug("websocket received", "message", mbytes)
logger.Trace("websocket received", "message", mbytes)

// determine if request is for subscribe method type
var msg map[string]interface{}
Expand All @@ -69,11 +69,14 @@ func (c *WSConn) HandleComm() {
c.safeSendError(0, big.NewInt(-32600), "Invalid request")
continue
}

method := msg["method"]
params := msg["params"]
logger.Debug("ws method called", "method", method, "params", params)

// if method contains subscribe, then register subscription
if strings.Contains(fmt.Sprintf("%s", method), "subscribe") {
reqid := msg["id"].(float64)
params := msg["params"]
switch method {
case "chain_subscribeNewHeads", "chain_subscribeNewHead":
bl, err1 := c.initBlockListener(reqid)
Expand Down

0 comments on commit 180962b

Please sign in to comment.