From b7273ef851a209a6b028533453fad741729263a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Mon, 20 Jun 2022 14:48:32 +0200 Subject: [PATCH] net-runner: Fix regression introduced in #4564 --- .changelog/4808.bugfix.md | 4 ++++ go/oasis-net-runner/fixtures/default.go | 23 +++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 .changelog/4808.bugfix.md diff --git a/.changelog/4808.bugfix.md b/.changelog/4808.bugfix.md new file mode 100644 index 00000000000..e4f463e91e1 --- /dev/null +++ b/.changelog/4808.bugfix.md @@ -0,0 +1,4 @@ +net-runner: Fix regression introduced in #4564 + +Fix the missing Deployments field when oasis-net-runner generating the genesis +state and no key manager is provided. diff --git a/go/oasis-net-runner/fixtures/default.go b/go/oasis-net-runner/fixtures/default.go index 1df3b2af98a..7712092c894 100644 --- a/go/oasis-net-runner/fixtures/default.go +++ b/go/oasis-net-runner/fixtures/default.go @@ -115,9 +115,9 @@ func newDefaultFixture() (*oasis.NetworkFixture, error) { usingKeymanager := len(viper.GetString(cfgKeymanagerBinary)) > 0 if viper.GetBool(cfgSetupRuntimes) { - fixture.Runtimes = []oasis.RuntimeFixture{ + if usingKeymanager { // Key manager runtime. - { + fixture.Runtimes = append(fixture.Runtimes, oasis.RuntimeFixture{ ID: keymanagerID, Kind: registry.KindKeyManager, Entity: 0, @@ -126,16 +126,14 @@ func newDefaultFixture() (*oasis.NetworkFixture, error) { AnyNode: ®istry.AnyNodeRuntimeAdmissionPolicy{}, }, GovernanceModel: registry.GovernanceEntity, - }, - } - if usingKeymanager { - fixture.Runtimes[0].Deployments = []oasis.DeploymentCfg{ - { - Binaries: map[node.TEEHardware]string{ - tee: viper.GetString(cfgKeymanagerBinary), + Deployments: []oasis.DeploymentCfg{ + { + Binaries: map[node.TEEHardware]string{ + tee: viper.GetString(cfgKeymanagerBinary), + }, }, }, - } + }) fixture.KeymanagerPolicies = []oasis.KeymanagerPolicyFixture{ {Runtime: 0, Serial: 1}, } @@ -200,11 +198,12 @@ func newDefaultFixture() (*oasis.NetworkFixture, error) { }, }, }) + rtIndex := len(fixture.Runtimes) - 1 for j := range fixture.ComputeWorkers { - fixture.ComputeWorkers[j].Runtimes = append(fixture.ComputeWorkers[j].Runtimes, i+1) + fixture.ComputeWorkers[j].Runtimes = append(fixture.ComputeWorkers[j].Runtimes, rtIndex) } - fixture.Clients[0].Runtimes = append(fixture.Clients[0].Runtimes, i+1) + fixture.Clients[0].Runtimes = append(fixture.Clients[0].Runtimes, rtIndex) } }