diff --git a/lib/runtime/wasmer/exports.go b/lib/runtime/wasmer/exports.go index 8d73b1d7756..7e22fcfc6e0 100644 --- a/lib/runtime/wasmer/exports.go +++ b/lib/runtime/wasmer/exports.go @@ -33,11 +33,6 @@ func (in *Instance) ValidateTransaction(e types.Extrinsic) (*transaction.Validit // Version calls runtime function Core_Version func (in *Instance) Version() (runtime.Version, error) { - // kusama seems to use the legacy version format - if in.version != nil { - return in.version, nil - } - res, err := in.exec(runtime.CoreVersion, []byte{}) if err != nil { return nil, err @@ -141,13 +136,6 @@ func (in *Instance) ExecuteBlock(block *types.Block) ([]byte, error) { return nil, err } - if in.version == nil { - in.version, err = in.Version() - if err != nil { - return nil, err - } - } - b.Header.Digest = types.NewDigest() // remove seal digest only diff --git a/lib/runtime/wasmer/imports.go b/lib/runtime/wasmer/imports.go index 529f5ddb9c2..d09493efd01 100644 --- a/lib/runtime/wasmer/imports.go +++ b/lib/runtime/wasmer/imports.go @@ -949,11 +949,9 @@ func ext_misc_runtime_version_version_1(context unsafe.Pointer, dataSpan C.int64 return 0 } - // instance version is set and cached in NewInstance - version := instance.version - - if version == nil { - logger.Error("failed to get runtime version") + version, err := instance.Version() + if err != nil { + logger.Error("failed to get runtime version: %s", err) out, _ := toWasmMemoryOptional(instanceContext, nil) return C.int64_t(out) } diff --git a/lib/runtime/wasmer/instance.go b/lib/runtime/wasmer/instance.go index da3b5441a9b..217c83433fc 100644 --- a/lib/runtime/wasmer/instance.go +++ b/lib/runtime/wasmer/instance.go @@ -47,7 +47,6 @@ type Config struct { type Instance struct { vm wasm.Instance ctx *runtime.Context - version runtime.Version imports func() (*wasm.Imports, error) isClosed bool codeHash common.Hash @@ -162,7 +161,6 @@ func NewInstance(code []byte, cfg *Config) (*Instance, error) { codeHash: cfg.CodeHash, } - inst.version, _ = inst.Version() return inst, nil } @@ -196,12 +194,6 @@ func (in *Instance) UpdateRuntimeCode(code []byte) error { return err } - in.version = nil - in.version, err = in.Version() - if err != nil { - return err - } - return nil }