config: drop deprecated P2P configuration
Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
de69560c7d
commit
6865848ca7
4 changed files with 26 additions and 113 deletions
15
ROADMAP.md
15
ROADMAP.md
|
@ -26,21 +26,6 @@ APIs/commands/configurations will be removed and here is a list of scheduled
|
|||
breaking changes. Consider changing your code/scripts/configurations if you're
|
||||
using anything mentioned here.
|
||||
|
||||
## P2P application settings configuration
|
||||
|
||||
Version 0.100.0 of NeoGo marks the following P2P application settings as
|
||||
deprecated: `AttemptConnPeers`, `BroadcastFactor`, `DialTimeout`,
|
||||
`ExtensiblePoolSize`, `MaxPeers`, `MinPeers`, `PingInterval`, `PingTimeout`,
|
||||
`ProtoTickInterval`. These settings are moved to a separate `P2P` section of
|
||||
`ApplicationConfiguration`. The `DialTimeout`, `PingInterval`, `PingTimeout`,
|
||||
`ProtoTickInterval` settings are converted to more precise `Duration` format
|
||||
(allowing for subsecond time). Please, update your node configuration (all you
|
||||
need is to move specified settings under the `P2P` section and convert
|
||||
time-related settings to `Duration` format).
|
||||
|
||||
Removal of deprecated P2P related application settings is scheduled for May-June
|
||||
2023 (~0.103.0 release).
|
||||
|
||||
## Direct UnlockWallet consensus configuration
|
||||
|
||||
Top-level UnlockWallet section in ApplicationConfiguration was used as an
|
||||
|
|
|
@ -16,25 +16,16 @@ node-related settings described in the table below.
|
|||
|
||||
| Section | Type | Default value | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| AttemptConnPeers | `int` | `20` | Number of connection to try to establish when the connection count drops below the `MinPeers` value. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| BroadcastFactor | `int` | `0` | Multiplier that is used to determine the number of optimal gossip fan-out peer number for broadcasted messages (0-100). By default it's zero, node uses the most optimized value depending on the estimated network size (`2.5×log(size)`), so the node may have 20 peers and calculate that it needs to broadcast messages to just 10 of them. With BroadcastFactor set to 100 it will always send messages to all peers, any value in-between 0 and 100 is used for weighted calculation, for example if it's 30 then 13 neighbors will be used in the previous case. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| DBConfiguration | [DB Configuration](#DB-Configuration) | | Describes configuration for database. See the [DB Configuration](#DB-Configuration) section for details. |
|
||||
| DialTimeout | `int64` | `0` | Maximum duration a single dial may take in seconds. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| ExtensiblePoolSize | `int` | `20` | Maximum amount of the extensible payloads from a single sender stored in a local pool. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| LogLevel | `string` | "info" | Minimal logged messages level (can be "debug", "info", "warn", "error", "dpanic", "panic" or "fatal"). |
|
||||
| GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. |
|
||||
| KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store the latest state (or a set of latest states, see `P2PStateExchangeExtensions` section in the ProtocolConfiguration for details). If true, DB size will be smaller, but older roots won't be accessible. This value should remain the same for the same database. | |
|
||||
| LogPath | `string` | "", so only console logging | File path where to store node logs. |
|
||||
| MaxPeers | `int` | `100` | Maximum numbers of peers that can be connected to the server. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| MinPeers | `int` | `5` | Minimum number of peers for normal operation; when the node has less than this number of peers it tries to connect with some new ones. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| Oracle | [Oracle Configuration](#Oracle-Configuration) | | Oracle module configuration. See the [Oracle Configuration](#Oracle-Configuration) section for details. |
|
||||
| P2P | [P2P Configuration](#P2P-Configuration) | | Configuration values for P2P network interaction. See the [P2P Configuration](#P2P-Configuration) section for details. |
|
||||
| P2PNotary | [P2P Notary Configuration](#P2P-Notary-Configuration) | | P2P Notary module configuration. See the [P2P Notary Configuration](#P2P-Notary-Configuration) section for details. |
|
||||
| PingInterval | `int64` | `30` | Interval in seconds used in pinging mechanism for syncing blocks. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| PingTimeout | `int64` | `90` | Time to wait for pong (response for sent ping request). Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| Pprof | [Metrics Services Configuration](#Metrics-Services-Configuration) | | Configuration for pprof service (profiling statistics gathering). See the [Metrics Services Configuration](#Metrics-Services-Configuration) section for details. |
|
||||
| Prometheus | [Metrics Services Configuration](#Metrics-Services-Configuration) | | Configuration for Prometheus (monitoring system). See the [Metrics Services Configuration](#Metrics-Services-Configuration) section for details |
|
||||
| ProtoTickInterval | `int64` | `5` | Duration in seconds between protocol ticks with each connected peer. Warning: this field is deprecated and moved to `P2P` section. |
|
||||
| Relay | `bool` | `true` | Determines whether the server is forwarding its inventory. |
|
||||
| Consensus | [Consensus Configuration](#Consensus-Configuration) | | Describes consensus (dBFT) configuration. See the [Consensus Configuration](#Consensus-Configuration) for details. |
|
||||
| RemoveUntraceableBlocks | `bool`| `false` | Denotes whether old blocks should be removed from cache and database. If enabled, then only the last `MaxTraceableBlocks` are stored and accessible to smart contracts. Old MPT data is also deleted in accordance with `GarbageCollectionPeriod` setting. If enabled along with `P2PStateExchangeExtensions` protocol extension, then old blocks and MPT states will be removed up to the second latest state synchronisation point (see `StateSyncInterval`). |
|
||||
|
|
|
@ -13,30 +13,16 @@ import (
|
|||
type ApplicationConfiguration struct {
|
||||
Ledger `yaml:",inline"`
|
||||
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
AttemptConnPeers int `yaml:"AttemptConnPeers"`
|
||||
// BroadcastFactor is the factor (0-100) controlling gossip fan-out number optimization.
|
||||
//
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
BroadcastFactor int `yaml:"BroadcastFactor"`
|
||||
DBConfiguration dbconfig.DBConfiguration `yaml:"DBConfiguration"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
DialTimeout int64 `yaml:"DialTimeout"`
|
||||
|
||||
LogLevel string `yaml:"LogLevel"`
|
||||
LogPath string `yaml:"LogPath"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
MaxPeers int `yaml:"MaxPeers"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
MinPeers int `yaml:"MinPeers"`
|
||||
|
||||
P2P P2P `yaml:"P2P"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
PingInterval int64 `yaml:"PingInterval"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
PingTimeout int64 `yaml:"PingTimeout"`
|
||||
|
||||
Pprof BasicService `yaml:"Pprof"`
|
||||
Prometheus BasicService `yaml:"Prometheus"`
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
ProtoTickInterval int64 `yaml:"ProtoTickInterval"`
|
||||
|
||||
Relay bool `yaml:"Relay"`
|
||||
Consensus Consensus `yaml:"Consensus"`
|
||||
RPC RPC `yaml:"RPC"`
|
||||
|
@ -44,10 +30,6 @@ type ApplicationConfiguration struct {
|
|||
Oracle OracleConfiguration `yaml:"Oracle"`
|
||||
P2PNotary P2PNotary `yaml:"P2PNotary"`
|
||||
StateRoot StateRoot `yaml:"StateRoot"`
|
||||
// ExtensiblePoolSize is the maximum amount of the extensible payloads from a single sender.
|
||||
//
|
||||
// Deprecated: this option is moved to the P2P section.
|
||||
ExtensiblePoolSize int `yaml:"ExtensiblePoolSize"`
|
||||
}
|
||||
|
||||
// EqualsButServices returns true when the o is the same as a except for services
|
||||
|
@ -68,25 +50,16 @@ func (a *ApplicationConfiguration) EqualsButServices(o *ApplicationConfiguration
|
|||
return false
|
||||
}
|
||||
}
|
||||
if a.AttemptConnPeers != o.AttemptConnPeers || //nolint:staticcheck // SA1019: a.AttemptConnPeers is deprecated
|
||||
a.P2P.AttemptConnPeers != o.P2P.AttemptConnPeers ||
|
||||
a.BroadcastFactor != o.BroadcastFactor || //nolint:staticcheck // SA1019: a.BroadcastFactor is deprecated
|
||||
if a.P2P.AttemptConnPeers != o.P2P.AttemptConnPeers ||
|
||||
a.P2P.BroadcastFactor != o.P2P.BroadcastFactor ||
|
||||
a.DBConfiguration != o.DBConfiguration ||
|
||||
a.DialTimeout != o.DialTimeout || //nolint:staticcheck // SA1019: a.DialTimeout is deprecated
|
||||
a.P2P.DialTimeout != o.P2P.DialTimeout ||
|
||||
a.ExtensiblePoolSize != o.ExtensiblePoolSize || //nolint:staticcheck // SA1019: a.ExtensiblePoolSize is deprecated
|
||||
a.P2P.ExtensiblePoolSize != o.P2P.ExtensiblePoolSize ||
|
||||
a.LogPath != o.LogPath ||
|
||||
a.MaxPeers != o.MaxPeers || //nolint:staticcheck // SA1019: a.MaxPeers is deprecated
|
||||
a.P2P.MaxPeers != o.P2P.MaxPeers ||
|
||||
a.MinPeers != o.MinPeers || //nolint:staticcheck // SA1019: a.MinPeers is deprecated
|
||||
a.P2P.MinPeers != o.P2P.MinPeers ||
|
||||
a.PingInterval != o.PingInterval || //nolint:staticcheck // SA1019: a.PingInterval is deprecated
|
||||
a.P2P.PingInterval != o.P2P.PingInterval ||
|
||||
a.PingTimeout != o.PingTimeout || //nolint:staticcheck // SA1019: a.PingTimeout is deprecated
|
||||
a.P2P.PingTimeout != o.P2P.PingTimeout ||
|
||||
a.ProtoTickInterval != o.ProtoTickInterval || //nolint:staticcheck // SA1019: a.ProtoTickInterval is deprecated
|
||||
a.P2P.ProtoTickInterval != o.P2P.ProtoTickInterval ||
|
||||
a.Relay != o.Relay {
|
||||
return false
|
||||
|
|
|
@ -84,42 +84,6 @@ type (
|
|||
func NewServerConfig(cfg config.Config) (ServerConfig, error) {
|
||||
appConfig := cfg.ApplicationConfiguration
|
||||
protoConfig := cfg.ProtocolConfiguration
|
||||
dialTimeout := appConfig.P2P.DialTimeout
|
||||
if dialTimeout == 0 && appConfig.DialTimeout > 0 { //nolint:staticcheck // SA1019: appConfig.DialTimeout is deprecated
|
||||
dialTimeout = time.Duration(appConfig.DialTimeout) * time.Second //nolint:staticcheck // SA1019: appConfig.DialTimeout is deprecated
|
||||
}
|
||||
protoTickInterval := appConfig.P2P.ProtoTickInterval
|
||||
if protoTickInterval == 0 && appConfig.ProtoTickInterval > 0 { //nolint:staticcheck // SA1019: appConfig.ProtoTickInterval is deprecated
|
||||
protoTickInterval = time.Duration(appConfig.ProtoTickInterval) * time.Second //nolint:staticcheck // SA1019: appConfig.ProtoTickInterval is deprecated
|
||||
}
|
||||
pingInterval := appConfig.P2P.PingInterval
|
||||
if pingInterval == 0 && appConfig.PingInterval > 0 { //nolint:staticcheck // SA1019: appConfig.PingInterval is deprecated
|
||||
pingInterval = time.Duration(appConfig.PingInterval) * time.Second //nolint:staticcheck // SA1019: appConfig.PingInterval is deprecated
|
||||
}
|
||||
pingTimeout := appConfig.P2P.PingTimeout
|
||||
if pingTimeout == 0 && appConfig.PingTimeout > 0 { //nolint:staticcheck // SA1019: appConfig.PingTimeout is deprecated
|
||||
pingTimeout = time.Duration(appConfig.PingTimeout) * time.Second //nolint:staticcheck // SA1019: appConfig.PingTimeout is deprecated
|
||||
}
|
||||
maxPeers := appConfig.P2P.MaxPeers
|
||||
if maxPeers == 0 && appConfig.MaxPeers > 0 { //nolint:staticcheck // SA1019: appConfig.MaxPeers is deprecated
|
||||
maxPeers = appConfig.MaxPeers //nolint:staticcheck // SA1019: appConfig.MaxPeers is deprecated
|
||||
}
|
||||
attemptConnPeers := appConfig.P2P.AttemptConnPeers
|
||||
if attemptConnPeers == 0 && appConfig.AttemptConnPeers > 0 { //nolint:staticcheck // SA1019: appConfig.AttemptConnPeers is deprecated
|
||||
attemptConnPeers = appConfig.AttemptConnPeers //nolint:staticcheck // SA1019: appConfig.AttemptConnPeers is deprecated
|
||||
}
|
||||
minPeers := appConfig.P2P.MinPeers
|
||||
if minPeers == 0 && appConfig.MinPeers > 0 { //nolint:staticcheck // SA1019: appConfig.MinPeers is deprecated
|
||||
minPeers = appConfig.MinPeers //nolint:staticcheck // SA1019: appConfig.MinPeers is deprecated
|
||||
}
|
||||
extPoolSize := appConfig.P2P.ExtensiblePoolSize
|
||||
if extPoolSize == 0 && appConfig.ExtensiblePoolSize > 0 { //nolint:staticcheck // SA1019: appConfig.ExtensiblePoolSize is deprecated
|
||||
extPoolSize = appConfig.ExtensiblePoolSize //nolint:staticcheck // SA1019: appConfig.ExtensiblePoolSize is deprecated
|
||||
}
|
||||
broadcastFactor := appConfig.P2P.BroadcastFactor
|
||||
if broadcastFactor > 0 && appConfig.BroadcastFactor > 0 { //nolint:staticcheck // SA1019: appConfig.BroadcastFactor is deprecated
|
||||
broadcastFactor = appConfig.BroadcastFactor //nolint:staticcheck // SA1019: appConfig.BroadcastFactor is deprecated
|
||||
}
|
||||
addrs, err := appConfig.GetAddresses()
|
||||
if err != nil {
|
||||
return ServerConfig{}, fmt.Errorf("failed to parse addresses: %w", err)
|
||||
|
@ -130,19 +94,19 @@ func NewServerConfig(cfg config.Config) (ServerConfig, error) {
|
|||
Net: protoConfig.Magic,
|
||||
Relay: appConfig.Relay,
|
||||
Seeds: protoConfig.SeedList,
|
||||
DialTimeout: dialTimeout,
|
||||
ProtoTickInterval: protoTickInterval,
|
||||
PingInterval: pingInterval,
|
||||
PingTimeout: pingTimeout,
|
||||
MaxPeers: maxPeers,
|
||||
AttemptConnPeers: attemptConnPeers,
|
||||
MinPeers: minPeers,
|
||||
DialTimeout: appConfig.P2P.DialTimeout,
|
||||
ProtoTickInterval: appConfig.P2P.ProtoTickInterval,
|
||||
PingInterval: appConfig.P2P.PingInterval,
|
||||
PingTimeout: appConfig.P2P.PingTimeout,
|
||||
MaxPeers: appConfig.P2P.MaxPeers,
|
||||
AttemptConnPeers: appConfig.P2P.AttemptConnPeers,
|
||||
MinPeers: appConfig.P2P.MinPeers,
|
||||
TimePerBlock: protoConfig.TimePerBlock,
|
||||
OracleCfg: appConfig.Oracle,
|
||||
P2PNotaryCfg: appConfig.P2PNotary,
|
||||
StateRootCfg: appConfig.StateRoot,
|
||||
ExtensiblePoolSize: extPoolSize,
|
||||
BroadcastFactor: broadcastFactor,
|
||||
ExtensiblePoolSize: appConfig.P2P.ExtensiblePoolSize,
|
||||
BroadcastFactor: appConfig.P2P.BroadcastFactor,
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue