mirror of https://github.com/poanetwork/gecko.git
load balance the P-chain bootstrapping, bump the version
This commit is contained in:
parent
b73e087f9d
commit
f9f1f08b9b
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/ava-labs/gecko/utils/formatting"
|
||||
"github.com/ava-labs/gecko/utils/hashing"
|
||||
"github.com/ava-labs/gecko/utils/logging"
|
||||
"github.com/ava-labs/gecko/utils/random"
|
||||
"github.com/ava-labs/gecko/utils/wrappers"
|
||||
)
|
||||
|
||||
|
@ -56,11 +57,26 @@ func GetIPs(networkID uint32) []string {
|
|||
switch networkID {
|
||||
case genesis.DenaliID:
|
||||
return []string{
|
||||
"3.20.56.211:21001",
|
||||
"18.224.140.156:21001",
|
||||
"3.133.83.66:21001",
|
||||
"3.133.131.39:21001",
|
||||
"18.188.121.35:21001",
|
||||
"3.133.83.66:21001",
|
||||
"3.15.206.239:21001",
|
||||
"18.224.140.156:21001",
|
||||
"3.133.131.39:21001",
|
||||
"18.191.29.54:21001",
|
||||
"18.224.172.110:21001",
|
||||
"18.223.211.203:21001",
|
||||
"18.216.130.143:21001",
|
||||
"18.223.184.147:21001",
|
||||
"52.15.48.84:21001",
|
||||
"18.189.194.220:21001",
|
||||
"18.223.119.104:21001",
|
||||
"3.133.155.41:21001",
|
||||
"13.58.170.174:21001",
|
||||
"3.21.245.246:21001",
|
||||
"52.15.190.149:21001",
|
||||
"18.188.95.241:21001",
|
||||
"3.12.197.248:21001",
|
||||
"3.17.39.236:21001",
|
||||
}
|
||||
case genesis.CascadeID:
|
||||
return []string{
|
||||
|
@ -75,6 +91,68 @@ func GetIPs(networkID uint32) []string {
|
|||
}
|
||||
}
|
||||
|
||||
// GetIDs returns the default IDs for each network
|
||||
func GetIDs(networkID uint32) []string {
|
||||
switch networkID {
|
||||
case genesis.DenaliID:
|
||||
return []string{
|
||||
"NpagUxt6KQiwPch9Sd4osv8kD1TZnkjdk",
|
||||
"2m38qc95mhHXtrhjyGbe7r2NhniqHHJRB",
|
||||
"LQwRLm4cbJ7T2kxcxp4uXCU5XD8DFrE1C",
|
||||
"hArafGhY2HFTbwaaVh1CSCUCUCiJ2Vfb",
|
||||
"4QBwET5o8kUhvt9xArhir4d3R25CtmZho",
|
||||
"HGZ8ae74J3odT8ESreAdCtdnvWG1J4X5n",
|
||||
"4KXitMCoE9p2BHA6VzXtaTxLoEjNDo2Pt",
|
||||
"JyE4P8f4cTryNV8DCz2M81bMtGhFFHexG",
|
||||
"EzGaipqomyK9UKx9DBHV6Ky3y68hoknrF",
|
||||
"CYKruAjwH1BmV3m37sXNuprbr7dGQuJwG",
|
||||
"LegbVf6qaMKcsXPnLStkdc1JVktmmiDxy",
|
||||
"FesGqwKq7z5nPFHa5iwZctHE5EZV9Lpdq",
|
||||
"BFa1padLXBj7VHa2JYvYGzcTBPQGjPhUy",
|
||||
"4B4rc5vdD1758JSBYL1xyvE5NHGzz6xzH",
|
||||
"EDESh4DfZFC15i613pMtWniQ9arbBZRnL",
|
||||
"CZmZ9xpCzkWqjAyS7L4htzh5Lg6kf1k18",
|
||||
"CTtkcXvVdhpNp6f97LEUXPwsRD3A2ZHqP",
|
||||
"84KbQHSDnojroCVY7vQ7u9Tx7pUonPaS",
|
||||
"JjvzhxnLHLUQ5HjVRkvG827ivbLXPwA9u",
|
||||
"4CWTbdvgXHY1CLXqQNAp22nJDo5nAmts6",
|
||||
}
|
||||
case genesis.CascadeID:
|
||||
return []string{
|
||||
"NX4zVkuiRJZYe6Nzzav7GXN3TakUet3Co",
|
||||
"CMsa8cMw4eib1Hb8GG4xiUKAq5eE1BwUX",
|
||||
"DsMP6jLhi1MkDVc3qx9xx9AAZWx8e87Jd",
|
||||
"N86eodVZja3GEyZJTo3DFUPGpxEEvjGHs",
|
||||
"EkKeGSLUbHrrtuayBtbwgWDRUiAziC3ao",
|
||||
}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// GetDefaultBootstraps returns the default bootstraps this node should connect
|
||||
// to
|
||||
func GetDefaultBootstraps(networkID uint32, count int) ([]string, []string) {
|
||||
ips := GetIPs(networkID)
|
||||
ids := GetIDs(networkID)
|
||||
|
||||
if numIPs := len(ips); numIPs < count {
|
||||
count = numIPs
|
||||
}
|
||||
|
||||
sampledIPs := make([]string, 0, count)
|
||||
sampledIDs := make([]string, 0, count)
|
||||
|
||||
sampler := random.Uniform{N: len(ips)}
|
||||
for i := 0; i < count; i++ {
|
||||
i := sampler.Sample()
|
||||
sampledIPs = append(sampledIPs, ips[i])
|
||||
sampledIDs = append(sampledIDs, ids[i])
|
||||
}
|
||||
|
||||
return sampledIPs, sampledIDs
|
||||
}
|
||||
|
||||
// Parse the CLI arguments
|
||||
func init() {
|
||||
errs := &wrappers.Errs{}
|
||||
|
@ -206,9 +284,11 @@ func init() {
|
|||
Port: uint16(*consensusPort),
|
||||
}
|
||||
|
||||
defaultBootstrapIPs, defaultBootstrapIDs := GetDefaultBootstraps(networkID, 5)
|
||||
|
||||
// Bootstrapping:
|
||||
if *bootstrapIPs == "default" {
|
||||
*bootstrapIPs = strings.Join(GetIPs(networkID), ",")
|
||||
*bootstrapIPs = strings.Join(defaultBootstrapIPs, ",")
|
||||
}
|
||||
for _, ip := range strings.Split(*bootstrapIPs, ",") {
|
||||
if ip != "" {
|
||||
|
@ -227,7 +307,7 @@ func init() {
|
|||
if *bootstrapIPs == "" {
|
||||
*bootstrapIDs = ""
|
||||
} else {
|
||||
*bootstrapIDs = strings.Join(genesis.GetConfig(networkID).StakerIDs, ",")
|
||||
*bootstrapIDs = strings.Join(defaultBootstrapIDs, ",")
|
||||
}
|
||||
}
|
||||
if Config.EnableStaking {
|
||||
|
|
|
@ -55,7 +55,7 @@ const (
|
|||
var (
|
||||
genesisHashKey = []byte("genesisID")
|
||||
|
||||
nodeVersion = version.NewDefaultVersion("avalanche", 0, 5, 1)
|
||||
nodeVersion = version.NewDefaultVersion("avalanche", 0, 5, 2)
|
||||
versionParser = version.NewDefaultParser()
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue