Skip to content

Commit

Permalink
Merge pull request #3846 from oasisprotocol/kostko/feature/registry-r…
Browse files Browse the repository at this point in the history
…t-nokm-to-km

go/registry: Allow update from no key manager to with key manager
  • Loading branch information
kostko committed Apr 9, 2021
2 parents 862fbfb + b3b47e0 commit 210751e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .changelog/3802.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/registry: Allow update from no key manager to with key manager
7 changes: 4 additions & 3 deletions go/registry/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,14 +1120,15 @@ func VerifyRuntimeUpdate(logger *logging.Logger, currentRt, newRt *Runtime) erro
logger.Error("RegisterRuntime: trying to update genesis")
return ErrRuntimeUpdateNotAllowed
}
if (currentRt.KeyManager == nil) != (newRt.KeyManager == nil) {
logger.Error("RegisterRuntime: trying to change key manager",
// Going from having a key manager to no key manager is not allowed.
if currentRt.KeyManager != nil && newRt.KeyManager == nil {
logger.Error("RegisterRuntime: trying to remove key manager",
"current_km", currentRt.KeyManager,
"new_km", newRt.KeyManager,
)
return ErrRuntimeUpdateNotAllowed
}
// Both descriptors must either have the key manager set or not.
// If the key manager was set before it must not change.
if currentRt.KeyManager != nil && !currentRt.KeyManager.Equal(newRt.KeyManager) {
logger.Error("RegisterRuntime: trying to change key manager",
"current_km", currentRt.KeyManager,
Expand Down

0 comments on commit 210751e

Please sign in to comment.