From eb963d3c650f6f6cd80b453effddbed71545aa76 Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Tue, 30 Nov 2021 10:56:36 -0500 Subject: [PATCH] fix(lib/babe, lib/runtime/wasmer): fixes for v0.9.8+ runtime (#2075) --- dot/rpc/modules/author.go | 4 ++-- lib/babe/build.go | 3 ++- lib/runtime/wasmer/imports.go | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dot/rpc/modules/author.go b/dot/rpc/modules/author.go index e7c3539801..29015b295d 100644 --- a/dot/rpc/modules/author.go +++ b/dot/rpc/modules/author.go @@ -76,8 +76,8 @@ type decodedKey struct { type ExtrinsicStatus struct { IsFuture bool IsReady bool - Isfinalised bool - Asfinalised common.Hash + IsFinalized bool + AsFinalized common.Hash IsUsurped bool AsUsurped common.Hash IsBroadcast bool diff --git a/lib/babe/build.go b/lib/babe/build.go index 0fbca885c5..c24ff97ccd 100644 --- a/lib/babe/build.go +++ b/lib/babe/build.go @@ -290,7 +290,8 @@ func (b *BlockBuilder) buildBlockExtrinsics(slot Slot, rt runtime.Instance) []*t func (b *BlockBuilder) buildBlockInherents(slot Slot, rt runtime.Instance) ([][]byte, error) { // Setup inherents: add timstap0 idata := types.NewInherentsData() - err := idata.SetInt64Inherent(types.Timstap0, uint64(time.Now().Unix())) + timestamp := uint64(time.Now().UnixMilli()) + err := idata.SetInt64Inherent(types.Timstap0, timestamp) if err != nil { return nil, err } diff --git a/lib/runtime/wasmer/imports.go b/lib/runtime/wasmer/imports.go index 0ef5be9ccd..119a6f9585 100644 --- a/lib/runtime/wasmer/imports.go +++ b/lib/runtime/wasmer/imports.go @@ -1906,10 +1906,14 @@ func ext_storage_clear_prefix_version_2(context unsafe.Pointer, prefixSpan, lim return C.int64_t(ret) } + if len(limit) == 0 { + // limit is None, set limit to max + limit = []byte{0xff, 0xff, 0xff, 0xff} + } + limitUint := binary.LittleEndian.Uint32(limit) numRemoved, all := storage.ClearPrefixLimit(prefix, limitUint) encBytes, err := toKillStorageResultEnum(all, numRemoved) - if err != nil { logger.Errorf("[ext_storage_clear_prefix_version_2] failed to allocate memory: %s", err) ret, _ := toWasmMemory(instanceContext, nil)