Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (pkg/scale) integrate scale into dot/core and dot/sync #1676

Merged
merged 10 commits into from
Jul 8, 2021
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