-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5545 from oasisprotocol/kostko/fix/observer-regis…
…tration go/worker/client: Fix observer node registration
- Loading branch information
Showing
6 changed files
with
73 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go/worker/client: Fix observer node registration | ||
|
||
Previously a node configured as an observer node would forget to | ||
register for all of its configured runtimes, causing the registration | ||
to fail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package committee | ||
|
||
import ( | ||
"github.com/oasisprotocol/oasis-core/go/common/node" | ||
) | ||
|
||
// RegisterNodeRuntime adds our runtime registration to an existing node descriptor. | ||
func (n *Node) RegisterNodeRuntime(nd *node.Node) error { | ||
// Obtain the active runtime version. | ||
activeVersion, err := n.GetHostedRuntimeActiveVersion() | ||
if err != nil { | ||
n.logger.Warn("failed to get active runtime version, skipping", | ||
"err", err, | ||
) | ||
return nil | ||
} | ||
|
||
for _, version := range n.Runtime.HostVersions() { | ||
// Skip sending any old versions that will never be active again. | ||
if version.ToU64() < activeVersion.ToU64() { | ||
continue | ||
} | ||
|
||
// Obtain CapabilityTEE for the given runtime version. | ||
capabilityTEE, err := n.GetHostedRuntimeCapabilityTEEForVersion(version) | ||
if err != nil { | ||
n.logger.Warn("failed to get CapabilityTEE for hosted runtime, skipping", | ||
"err", err, | ||
"version", version, | ||
) | ||
continue | ||
} | ||
|
||
rt := nd.AddOrUpdateRuntime(n.Runtime.ID(), version) | ||
rt.Capabilities.TEE = capabilityTEE | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters