Skip to content

Commit

Permalink
Merge branch 'development' into eclesio/grandpa-roundState-rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior authored Jul 9, 2021
2 parents 0338913 + 6d38d76 commit 32bbf8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dot/rpc/modules/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/runtime"
"github.com/ChainSafe/gossamer/lib/scale"
"github.com/ChainSafe/gossamer/pkg/scale"
)

// StateCallRequest holds json fields
Expand Down Expand Up @@ -272,8 +272,9 @@ func (sm *StateModule) GetMetadata(r *http.Request, req *StateRuntimeMetadataQue
return err
}

decoded, err := scale.Decode(metadata, []byte{})
*res = StateMetadataResponse(common.BytesToHex(decoded.([]byte)))
var decoded []byte
err = scale.Unmarshal(metadata, &decoded)
*res = StateMetadataResponse(common.BytesToHex(decoded))
return err
}

Expand Down
7 changes: 4 additions & 3 deletions dot/rpc/modules/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/crypto"
"github.com/ChainSafe/gossamer/lib/scale"
"github.com/ChainSafe/gossamer/pkg/scale"
ctypes "github.com/centrifuge/go-substrate-rpc-client/v3/types"
)

Expand Down Expand Up @@ -196,12 +196,13 @@ func (sm *SystemModule) AccountNextIndex(r *http.Request, req *StringRequest, re
if err != nil {
return err
}
sdMeta, err := scale.Decode(rawMeta, []byte{})
var sdMeta []byte
err = scale.Unmarshal(rawMeta, &sdMeta)
if err != nil {
return err
}
var metadata ctypes.Metadata
err = ctypes.DecodeFromBytes(sdMeta.([]byte), &metadata)
err = ctypes.DecodeFromBytes(sdMeta, &metadata)
if err != nil {
return err
}
Expand Down

0 comments on commit 32bbf8a

Please sign in to comment.