Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"sort"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
|
|
|
|
goversion "github.com/hashicorp/go-version"
|
|
|
|
"github.com/pelletier/go-toml"
|
|
|
|
|
|
|
|
"github.com/harmony-one/harmony/api/service/legacysync"
|
|
|
|
harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony"
|
|
|
|
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
)
|
|
|
|
|
|
|
|
const legacyConfigVersion = "1.0.4"
|
|
|
|
|
|
|
|
func doMigrations(confVersion string, confTree *toml.Tree) error {
|
|
|
|
Ver, err := goversion.NewVersion(confVersion)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("invalid or missing config file version - '%s'", confVersion)
|
|
|
|
}
|
|
|
|
legacyVer, _ := goversion.NewVersion(legacyConfigVersion)
|
|
|
|
migrationKey := confVersion
|
|
|
|
if Ver.LessThan(legacyVer) {
|
|
|
|
migrationKey = legacyConfigVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
migration, found := migrations[migrationKey]
|
|
|
|
|
|
|
|
// Version does not match any of the migration criteria
|
|
|
|
if !found {
|
|
|
|
return fmt.Errorf("unrecognized config version - %s", confVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
for confVersion != tomlConfigVersion {
|
|
|
|
confTree = migration(confTree)
|
|
|
|
confVersion = confTree.Get("Version").(string)
|
|
|
|
migration = migrations[confVersion]
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func migrateConf(confBytes []byte) (harmonyconfig.HarmonyConfig, string, error) {
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
var (
|
|
|
|
migratedFrom string
|
|
|
|
)
|
|
|
|
confTree, err := toml.LoadBytes(confBytes)
|
|
|
|
if err != nil {
|
|
|
|
return harmonyconfig.HarmonyConfig{}, "", fmt.Errorf("config file parse error - %s", err.Error())
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|
|
|
|
confVersion, found := confTree.Get("Version").(string)
|
|
|
|
if !found {
|
|
|
|
return harmonyconfig.HarmonyConfig{}, "", errors.New("config file invalid - no version entry found")
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|
|
|
|
migratedFrom = confVersion
|
|
|
|
if confVersion != tomlConfigVersion {
|
|
|
|
err = doMigrations(confVersion, confTree)
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
if err != nil {
|
|
|
|
return harmonyconfig.HarmonyConfig{}, "", err
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point we must be at current config version so
|
|
|
|
// we can safely unmarshal it
|
|
|
|
var config harmonyconfig.HarmonyConfig
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
if err := confTree.Unmarshal(&config); err != nil {
|
|
|
|
return harmonyconfig.HarmonyConfig{}, "", err
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|
|
|
|
return config, migratedFrom, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
migrations = make(map[string]configMigrationFunc)
|
|
|
|
)
|
|
|
|
|
|
|
|
type configMigrationFunc func(*toml.Tree) *toml.Tree
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
migrations["1.0.4"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
ntStr := confTree.Get("Network.NetworkType").(string)
|
|
|
|
nt := parseNetworkType(ntStr)
|
|
|
|
|
|
|
|
defDNSSyncConf := getDefaultDNSSyncConfig(nt)
|
|
|
|
defSyncConfig := getDefaultSyncConfig(nt)
|
|
|
|
|
|
|
|
// Legacy conf missing fields
|
|
|
|
if confTree.Get("Sync") == nil {
|
|
|
|
confTree.Set("Sync", defSyncConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("HTTP.RosettaPort") == nil {
|
|
|
|
confTree.Set("HTTP.RosettaPort", defaultConfig.HTTP.RosettaPort)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("RPCOpt.RateLimterEnabled") == nil {
|
|
|
|
confTree.Set("RPCOpt.RateLimterEnabled", defaultConfig.RPCOpt.RateLimterEnabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("RPCOpt.RequestsPerSecond") == nil {
|
|
|
|
confTree.Set("RPCOpt.RequestsPerSecond", defaultConfig.RPCOpt.RequestsPerSecond)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("P2P.IP") == nil {
|
|
|
|
confTree.Set("P2P.IP", defaultConfig.P2P.IP)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("Prometheus") == nil {
|
|
|
|
if defaultConfig.Prometheus != nil {
|
|
|
|
confTree.Set("Prometheus", *defaultConfig.Prometheus)
|
|
|
|
}
|
|
|
|
}
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
|
|
|
|
zoneField := confTree.Get("Network.DNSZone")
|
|
|
|
if zone, ok := zoneField.(string); ok {
|
|
|
|
confTree.Set("DNSSync.Zone", zone)
|
|
|
|
}
|
|
|
|
|
|
|
|
portField := confTree.Get("Network.DNSPort")
|
|
|
|
if p, ok := portField.(int64); ok {
|
|
|
|
p = p - legacysync.SyncingPortDifference
|
|
|
|
confTree.Set("DNSSync.Port", p)
|
|
|
|
} else {
|
|
|
|
confTree.Set("DNSSync.Port", nodeconfig.DefaultDNSPort)
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|
|
|
|
|
|
|
|
syncingField := confTree.Get("Network.LegacySyncing")
|
|
|
|
if syncing, ok := syncingField.(bool); ok {
|
|
|
|
confTree.Set("DNSSync.LegacySyncing", syncing)
|
|
|
|
}
|
|
|
|
|
|
|
|
clientField := confTree.Get("Sync.LegacyClient")
|
|
|
|
if client, ok := clientField.(bool); ok {
|
|
|
|
confTree.Set("DNSSync.Client", client)
|
|
|
|
} else {
|
|
|
|
confTree.Set("DNSSync.Client", defDNSSyncConf.Client)
|
|
|
|
}
|
|
|
|
|
|
|
|
serverField := confTree.Get("Sync.LegacyServer")
|
|
|
|
if server, ok := serverField.(bool); ok {
|
|
|
|
confTree.Set("DNSSync.Server", server)
|
|
|
|
} else {
|
|
|
|
confTree.Set("DNSSync.Server", defDNSSyncConf.Client)
|
|
|
|
}
|
|
|
|
|
|
|
|
serverPort := defDNSSyncConf.ServerPort
|
|
|
|
serverPortField := confTree.Get("Sync.LegacyServerPort")
|
|
|
|
if port, ok := serverPortField.(int64); ok {
|
|
|
|
serverPort = int(port)
|
|
|
|
}
|
|
|
|
confTree.Set("DNSSync.ServerPort", serverPort)
|
|
|
|
|
|
|
|
downloaderEnabledField := confTree.Get("Sync.Downloader")
|
|
|
|
if downloaderEnabled, ok := downloaderEnabledField.(bool); ok && downloaderEnabled {
|
|
|
|
// If we enabled downloader previously, run stream sync protocol.
|
|
|
|
confTree.Set("Sync.Enabled", true)
|
|
|
|
}
|
|
|
|
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
confTree.Set("Version", "2.0.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.0.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
// Legacy conf missing fields
|
|
|
|
if confTree.Get("Log.VerbosePrints") == nil {
|
|
|
|
confTree.Set("Log.VerbosePrints", defaultConfig.Log.VerbosePrints)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.1.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.1.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
// Legacy conf missing fields
|
|
|
|
if confTree.Get("Pprof.Enabled") == nil {
|
|
|
|
confTree.Set("Pprof.Enabled", true)
|
|
|
|
}
|
|
|
|
if confTree.Get("Pprof.Folder") == nil {
|
|
|
|
confTree.Set("Pprof.Folder", defaultConfig.Pprof.Folder)
|
|
|
|
}
|
|
|
|
if confTree.Get("Pprof.ProfileNames") == nil {
|
|
|
|
confTree.Set("Pprof.ProfileNames", defaultConfig.Pprof.ProfileNames)
|
|
|
|
}
|
|
|
|
if confTree.Get("Pprof.ProfileIntervals") == nil {
|
|
|
|
confTree.Set("Pprof.ProfileIntervals", defaultConfig.Pprof.ProfileIntervals)
|
|
|
|
}
|
|
|
|
if confTree.Get("Pprof.ProfileDebugValues") == nil {
|
|
|
|
confTree.Set("Pprof.ProfileDebugValues", defaultConfig.Pprof.ProfileDebugValues)
|
|
|
|
}
|
|
|
|
if confTree.Get("P2P.DiscConcurrency") == nil {
|
|
|
|
confTree.Set("P2P.DiscConcurrency", defaultConfig.P2P.DiscConcurrency)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.2.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.2.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("HTTP.AuthPort") == nil {
|
|
|
|
confTree.Set("HTTP.AuthPort", defaultConfig.HTTP.AuthPort)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.3.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.3.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("P2P.MaxConnsPerIP") == nil {
|
|
|
|
confTree.Set("P2P.MaxConnsPerIP", defaultConfig.P2P.MaxConnsPerIP)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.4.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.4.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("WS.AuthPort") == nil {
|
|
|
|
confTree.Set("WS.AuthPort", defaultConfig.WS.AuthPort)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.5.0")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.0"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("TxPool.AccountSlots") == nil {
|
|
|
|
confTree.Set("TxPool.AccountSlots", defaultConfig.TxPool.AccountSlots)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.5.1")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.1"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("P2P.DisablePrivateIPScan") == nil {
|
|
|
|
confTree.Set("P2P.DisablePrivateIPScan", defaultConfig.P2P.DisablePrivateIPScan)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.5.2")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.2"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("RPCOpt.EthRPCsEnabled") == nil {
|
|
|
|
confTree.Set("RPCOpt.EthRPCsEnabled", defaultConfig.RPCOpt.EthRPCsEnabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("RPCOpt.StakingRPCsEnabled") == nil {
|
|
|
|
confTree.Set("RPCOpt.StakingRPCsEnabled", defaultConfig.RPCOpt.StakingRPCsEnabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("RPCOpt.LegacyRPCsEnabled") == nil {
|
|
|
|
confTree.Set("RPCOpt.LegacyRPCsEnabled", defaultConfig.RPCOpt.LegacyRPCsEnabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
if confTree.Get("RPCOpt.RpcFilterFile") == nil {
|
|
|
|
confTree.Set("RPCOpt.RpcFilterFile", defaultConfig.RPCOpt.RpcFilterFile)
|
|
|
|
}
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.5.3")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.3"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("TxPool.AllowedTxsFile") == nil {
|
|
|
|
confTree.Set("TxPool.AllowedTxsFile", defaultConfig.TxPool.AllowedTxsFile)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.4")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.4"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("TxPool.GlobalSlots") == nil {
|
|
|
|
confTree.Set("TxPool.GlobalSlots", defaultConfig.TxPool.GlobalSlots)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.5")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.5"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("Log.Console") == nil {
|
|
|
|
confTree.Set("Log.Console", defaultConfig.Log.Console)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.6")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.6"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("P2P.MaxPeers") == nil {
|
|
|
|
confTree.Set("P2P.MaxPeers", defaultConfig.P2P.MaxPeers)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.7")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
migrations["2.5.7"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
confTree.Delete("DNSSync.LegacySyncing")
|
|
|
|
|
|
|
|
confTree.Set("Version", "2.5.8")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.8"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("Sync.StagedSync") == nil {
|
|
|
|
confTree.Set("Sync.StagedSync", defaultConfig.Sync.StagedSync)
|
|
|
|
confTree.Set("Sync.StagedSyncCfg", defaultConfig.Sync.StagedSyncCfg)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.9")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.9"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("P2P.WaitForEachPeerToConnect") == nil {
|
|
|
|
confTree.Set("P2P.WaitForEachPeerToConnect", defaultConfig.P2P.WaitForEachPeerToConnect)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.10")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
2 years ago
|
|
|
migrations["2.5.10"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("P2P.ConnManagerLowWatermark") == nil {
|
|
|
|
confTree.Set("P2P.ConnManagerLowWatermark", defaultConfig.P2P.ConnManagerLowWatermark)
|
|
|
|
}
|
|
|
|
if confTree.Get("P2P.ConnManagerHighWatermark") == nil {
|
|
|
|
confTree.Set("P2P.ConnManagerHighWatermark", defaultConfig.P2P.ConnManagerHighWatermark)
|
|
|
|
}
|
|
|
|
if confTree.Get("Sync.MaxAdvertiseWaitTime") == nil {
|
|
|
|
confTree.Set("Sync.MaxAdvertiseWaitTime", defaultConfig.Sync.MaxAdvertiseWaitTime)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.11")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.11"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("General.TriesInMemory") == nil {
|
|
|
|
confTree.Set("General.TriesInMemory", defaultConfig.General.TriesInMemory)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.12")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
migrations["2.5.12"] = func(confTree *toml.Tree) *toml.Tree {
|
|
|
|
if confTree.Get("HTTP.ReadTimeout") == nil {
|
|
|
|
confTree.Set("HTTP.ReadTimeout", defaultConfig.HTTP.ReadTimeout)
|
|
|
|
}
|
|
|
|
if confTree.Get("HTTP.WriteTimeout") == nil {
|
|
|
|
confTree.Set("HTTP.WriteTimeout", defaultConfig.HTTP.WriteTimeout)
|
|
|
|
}
|
|
|
|
if confTree.Get("HTTP.IdleTimeout") == nil {
|
|
|
|
confTree.Set("HTTP.IdleTimeout", defaultConfig.HTTP.IdleTimeout)
|
|
|
|
}
|
|
|
|
if confTree.Get("RPCOpt.EvmCallTimeout") == nil {
|
|
|
|
confTree.Set("RPCOpt.EvmCallTimeout", defaultConfig.RPCOpt.EvmCallTimeout)
|
|
|
|
}
|
|
|
|
confTree.Set("Version", "2.5.13")
|
|
|
|
return confTree
|
|
|
|
}
|
|
|
|
|
|
|
|
// check that the latest version here is the same as in default.go
|
|
|
|
largestKey := getNextVersion(migrations)
|
|
|
|
if largestKey != tomlConfigVersion {
|
|
|
|
panic(fmt.Sprintf("next migration value: %s, toml version: %s", largestKey, tomlConfigVersion))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNextVersion(x map[string]configMigrationFunc) string {
|
|
|
|
versionMap := make(map[string]interface{}, 1)
|
|
|
|
versionMap["Version"] = "FakeVersion"
|
|
|
|
tree, _ := toml.TreeFromMap(versionMap)
|
|
|
|
|
|
|
|
// needs to be sorted in case the order is incorrect
|
|
|
|
keys := make([]string, len(x))
|
|
|
|
i := 0
|
|
|
|
for k := range x {
|
|
|
|
keys[i] = k
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
// sorting keys (versions)
|
|
|
|
// each key is in format "x.x.x". Normal sort won't work if the versions
|
|
|
|
// don't have same number of digits, for example 1.02.10 and 1.2.9
|
|
|
|
// so, we need a custom sort
|
|
|
|
sort.Slice(keys, func(i, j int) bool {
|
|
|
|
v1 := keys[i]
|
|
|
|
v2 := keys[j]
|
|
|
|
v1Parts := strings.Split(v1, ".")
|
|
|
|
v2Parts := strings.Split(v2, ".")
|
|
|
|
if len(v1Parts) > len(v2Parts) {
|
|
|
|
return true
|
|
|
|
} else if len(v1Parts) < len(v2Parts) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
for i := 0; i < len(v1Parts); i++ {
|
|
|
|
n1, err1 := strconv.ParseInt(v1Parts[i], 10, 32)
|
|
|
|
if err1 != nil {
|
|
|
|
panic("wrong version format")
|
|
|
|
}
|
|
|
|
n2, err2 := strconv.ParseInt(v2Parts[i], 10, 32)
|
|
|
|
if err2 != nil {
|
|
|
|
panic("wrong version format")
|
|
|
|
}
|
|
|
|
if n1 > n2 {
|
|
|
|
return true
|
|
|
|
} else if n1 < n2 {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
})
|
|
|
|
requiredFunc := x[keys[0]]
|
|
|
|
tree = requiredFunc(tree)
|
|
|
|
return tree.Get("Version").(string)
|
Config 2.0.0
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Inital commit
Removed lint warning
Fixed names, that have changed in dnsSync
Fixed some lint errors
Some functions were exported although no need to be and some test
variables were also renamed
Fixed 1.0.4 migration
- Tests in config_test.go expected wrong version since it was migrated to
2.0.0
- getDefaultHmyConfigCopy did not get DNSSync defaults
- Key for DNSPort for version prior to 1.0.4 was wrong - DNSSyncPort
Added default for DNSSync when creating default Config
Fixed empty string user input crash
Inputing empty string was causing out of bounds index to be read from
readStr
Fixed flags_test to work with config version 2.0.0
Changed DNSSync fields names
It seems that Enabled was not a good name, considering that actually did
the opposite. Also kept LegacyClient and LegacyServer names
Removed Legacy prefix from dnsSync fields
It seems Legacy prefix is obsolite since moving the fields to dsnSync
Fixes regarding config V2.0.0
The following fixes and improvements have been applied
- Added timeout to config update prompt. Prompt logic has been moved to
a separate func
- When updating config file, the original is saved to <config>.backup
- Added semantic version validation for the version found in config. Error is
returned if version is missing, not a valid sematic version or not
found in the migrations map
- Flags related to DNSSync has been moved to dnsSyncFlags flag array.
Also moved tests related to DNSSync flags to separate test func
- Added dns.server and dns.client flags and tests for them
- Added migration tests with dumps of versions 1.0.2, 1.0.3, 1.0.4
Fix for config_migrations_test
Added default value to serverPort during migration
4 years ago
|
|
|
}
|