-
Notifications
You must be signed in to change notification settings - Fork 112
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 #5400 from oasisprotocol/kostko/fix/rt-suspended-e…
…pochrefresh Multiple fixes
- Loading branch information
Showing
6 changed files
with
79 additions
and
9 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 @@ | ||
go/worker/common: Refresh current epoch for suspended runtimes |
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 |
---|---|---|
|
@@ -68,6 +68,8 @@ func translateKnownP2P(in []string) ([]string, uint) { | |
"[email protected]:26656": "H6u9MtuoWRKn5DKSgarj/[email protected]:26656", | ||
// Testnet seed node. | ||
"[email protected]:26656": "HcDFrTp/MqRHtju5bCx6TIhIMd6X/[email protected]:26656", | ||
// Old Testnet seed node. | ||
"[email protected]:26656": "HcDFrTp/MqRHtju5bCx6TIhIMd6X/[email protected]:26656", | ||
} | ||
|
||
var numUnknown uint | ||
|
@@ -720,6 +722,16 @@ func doMigrateConfig(cmd *cobra.Command, args []string) { | |
// Also prune new config. | ||
pruneEmptyMaps(newCfg) | ||
|
||
// If a node has `consensus.validator` set to true and it does not have any runtimes configured, | ||
// the new `mode` should be set to `validator`. | ||
if newValidator, ok := m(newCfg["consensus"])["validator"]; ok { | ||
isValidator, _ := newValidator.(bool) | ||
if _, hasRuntimes := m(newCfg["runtime"])["paths"]; !hasRuntimes && isValidator { | ||
nodeMode = "validator" | ||
delete(m(newCfg["consensus"]), "validator") | ||
} | ||
} | ||
|
||
// Check for options that are only available on the command-line. | ||
if _, ok = oldCfg["debug"]; ok { | ||
logger.Warn("note that some debug.* options are from now on only available on the command-line") | ||
|
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 |
---|---|---|
|
@@ -230,7 +230,38 @@ runtime: | |
- /km/runtimes/keymanager.orc | ||
` | ||
|
||
// Non-valiator node from docs test configuration file. | ||
// Validator node. | ||
const testValidatorConfigRaw = ` | ||
datadir: /node/data | ||
log: | ||
level: | ||
default: info | ||
tendermint: info | ||
tendermint/context: error | ||
format: JSON | ||
genesis: | ||
file: /node/etc/genesis.json | ||
consensus: | ||
validator: true | ||
tendermint: | ||
p2p: | ||
# List of seed nodes to connect to. | ||
# NOTE: You can add additional seed nodes to this list if you want. | ||
seed: | ||
- "[email protected]:26656" | ||
worker: | ||
registration: | ||
# In order for the node to register itself, the entity.json of the entity | ||
# used to provision the node must be available on the node. | ||
entity: /node/entity/entity.json | ||
` | ||
|
||
// Non-validator node from docs test configuration file. | ||
const testDocsNonValidatorConfigRaw = ` | ||
datadir: /node/data | ||
|
@@ -564,6 +595,23 @@ func TestConfigMigrationKM(t *testing.T) { | |
require.Equal(newConfig.Consensus.Validator, false) | ||
} | ||
|
||
func TestConfigMigrationValidator(t *testing.T) { | ||
require := require.New(t) | ||
newConfig := prepareTest(require, testValidatorConfigRaw) | ||
|
||
// Now check if the config struct fields actually match the original state. | ||
require.Equal(newConfig.Mode, config.ModeValidator) | ||
require.Equal(newConfig.Common.DataDir, "/node/data") | ||
require.Equal(newConfig.Common.Log.Format, "JSON") | ||
require.Equal(newConfig.Common.Log.Level["default"], "info") | ||
require.Equal(newConfig.Common.Log.Level["cometbft"], "info") | ||
require.Equal(newConfig.Common.Log.Level["cometbft/context"], "error") | ||
require.Equal(newConfig.Genesis.File, "/node/etc/genesis.json") | ||
require.Equal(newConfig.P2P.Seeds[0], "H6u9MtuoWRKn5DKSgarj/[email protected]:26656") | ||
require.Equal(newConfig.P2P.Seeds[1], "H6u9MtuoWRKn5DKSgarj/[email protected]:9200") | ||
require.Equal(newConfig.Consensus.Validator, false) | ||
} | ||
|
||
func TestConfigMigrationDocsNonValidator(t *testing.T) { | ||
require := require.New(t) | ||
newConfig := prepareTest(require, testDocsNonValidatorConfigRaw) | ||
|
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