From 4cb1e152489650c12bd74b2ae3be4effe401b75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Fri, 12 Nov 2021 10:59:48 +0100 Subject: [PATCH] test-runner: Use stringified Version instead of u64 directly --- go/oasis-test-runner/oasis/fixture.go | 2 +- go/oasis-test-runner/oasis/runtime.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/go/oasis-test-runner/oasis/fixture.go b/go/oasis-test-runner/oasis/fixture.go index 356e06dee35..cdba1703798 100644 --- a/go/oasis-test-runner/oasis/fixture.go +++ b/go/oasis-test-runner/oasis/fixture.go @@ -225,7 +225,7 @@ type RuntimeFixture struct { // nolint: maligned Kind registry.RuntimeKind `json:"kind"` Entity int `json:"entity"` Keymanager int `json:"keymanager"` - Version uint64 `json:"version"` + Version string `json:"version"` Binaries map[node.TEEHardware][]string `json:"binaries"` GenesisState storage.WriteLog `json:"genesis_state,omitempty"` diff --git a/go/oasis-test-runner/oasis/runtime.go b/go/oasis-test-runner/oasis/runtime.go index 985811d6198..1c3cde56540 100644 --- a/go/oasis-test-runner/oasis/runtime.go +++ b/go/oasis-test-runner/oasis/runtime.go @@ -54,7 +54,7 @@ type RuntimeCfg struct { // nolint: maligned Keymanager *Runtime TEEHardware node.TEEHardware MrSigner *sgx.MrSigner - Version uint64 + Version string Binaries map[node.TEEHardware][]string GenesisState storage.WriteLog @@ -149,13 +149,18 @@ func (rt *Runtime) ToRuntimeDescriptor() registry.Runtime { // NewRuntime provisions a new runtime and adds it to the network. func (net *Network) NewRuntime(cfg *RuntimeCfg) (*Runtime, error) { + rtVer, err := version.FromString(cfg.Version) + if err != nil { + return nil, fmt.Errorf("oasis/runtime: failed to parse runtime version: %w", err) + } + descriptor := registry.Runtime{ Versioned: cbor.NewVersioned(registry.LatestRuntimeDescriptorVersion), ID: cfg.ID, EntityID: cfg.Entity.entity.ID, Kind: cfg.Kind, TEEHardware: cfg.TEEHardware, - Version: registry.VersionInfo{Version: version.FromU64(cfg.Version)}, + Version: registry.VersionInfo{Version: rtVer}, Executor: cfg.Executor, TxnScheduler: cfg.TxnScheduler, Storage: cfg.Storage, @@ -226,7 +231,7 @@ func (net *Network) NewRuntime(cfg *RuntimeCfg) (*Runtime, error) { binaries: cfg.Binaries, teeHardware: cfg.TEEHardware, mrSigner: cfg.MrSigner, - version: cfg.Version, + version: rtVer.ToU64(), pruner: cfg.Pruner, excludeFromGenesis: cfg.ExcludeFromGenesis, descriptor: descriptor,