Skip to content

Commit

Permalink
chore (pkg/scale) integrate scale into dot/core and dot/sync (#1676)
Browse files Browse the repository at this point in the history
* scale into messages_test

* integrate scale into dot core

* integrate scale into dot/sync

* integrate scale into sync and core

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
  • Loading branch information
jimjbrettj and noot committed Jul 8, 2021
1 parent e02eca4 commit 1916f86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions dot/core/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/ChainSafe/gossamer/lib/crypto/sr25519"
"github.com/ChainSafe/gossamer/lib/keystore"
"github.com/ChainSafe/gossamer/lib/runtime"
"github.com/ChainSafe/gossamer/lib/scale"
"github.com/ChainSafe/gossamer/pkg/scale"

"github.com/centrifuge/go-substrate-rpc-client/v3/signature"
ctypes "github.com/centrifuge/go-substrate-rpc-client/v3/types"
Expand All @@ -42,11 +42,12 @@ func createExtrinsic(t *testing.T, rt runtime.Instance, genHash common.Hash, non
rawMeta, err := rt.Metadata()
require.NoError(t, err)

decoded, err := scale.Decode(rawMeta, []byte{})
var decoded []byte
err = scale.Unmarshal(rawMeta, &decoded)
require.NoError(t, err)

meta := &ctypes.Metadata{}
err = ctypes.DecodeFromBytes(decoded.([]byte), meta)
err = ctypes.DecodeFromBytes(decoded, meta)
require.NoError(t, err)

rv, err := rt.Version()
Expand Down
4 changes: 2 additions & 2 deletions dot/core/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"github.com/ChainSafe/gossamer/lib/keystore"
"github.com/ChainSafe/gossamer/lib/runtime"
rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage"
"github.com/ChainSafe/gossamer/lib/scale"
"github.com/ChainSafe/gossamer/lib/services"
"github.com/ChainSafe/gossamer/lib/transaction"
"github.com/ChainSafe/gossamer/pkg/scale"
log "github.com/ChainSafe/log15"
)

Expand Down Expand Up @@ -431,7 +431,7 @@ func (s *Service) handleChainReorg(prev, curr common.Hash) error {
// currently we are attempting to re-add inherents, causing lots of "'Bad input data provided to validate_transaction" errors.
for _, ext := range exts {
logger.Debug("validating transaction on re-org chain", "extrinsic", ext)
encExt, err := scale.Encode(ext)
encExt, err := scale.Marshal(ext)
if err != nil {
return err
}
Expand Down

0 comments on commit 1916f86

Please sign in to comment.