diff --git a/cmd/algocfg/profileCommand.go b/cmd/algocfg/profileCommand.go index 076cb65a64..c96a95d2b9 100644 --- a/cmd/algocfg/profileCommand.go +++ b/cmd/algocfg/profileCommand.go @@ -106,7 +106,7 @@ var ( // P2P config defaults cfg.EnableP2PHybridMode = true - cfg.P2PNetAddress = ":4190" + cfg.P2PHybridNetAddress = ":4190" cfg.EnableDHTProviders = true return cfg }, @@ -125,7 +125,7 @@ var ( // P2P config defaults cfg.EnableP2PHybridMode = true - cfg.P2PNetAddress = ":4190" + cfg.P2PHybridNetAddress = ":4190" cfg.EnableDHTProviders = true return cfg }, diff --git a/cmd/algocfg/profileCommand_test.go b/cmd/algocfg/profileCommand_test.go index 8d7d95a26e..bdec2d6577 100644 --- a/cmd/algocfg/profileCommand_test.go +++ b/cmd/algocfg/profileCommand_test.go @@ -17,9 +17,10 @@ package main import ( - "github.com/algorand/go-algorand/config" "testing" + "github.com/algorand/go-algorand/config" + "github.com/stretchr/testify/require" "github.com/algorand/go-algorand/test/partitiontest" @@ -80,7 +81,7 @@ func Test_getConfigForArg(t *testing.T) { require.Equal(t, config.PlaceholderPublicAddress, cfg.PublicAddress) require.True(t, cfg.EnableP2PHybridMode) - require.Equal(t, ":4190", cfg.P2PNetAddress) + require.Equal(t, ":4190", cfg.P2PHybridNetAddress) require.True(t, cfg.EnableDHTProviders) }) @@ -100,7 +101,7 @@ func Test_getConfigForArg(t *testing.T) { require.Equal(t, config.PlaceholderPublicAddress, cfg.PublicAddress) require.True(t, cfg.EnableP2PHybridMode) - require.Equal(t, ":4190", cfg.P2PNetAddress) + require.Equal(t, ":4190", cfg.P2PHybridNetAddress) require.True(t, cfg.EnableDHTProviders) }) @@ -121,7 +122,7 @@ func Test_getConfigForArg(t *testing.T) { require.Equal(t, "", cfg.PublicAddress) require.True(t, cfg.EnableP2PHybridMode) - require.Equal(t, "", cfg.P2PNetAddress) + require.Equal(t, "", cfg.P2PHybridNetAddress) require.True(t, cfg.EnableDHTProviders) }) } diff --git a/config/config.go b/config/config.go index 65d711cacc..07cd69cbda 100644 --- a/config/config.go +++ b/config/config.go @@ -176,7 +176,7 @@ func enrichNetworkingConfig(source Local) (Local, error) { } // In hybrid mode we want to prevent connections from the same node over both P2P and WS. // The only way it is supported at the moment is to use net identity challenge that is based on PublicAddress. - if (source.NetAddress != "" || source.P2PNetAddress != "") && source.EnableP2PHybridMode && source.PublicAddress == "" { + if (source.NetAddress != "" || source.P2PHybridNetAddress != "") && source.EnableP2PHybridMode && source.PublicAddress == "" { return source, errors.New("PublicAddress must be specified when EnableP2PHybridMode is set") } source.PublicAddress = strings.ToLower(source.PublicAddress) diff --git a/config/config_test.go b/config/config_test.go index 20338766c3..1b1c4c2753 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -153,7 +153,7 @@ func TestLocal_EnrichNetworkingConfig(t *testing.T) { require.ErrorContains(t, err, "PublicAddress must be specified when EnableP2PHybridMode is set") c1 = Local{ - P2PNetAddress: "test1", + P2PHybridNetAddress: "test1", EnableP2PHybridMode: true, } c2, err = enrichNetworkingConfig(c1) @@ -617,23 +617,27 @@ func TestLocal_IsGossipServer(t *testing.T) { require.False(t, cfg.IsGossipServer()) require.False(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.NetAddress = ":4160" require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableGossipService = false // EnableGossipService does not matter require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableP2P = true cfg.NetAddress = ":4160" require.True(t, cfg.IsGossipServer()) require.False(t, cfg.IsWsGossipServer()) require.True(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableP2P = false @@ -642,41 +646,47 @@ func TestLocal_IsGossipServer(t *testing.T) { require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableP2PHybridMode = true cfg.NetAddress = "" require.False(t, cfg.IsGossipServer()) require.False(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableP2PHybridMode = true - cfg.P2PNetAddress = ":4190" + cfg.P2PHybridNetAddress = ":4190" require.True(t, cfg.IsGossipServer()) require.False(t, cfg.IsWsGossipServer()) require.True(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) cfg.EnableP2PHybridMode = true cfg.NetAddress = ":4160" - cfg.P2PNetAddress = ":4190" + cfg.P2PHybridNetAddress = ":4190" require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.True(t, cfg.IsP2PGossipServer()) + require.True(t, cfg.IsHybridServer()) cfg.EnableP2PHybridMode = true cfg.EnableP2P = true cfg.NetAddress = ":4160" - cfg.P2PNetAddress = ":4190" + cfg.P2PHybridNetAddress = ":4190" require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.True(t, cfg.IsP2PGossipServer()) + require.True(t, cfg.IsHybridServer()) cfg.EnableP2PHybridMode = true cfg.EnableP2P = true cfg.NetAddress = ":4160" - cfg.P2PNetAddress = "" + cfg.P2PHybridNetAddress = "" require.True(t, cfg.IsGossipServer()) require.True(t, cfg.IsWsGossipServer()) require.False(t, cfg.IsP2PGossipServer()) + require.False(t, cfg.IsHybridServer()) } func TestLocal_RecalculateConnectionLimits(t *testing.T) { @@ -720,15 +730,15 @@ func TestLocal_RecalculateConnectionLimits(t *testing.T) { t.Parallel() c := Local{ - NetAddress: ":4160", - RestConnectionsSoftLimit: test.restSoftIn, - RestConnectionsHardLimit: test.restHardIn, - IncomingConnectionsLimit: test.incomingIn, - P2PIncomingConnectionsLimit: test.p2pIncomingIn, + NetAddress: ":4160", + RestConnectionsSoftLimit: test.restSoftIn, + RestConnectionsHardLimit: test.restHardIn, + IncomingConnectionsLimit: test.incomingIn, + P2PHybridIncomingConnectionsLimit: test.p2pIncomingIn, } if test.p2pIncomingIn > 0 { c.EnableP2PHybridMode = true - c.P2PNetAddress = ":4190" + c.P2PHybridNetAddress = ":4190" } requireFDs := test.reservedIn + test.restHardIn + uint64(test.incomingIn) + uint64(test.p2pIncomingIn) res := c.AdjustConnectionLimits(requireFDs, test.maxFDs) @@ -736,7 +746,7 @@ func TestLocal_RecalculateConnectionLimits(t *testing.T) { require.Equal(t, int(test.restSoftExp), int(c.RestConnectionsSoftLimit)) require.Equal(t, int(test.restHardExp), int(c.RestConnectionsHardLimit)) require.Equal(t, int(test.incomingExp), int(c.IncomingConnectionsLimit)) - require.Equal(t, int(test.p2pIncomingExp), int(c.P2PIncomingConnectionsLimit)) + require.Equal(t, int(test.p2pIncomingExp), int(c.P2PHybridIncomingConnectionsLimit)) }) } } diff --git a/config/localTemplate.go b/config/localTemplate.go index 9583a194cd..96a150a88b 100644 --- a/config/localTemplate.go +++ b/config/localTemplate.go @@ -134,7 +134,9 @@ type Local struct { // Estimating 1.5MB per incoming connection, 1.5MB*2400 = 3.6GB IncomingConnectionsLimit int `version[0]:"-1" version[1]:"10000" version[17]:"800" version[27]:"2400"` - P2PIncomingConnectionsLimit int `version[34]:"1200"` + // P2PHybridIncomingConnectionsLimit is used as IncomingConnectionsLimit for P2P connections in hybrid mode. + // For pure P2P nodes IncomingConnectionsLimit is used. + P2PHybridIncomingConnectionsLimit int `version[34]:"1200"` // BroadcastConnectionsLimit specifies the number of connections that // will receive broadcast (gossip) messages from this node. If the @@ -607,8 +609,8 @@ type Local struct { // Enabling this setting also requires PublicAddress to be set. EnableP2PHybridMode bool `version[34]:"false"` - // P2PNetAddress sets the listen address used for P2P networking, if hybrid mode is set. - P2PNetAddress string `version[34]:""` + // P2PHybridNetAddress sets the listen address used for P2P networking, if hybrid mode is set. + P2PHybridNetAddress string `version[34]:""` // EnableDHT will turn on the hash table for use with capabilities advertisement EnableDHTProviders bool `version[34]:"false"` @@ -742,16 +744,21 @@ func (cfg Local) IsGossipServer() bool { return cfg.IsWsGossipServer() || cfg.IsP2PGossipServer() } -// IsWsGossipServer returns true if a node configured to run a listening ws net +// IsWsGossipServer returns true if a node is configured to run a listening ws net func (cfg Local) IsWsGossipServer() bool { // 1. NetAddress is set and EnableP2P is not set // 2. NetAddress is set and EnableP2PHybridMode is set then EnableP2P is overridden by EnableP2PHybridMode return cfg.NetAddress != "" && (!cfg.EnableP2P || cfg.EnableP2PHybridMode) } -// IsP2PGossipServer returns true if a node configured to run a listening p2p net +// IsP2PGossipServer returns true if a node is configured to run a listening p2p net func (cfg Local) IsP2PGossipServer() bool { - return (cfg.EnableP2P && !cfg.EnableP2PHybridMode && cfg.NetAddress != "") || (cfg.EnableP2PHybridMode && cfg.P2PNetAddress != "") + return (cfg.EnableP2P && !cfg.EnableP2PHybridMode && cfg.NetAddress != "") || (cfg.EnableP2PHybridMode && cfg.P2PHybridNetAddress != "") +} + +// IsHybridServer returns true if a node configured to run a listening both ws and p2p networks +func (cfg Local) IsHybridServer() bool { + return cfg.NetAddress != "" && cfg.P2PHybridNetAddress != "" && cfg.EnableP2PHybridMode } // ensureAbsGenesisDir will convert a path to absolute, and will attempt to make a genesis directory there @@ -950,22 +957,22 @@ func (cfg *Local) AdjustConnectionLimits(requiredFDs, maxFDs uint64) bool { restDelta := diff + reservedRESTConns - cfg.RestConnectionsHardLimit cfg.RestConnectionsHardLimit = reservedRESTConns splitRatio := 1 - if cfg.IsWsGossipServer() && cfg.IsP2PGossipServer() { + if cfg.IsHybridServer() { // split the rest of the delta between ws and p2p evenly splitRatio = 2 } - if cfg.IsWsGossipServer() { + if cfg.IsWsGossipServer() || cfg.IsP2PGossipServer() { if cfg.IncomingConnectionsLimit > int(restDelta) { cfg.IncomingConnectionsLimit -= int(restDelta) / splitRatio } else { cfg.IncomingConnectionsLimit = 0 } } - if cfg.IsP2PGossipServer() { - if cfg.P2PIncomingConnectionsLimit > int(restDelta) { - cfg.P2PIncomingConnectionsLimit -= int(restDelta) / splitRatio + if cfg.IsHybridServer() { + if cfg.P2PHybridIncomingConnectionsLimit > int(restDelta) { + cfg.P2PHybridIncomingConnectionsLimit -= int(restDelta) / splitRatio } else { - cfg.P2PIncomingConnectionsLimit = 0 + cfg.P2PHybridIncomingConnectionsLimit = 0 } } } else { diff --git a/config/local_defaults.go b/config/local_defaults.go index 57457531be..b2007621d0 100644 --- a/config/local_defaults.go +++ b/config/local_defaults.go @@ -119,8 +119,8 @@ var defaultLocal = Local{ OptimizeAccountsDatabaseOnStartup: false, OutgoingMessageFilterBucketCount: 3, OutgoingMessageFilterBucketSize: 128, - P2PIncomingConnectionsLimit: 1200, - P2PNetAddress: "", + P2PHybridIncomingConnectionsLimit: 1200, + P2PHybridNetAddress: "", P2PPersistPeerID: false, P2PPrivateKeyLocation: "", ParticipationKeysRefreshInterval: 60000000000, diff --git a/daemon/algod/server.go b/daemon/algod/server.go index 309fdc5799..6023bfab2e 100644 --- a/daemon/algod/server.go +++ b/daemon/algod/server.go @@ -153,16 +153,16 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes if ot.Overflowed { return errors.New("Initialize() overflowed when adding up ReservedHealthServiceConnections to the existing RLIMIT_NOFILE value; decrease RestConnectionsHardLimit") } - if cfg.IsWsGossipServer() { + if cfg.IsGossipServer() { fdRequired = ot.Add(fdRequired, uint64(cfg.IncomingConnectionsLimit)) if ot.Overflowed { return errors.New("Initialize() overflowed when adding up IncomingConnectionsLimit to the existing RLIMIT_NOFILE value; decrease IncomingConnectionsLimit") } } - if cfg.IsP2PGossipServer() { - fdRequired = ot.Add(fdRequired, uint64(cfg.P2PIncomingConnectionsLimit)) + if cfg.IsHybridServer() { + fdRequired = ot.Add(fdRequired, uint64(cfg.P2PHybridIncomingConnectionsLimit)) if ot.Overflowed { - return errors.New("Initialize() overflowed when adding up P2PIncomingConnectionsLimit to the existing RLIMIT_NOFILE value; decrease P2PIncomingConnectionsLimit") + return errors.New("Initialize() overflowed when adding up P2PHybridIncomingConnectionsLimit to the existing RLIMIT_NOFILE value; decrease P2PHybridIncomingConnectionsLimit") } } _, hard, fdErr := util.GetFdLimits() @@ -176,17 +176,17 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes // but try to keep cfg.ReservedFDs untouched by decreasing other limits if cfg.AdjustConnectionLimits(fdRequired, hard) { s.log.Warnf( - "Updated connection limits: RestConnectionsSoftLimit=%d, RestConnectionsHardLimit=%d, IncomingConnectionsLimit=%d, P2PIncomingConnectionsLimit=%d", + "Updated connection limits: RestConnectionsSoftLimit=%d, RestConnectionsHardLimit=%d, IncomingConnectionsLimit=%d, P2PHybridIncomingConnectionsLimit=%d", cfg.RestConnectionsSoftLimit, cfg.RestConnectionsHardLimit, cfg.IncomingConnectionsLimit, - cfg.P2PIncomingConnectionsLimit, + cfg.P2PHybridIncomingConnectionsLimit, ) - if cfg.IsWsGossipServer() && cfg.IncomingConnectionsLimit == 0 { - return errors.New("Initialize() failed to adjust connection limits") + if cfg.IsHybridServer() && cfg.P2PHybridIncomingConnectionsLimit == 0 { + return errors.New("Initialize() failed to adjust p2p hybrid connection limits") } - if cfg.IsP2PGossipServer() && cfg.P2PIncomingConnectionsLimit == 0 { - return errors.New("Initialize() failed to adjust p2p connection limits") + if cfg.IsGossipServer() && cfg.IncomingConnectionsLimit == 0 { + return errors.New("Initialize() failed to adjust connection limits") } } } diff --git a/installer/config.json.example b/installer/config.json.example index 3a9714bbfb..59ca9e3a29 100644 --- a/installer/config.json.example +++ b/installer/config.json.example @@ -98,8 +98,8 @@ "OptimizeAccountsDatabaseOnStartup": false, "OutgoingMessageFilterBucketCount": 3, "OutgoingMessageFilterBucketSize": 128, - "P2PIncomingConnectionsLimit": 1200, - "P2PNetAddress": "", + "P2PHybridIncomingConnectionsLimit": 1200, + "P2PHybridNetAddress": "", "P2PPersistPeerID": false, "P2PPrivateKeyLocation": "", "ParticipationKeysRefreshInterval": 60000000000, diff --git a/netdeploy/remote/deployedNetwork.go b/netdeploy/remote/deployedNetwork.go index 26f25a0da6..2a02e77899 100644 --- a/netdeploy/remote/deployedNetwork.go +++ b/netdeploy/remote/deployedNetwork.go @@ -1009,8 +1009,8 @@ func createHostSpec(host HostConfig, template cloudHost) (hostSpec cloudHostSpec portList = append(portList, strconv.Itoa(port)) } } - if node.P2PNetAddress != "" { - port, err = extractPublicPort(node.P2PNetAddress) + if node.P2PHybridNetAddress != "" { + port, err = extractPublicPort(node.P2PHybridNetAddress) if err != nil { return } diff --git a/netdeploy/remote/nodeConfig.go b/netdeploy/remote/nodeConfig.go index bd4b63dac8..4025c47c1c 100644 --- a/netdeploy/remote/nodeConfig.go +++ b/netdeploy/remote/nodeConfig.go @@ -18,25 +18,25 @@ package remote // NodeConfig represents the configuration settings to apply to a single node running on a host type NodeConfig struct { - Name string `json:",omitempty"` - Wallets []NodeWalletData - NetAddress string `json:",omitempty"` - APIEndpoint string `json:",omitempty"` - APIToken string `json:",omitempty"` - AdminAPIToken string `json:",omitempty"` - EnableTelemetry bool // Needs to also be configured host-wide (assign logging host name) - TelemetryURI string `json:",omitempty"` // Needs to be HostConfig - EnableMetrics bool // Needs to also be configured host-wide (register DNS entry) - MetricsURI string `json:",omitempty"` - EnableService bool - CronTabSchedule string `json:",omitempty"` - EnableBlockStats bool - DashboardEndpoint string `json:",omitempty"` - DeadlockOverride int `json:",omitempty"` // -1 = Disable deadlock detection, 0 = Use Default for build, 1 = Enable - ConfigJSONOverride string `json:",omitempty"` // Raw json to merge into config.json after other modifications are complete - P2PBootstrap bool // True if this node should be a p2p bootstrap node and registered in DNS - P2PNetAddress string `json:",omitempty"` - PublicAddress bool + Name string `json:",omitempty"` + Wallets []NodeWalletData + NetAddress string `json:",omitempty"` + APIEndpoint string `json:",omitempty"` + APIToken string `json:",omitempty"` + AdminAPIToken string `json:",omitempty"` + EnableTelemetry bool // Needs to also be configured host-wide (assign logging host name) + TelemetryURI string `json:",omitempty"` // Needs to be HostConfig + EnableMetrics bool // Needs to also be configured host-wide (register DNS entry) + MetricsURI string `json:",omitempty"` + EnableService bool + CronTabSchedule string `json:",omitempty"` + EnableBlockStats bool + DashboardEndpoint string `json:",omitempty"` + DeadlockOverride int `json:",omitempty"` // -1 = Disable deadlock detection, 0 = Use Default for build, 1 = Enable + ConfigJSONOverride string `json:",omitempty"` // Raw json to merge into config.json after other modifications are complete + P2PBootstrap bool // True if this node should be a p2p bootstrap node and registered in DNS + P2PHybridNetAddress string `json:",omitempty"` + PublicAddress bool // NodeNameMatchRegex is tested against Name in generated configs and if matched the rest of the configs in this record are applied as a template NodeNameMatchRegex string `json:",omitempty"` diff --git a/netdeploy/remote/nodecfg/nodeDir.go b/netdeploy/remote/nodecfg/nodeDir.go index 304fa4c636..43417dca27 100644 --- a/netdeploy/remote/nodecfg/nodeDir.go +++ b/netdeploy/remote/nodecfg/nodeDir.go @@ -169,9 +169,9 @@ func (nd *nodeDir) configureNetAddress() (err error) { } } } - if nd.P2PNetAddress != "" { - fmt.Fprintf(os.Stdout, " - Assigning P2PNetAddress: %s\n", nd.P2PNetAddress) - nd.config.P2PNetAddress = nd.P2PNetAddress + if nd.P2PHybridNetAddress != "" { + fmt.Fprintf(os.Stdout, " - Assigning P2PHybridNetAddress: %s\n", nd.P2PHybridNetAddress) + nd.config.P2PHybridNetAddress = nd.P2PHybridNetAddress } err = nd.saveConfig() return @@ -210,21 +210,21 @@ func (nd *nodeDir) configureP2PDNSBootstrap(p2pBootstrap bool) error { } // ensure p2p config params set are what is expected: // - EnableP2P or EnableP2PHybridMode - // - NetAddress or P2PNetAddress is set + // - NetAddress or P2PHybridNetAddress is set // - EnableGossipService if !nd.config.EnableP2P && !nd.config.EnableP2PHybridMode { return errors.New("p2p bootstrap requires EnableP2P or EnableP2PHybridMode to be set") } - if nd.NetAddress == "" && nd.P2PNetAddress == "" { - return errors.New("p2p bootstrap requires NetAddress or P2PNetAddress to be set") + if nd.NetAddress == "" && nd.P2PHybridNetAddress == "" { + return errors.New("p2p bootstrap requires NetAddress or P2PHybridNetAddress to be set") } if !nd.config.EnableGossipService { return errors.New("p2p bootstrap requires EnableGossipService to be set") } netAddress := nd.NetAddress - if nd.P2PNetAddress != "" { - netAddress = nd.P2PNetAddress + if nd.P2PHybridNetAddress != "" { + netAddress = nd.P2PHybridNetAddress } key, err := p2p.GetPrivKey(config.Local{P2PPersistPeerID: true}, nd.dataDir) diff --git a/network/README-P2P.md b/network/README-P2P.md index c67bd53273..853b54ed2d 100644 --- a/network/README-P2P.md +++ b/network/README-P2P.md @@ -8,7 +8,7 @@ transport: lip2p-managed connections and HTTP + WebSocket, respectively. `P2PNetwork` and `WsNetwork` require `config.NetAddress` to be set in order to start a server. In addition, `HybridNetwork` is an aggregate of `P2PNetwork` and `WsNetwork` allowing a node -to interact over both networks. In the case of hybrid operation, both `config.P2PNetAddress` and +to interact over both networks. In the case of hybrid operation, both `config.P2PHybridNetAddress` and `config.NetAddress` are used. ## General design diff --git a/network/hybridNetwork.go b/network/hybridNetwork.go index 7d5814ff39..85621260a9 100644 --- a/network/hybridNetwork.go +++ b/network/hybridNetwork.go @@ -41,7 +41,8 @@ type HybridP2PNetwork struct { func NewHybridP2PNetwork(log logging.Logger, cfg config.Local, datadir string, phonebookAddresses []string, genesisID string, networkID protocol.NetworkID, nodeInfo NodeInfo) (*HybridP2PNetwork, error) { // supply alternate NetAddress for P2P network p2pcfg := cfg - p2pcfg.NetAddress = cfg.P2PNetAddress + p2pcfg.NetAddress = cfg.P2PHybridNetAddress + p2pcfg.IncomingConnectionsLimit = cfg.P2PHybridIncomingConnectionsLimit identityTracker := NewIdentityTracker() p2pnet, err := NewP2PNetwork(log, p2pcfg, datadir, phonebookAddresses, genesisID, networkID, nodeInfo, &identityOpts{tracker: identityTracker}) if err != nil { diff --git a/network/hybridNetwork_test.go b/network/hybridNetwork_test.go index 842bb10b15..4e1392a2d0 100644 --- a/network/hybridNetwork_test.go +++ b/network/hybridNetwork_test.go @@ -64,7 +64,7 @@ func TestHybridNetwork_DuplicateConn(t *testing.T) { // make it net address and restart the node relayCfg.NetAddress = addr relayCfg.PublicAddress = addr - relayCfg.P2PNetAddress = "127.0.0.1:0" + relayCfg.P2PHybridNetAddress = "127.0.0.1:0" netA, err = NewHybridP2PNetwork(log.With("node", "netA"), relayCfg, p2pKeyDir, nil, genesisID, "net", &nopeNodeInfo{}) require.NoError(t, err) diff --git a/network/p2p/README.md b/network/p2p/README.md index b95e5be32f..e2d3333caf 100644 --- a/network/p2p/README.md +++ b/network/p2p/README.md @@ -72,7 +72,7 @@ The underlying libp2p implementation is abstracted as `p2p.Service` and is initi ### Connection limiting -libp2p's `ResourceManager` is used to limit the number of connections up to `cfg.P2PIncomingConnectionsLimit`. +libp2p's `ResourceManager` is used to limit the number of connections up to `cfg.IncomingConnectionsLimit`. ### DHT and capabilities diff --git a/network/p2p/p2p.go b/network/p2p/p2p.go index 3b467b0b27..270dfb7476 100644 --- a/network/p2p/p2p.go +++ b/network/p2p/p2p.go @@ -166,7 +166,7 @@ func configureResourceManager(cfg config.Local) (network.ResourceManager, error) limitConfig := rcmgr.PartialLimitConfig{ System: rcmgr.ResourceLimits{ - Conns: rcmgr.LimitVal(cfg.P2PIncomingConnectionsLimit), + Conns: rcmgr.LimitVal(cfg.IncomingConnectionsLimit), }, // Everything else is default. The exact values will come from `scaledDefaultLimits` above. } diff --git a/node/node_test.go b/node/node_test.go index df72a699bb..6b991751cb 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -880,7 +880,7 @@ func TestNodeHybridTopology(t *testing.T) { ni.p2pID, err = p2p.PeerIDFromPublicKey(privKey.GetPublic()) require.NoError(t, err) - cfg.P2PNetAddress = ni.p2pNetAddr() + cfg.P2PHybridNetAddress = ni.p2pNetAddr() return ni, cfg } diff --git a/test/testdata/configs/config-v34.json b/test/testdata/configs/config-v34.json index 3a9714bbfb..59ca9e3a29 100644 --- a/test/testdata/configs/config-v34.json +++ b/test/testdata/configs/config-v34.json @@ -98,8 +98,8 @@ "OptimizeAccountsDatabaseOnStartup": false, "OutgoingMessageFilterBucketCount": 3, "OutgoingMessageFilterBucketSize": 128, - "P2PIncomingConnectionsLimit": 1200, - "P2PNetAddress": "", + "P2PHybridIncomingConnectionsLimit": 1200, + "P2PHybridNetAddress": "", "P2PPersistPeerID": false, "P2PPrivateKeyLocation": "", "ParticipationKeysRefreshInterval": 60000000000, diff --git a/test/testdata/deployednettemplates/recipes/scenario1s-p2p/copy-node-configs.py b/test/testdata/deployednettemplates/recipes/scenario1s-p2p/copy-node-configs.py index 12da86f348..93595698f2 100644 --- a/test/testdata/deployednettemplates/recipes/scenario1s-p2p/copy-node-configs.py +++ b/test/testdata/deployednettemplates/recipes/scenario1s-p2p/copy-node-configs.py @@ -65,7 +65,7 @@ def make_hybrid_p2p_net(*args): altconfig["ConfigJSONOverride"] = json.dumps(override_json) if net_address: # relay, set public address altconfig["P2PBootstrap"] = True - altconfig["P2PNetAddress"] = "{{NetworkPort2}}" + altconfig["P2PHybridNetAddress"] = "{{NetworkPort2}}" altconfig["PublicAddress"] = True altconfig['FractionApply'] = 0.5 @@ -99,7 +99,7 @@ def make_hybrid_ws_net(*args): altconfig["ConfigJSONOverride"] = json.dumps(override_json) if net_address: # relay, set public address altconfig["P2PBootstrap"] = True - altconfig["P2PNetAddress"] = "{{NetworkPort2}}" + altconfig["P2PHybridNetAddress"] = "{{NetworkPort2}}" altconfig["PublicAddress"] = True altconfig['FractionApply'] = 0.5