The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/cmd/harmony/config_migrations.go

343 lines
9.8 KiB

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"
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
}
3 years ago
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
}
Release Candidate: dev -> main (#4319) * Rebase dev branch to current main branch (#4318) * add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. * [dumpdb] ensure each cross link is dumped (#4311) * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix for consensus stuck. (#4307) * Added check for block validity. * Starts new view change if block invalid. * Revert "Starts new view change if block invalid." This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db. * staged dns sync v1.0 (#4316) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * add description for closing client and change randomize process to ma… (#4276) * add description for closing client and change randomize process to make sure only online nodes are added to sync config * fix sync test * fix legacy limitNumPeers test * add WaitForEachPeerToConnect to node configs to make parallel peer connection optional Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Small fixes and code cleanup for network stack. (#4320) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock * staged dns sync v1.0 * Fixed, code clean up and other. * Fixed, code clean up and other. * Fixed, code clean up and other. * Fix config. Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix not disable cache in archival mode (#4322) * Feature registry (#4324) * Registry for services. * Test. * Reverted comment. * Fix. * Slash fix (#4284) * Implementation of new slashing rate calculation * Write tests for then new slashing rate calculation * Add engine.applySlashing tests * fix #4059 Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> * Bump github.com/aws/aws-sdk-go from 1.30.1 to 1.33.0 (#4325) (#4328) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.30.1 to 1.33.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.33.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.30.1...v1.33.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/btcsuite/btcd from 0.21.0-beta to 0.23.2 (#4327) (#4329) Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.21.0-beta to 0.23.2. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/v0.21.0-beta...v0.23.2) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> Co-authored-by: Gheis <36589218+GheisMohammadi@users.noreply.github.com> Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> Co-authored-by: Danny Willis <102543677+dannyposi@users.noreply.github.com> Co-authored-by: PeekPI <894646171@QQ.COM> Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
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
}
Release Candidate: dev -> main (#4319) * Rebase dev branch to current main branch (#4318) * add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. * [dumpdb] ensure each cross link is dumped (#4311) * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix for consensus stuck. (#4307) * Added check for block validity. * Starts new view change if block invalid. * Revert "Starts new view change if block invalid." This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db. * staged dns sync v1.0 (#4316) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * add description for closing client and change randomize process to ma… (#4276) * add description for closing client and change randomize process to make sure only online nodes are added to sync config * fix sync test * fix legacy limitNumPeers test * add WaitForEachPeerToConnect to node configs to make parallel peer connection optional Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Small fixes and code cleanup for network stack. (#4320) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock * staged dns sync v1.0 * Fixed, code clean up and other. * Fixed, code clean up and other. * Fixed, code clean up and other. * Fix config. Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix not disable cache in archival mode (#4322) * Feature registry (#4324) * Registry for services. * Test. * Reverted comment. * Fix. * Slash fix (#4284) * Implementation of new slashing rate calculation * Write tests for then new slashing rate calculation * Add engine.applySlashing tests * fix #4059 Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> * Bump github.com/aws/aws-sdk-go from 1.30.1 to 1.33.0 (#4325) (#4328) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.30.1 to 1.33.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.33.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.30.1...v1.33.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/btcsuite/btcd from 0.21.0-beta to 0.23.2 (#4327) (#4329) Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.21.0-beta to 0.23.2. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/v0.21.0-beta...v0.23.2) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> Co-authored-by: Gheis <36589218+GheisMohammadi@users.noreply.github.com> Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> Co-authored-by: Danny Willis <102543677+dannyposi@users.noreply.github.com> Co-authored-by: PeekPI <894646171@QQ.COM> Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
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
}
Release Candidate: dev -> main (#4319) * Rebase dev branch to current main branch (#4318) * add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. * [dumpdb] ensure each cross link is dumped (#4311) * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix for consensus stuck. (#4307) * Added check for block validity. * Starts new view change if block invalid. * Revert "Starts new view change if block invalid." This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db. * staged dns sync v1.0 (#4316) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * add description for closing client and change randomize process to ma… (#4276) * add description for closing client and change randomize process to make sure only online nodes are added to sync config * fix sync test * fix legacy limitNumPeers test * add WaitForEachPeerToConnect to node configs to make parallel peer connection optional Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Small fixes and code cleanup for network stack. (#4320) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock * staged dns sync v1.0 * Fixed, code clean up and other. * Fixed, code clean up and other. * Fixed, code clean up and other. * Fix config. Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix not disable cache in archival mode (#4322) * Feature registry (#4324) * Registry for services. * Test. * Reverted comment. * Fix. * Slash fix (#4284) * Implementation of new slashing rate calculation * Write tests for then new slashing rate calculation * Add engine.applySlashing tests * fix #4059 Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> * Bump github.com/aws/aws-sdk-go from 1.30.1 to 1.33.0 (#4325) (#4328) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.30.1 to 1.33.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.33.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.30.1...v1.33.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/btcsuite/btcd from 0.21.0-beta to 0.23.2 (#4327) (#4329) Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.21.0-beta to 0.23.2. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/v0.21.0-beta...v0.23.2) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> Co-authored-by: Gheis <36589218+GheisMohammadi@users.noreply.github.com> Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> Co-authored-by: Danny Willis <102543677+dannyposi@users.noreply.github.com> Co-authored-by: PeekPI <894646171@QQ.COM> Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
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
}
Release Candidate: dev -> main (#4319) * Rebase dev branch to current main branch (#4318) * add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. * [dumpdb] ensure each cross link is dumped (#4311) * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix for consensus stuck. (#4307) * Added check for block validity. * Starts new view change if block invalid. * Revert "Starts new view change if block invalid." This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db. * staged dns sync v1.0 (#4316) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * add description for closing client and change randomize process to ma… (#4276) * add description for closing client and change randomize process to make sure only online nodes are added to sync config * fix sync test * fix legacy limitNumPeers test * add WaitForEachPeerToConnect to node configs to make parallel peer connection optional Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Small fixes and code cleanup for network stack. (#4320) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock * staged dns sync v1.0 * Fixed, code clean up and other. * Fixed, code clean up and other. * Fixed, code clean up and other. * Fix config. Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix not disable cache in archival mode (#4322) * Feature registry (#4324) * Registry for services. * Test. * Reverted comment. * Fix. * Slash fix (#4284) * Implementation of new slashing rate calculation * Write tests for then new slashing rate calculation * Add engine.applySlashing tests * fix #4059 Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> * Bump github.com/aws/aws-sdk-go from 1.30.1 to 1.33.0 (#4325) (#4328) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.30.1 to 1.33.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.33.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.30.1...v1.33.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/btcsuite/btcd from 0.21.0-beta to 0.23.2 (#4327) (#4329) Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.21.0-beta to 0.23.2. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/v0.21.0-beta...v0.23.2) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> Co-authored-by: Gheis <36589218+GheisMohammadi@users.noreply.github.com> Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> Co-authored-by: Danny Willis <102543677+dannyposi@users.noreply.github.com> Co-authored-by: PeekPI <894646171@QQ.COM> Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
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
}
Release Candidate: dev -> main (#4319) * Rebase dev branch to current main branch (#4318) * add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. * [dumpdb] ensure each cross link is dumped (#4311) * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * bump libp2p to version 0.24.0 and update its dependencies and relevant tests (#4315) * Removed legacy syncing peer provider. (#4260) * Removed legacy syncing peer provider. * Fix localnet. * Fix migrate version. * Rebased on main. * Fix formatting. * Remove blockchain dependency from engine. (#4310) * Consensus doesn't require anymore `Node` as a circular dependency. * Rebased upon main. * Removed engine beacon chain dependency. * Fixed nil error. * Fixed error. * bump libp2p to version 0.24.0 and update its dependencies and relevant tests * fix format, remove wrongly added configs * add back wrongly deleted comment * fix travis go checker Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix for consensus stuck. (#4307) * Added check for block validity. * Starts new view change if block invalid. * Revert "Starts new view change if block invalid." This reverts commit e889fa5da2e0780f087ab7dae5106b96287706db. * staged dns sync v1.0 (#4316) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * add description for closing client and change randomize process to ma… (#4276) * add description for closing client and change randomize process to make sure only online nodes are added to sync config * fix sync test * fix legacy limitNumPeers test * add WaitForEachPeerToConnect to node configs to make parallel peer connection optional Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Small fixes and code cleanup for network stack. (#4320) * staged dns sync v1.0 * enabled stream downloader for localnet * fix code review issues * remove extra lock * staged dns sync v1.0 * Fixed, code clean up and other. * Fixed, code clean up and other. * Fixed, code clean up and other. * Fix config. Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> * Fix not disable cache in archival mode (#4322) * Feature registry (#4324) * Registry for services. * Test. * Reverted comment. * Fix. * Slash fix (#4284) * Implementation of new slashing rate calculation * Write tests for then new slashing rate calculation * Add engine.applySlashing tests * fix #4059 Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> * Bump github.com/aws/aws-sdk-go from 1.30.1 to 1.33.0 (#4325) (#4328) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.30.1 to 1.33.0. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.33.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.30.1...v1.33.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/btcsuite/btcd from 0.21.0-beta to 0.23.2 (#4327) (#4329) Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.21.0-beta to 0.23.2. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/v0.21.0-beta...v0.23.2) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> Co-authored-by: Gheis <36589218+GheisMohammadi@users.noreply.github.com> Co-authored-by: Konstantin <355847+Frozen@users.noreply.github.com> Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”> Co-authored-by: Danny Willis <102543677+dannyposi@users.noreply.github.com> Co-authored-by: PeekPI <894646171@QQ.COM> Co-authored-by: Alex Brezas <abresas@gmail.com> Co-authored-by: Dimitris Lamprinos <pkakelas@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
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
}
// 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++
}
sort.Strings(keys)
requiredFunc := x[keys[len(keys)-1]]
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
}