Skip to content

Commit 45772bf

Browse files
authored
chore: Integrate scale package into runtime (#1824)
* revise APIItems * update scale integration for version * rm lib/runtime/extrinsic * lib/runtime/life updates * update wasmer * wip * update skipped test * cr feedback, fixed storageAppend * update test
1 parent 3d949f2 commit 45772bf

19 files changed

+466
-1406
lines changed

dot/core/service_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ import (
3333
"github.com/ChainSafe/gossamer/lib/common"
3434
"github.com/ChainSafe/gossamer/lib/keystore"
3535
"github.com/ChainSafe/gossamer/lib/runtime"
36-
"github.com/ChainSafe/gossamer/lib/runtime/extrinsic"
3736
runtimemocks "github.com/ChainSafe/gossamer/lib/runtime/mocks"
3837
"github.com/ChainSafe/gossamer/lib/runtime/storage"
3938
"github.com/ChainSafe/gossamer/lib/runtime/wasmer"
4039
"github.com/ChainSafe/gossamer/lib/transaction"
4140
"github.com/ChainSafe/gossamer/lib/trie"
41+
"github.com/ChainSafe/gossamer/pkg/scale"
4242
log "github.com/ChainSafe/log15"
4343
"github.com/stretchr/testify/mock"
4444
"github.com/stretchr/testify/require"
@@ -287,9 +287,10 @@ func TestHandleChainReorg_WithReorg_Transactions(t *testing.T) {
287287
addTestBlocksToState(t, height, s.blockState.(*state.BlockState))
288288

289289
// create extrinsic
290-
ext := extrinsic.NewIncludeDataExt([]byte("nootwashere"))
291-
tx, err := ext.Encode()
290+
enc, err := scale.Marshal([]byte("nootwashere"))
292291
require.NoError(t, err)
292+
// we prefix with []byte{2} here since that's the enum index for the old IncludeDataExt extrinsic
293+
tx := append([]byte{2}, enc...)
293294

294295
bhash := s.blockState.BestBlockHash()
295296
rt, err := s.blockState.GetRuntime(&bhash)

dot/rpc/modules/api_mocks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func NewMockCoreAPI() *modulesmocks.MockCoreAPI {
5656
}
5757

5858
// NewMockVersion creates and returns an runtime Version interface mock
59-
func NewMockVersion() *runtimemocks.MockVersion {
60-
m := new(runtimemocks.MockVersion)
59+
func NewMockVersion() *runtimemocks.Version {
60+
m := new(runtimemocks.Version)
6161
m.On("SpecName").Return([]byte(`mock-spec`))
6262
m.On("ImplName").Return(nil)
6363
m.On("AuthoringVersion").Return(uint32(0))

dot/rpc/modules/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func (*StateModule) SubscribeStorage(_ *http.Request, _ *StateStorageQueryRangeR
443443
}
444444

445445
// ConvertAPIs runtime.APIItems to []interface
446-
func ConvertAPIs(in []*runtime.APIItem) []interface{} {
446+
func ConvertAPIs(in []runtime.APIItem) []interface{} {
447447
ret := make([]interface{}, 0)
448448
for _, item := range in {
449449
encStr := hex.EncodeToString(item.Name[:])

dot/state/block_notify_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ func TestService_RegisterUnRegisterConcurrentCalls(t *testing.T) {
182182
}
183183

184184
// NewMockVersion creates and returns an runtime Version interface mock
185-
func NewMockVersion(specVer uint32) *runtimemocks.MockVersion {
186-
m := new(runtimemocks.MockVersion)
185+
func NewMockVersion(specVer uint32) *runtimemocks.Version {
186+
m := new(runtimemocks.Version)
187187
m.On("SpecName").Return([]byte(`mock-spec`))
188188
m.On("ImplName").Return(nil)
189189
m.On("AuthoringVersion").Return(uint32(0))

0 commit comments

Comments
 (0)