Skip to content

Commit c356847

Browse files
authored
eth/ethconfig: remove LES server config (ethereum#30298)
1 parent c4b01d8 commit c356847

File tree

6 files changed

+23
-78
lines changed

6 files changed

+23
-78
lines changed

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ issues:
6262
- revive
6363
- path: cmd/utils/flags.go
6464
text: "SA1019: cfg.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
65+
- path: cmd/utils/flags.go
66+
text: "SA1019: ethconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
6567
- path: internal/build/pgp.go
6668
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
6769
- path: core/vm/contracts.go

cmd/geth/config.go

+15-17
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ var tomlSettings = toml.Config{
7575
},
7676
MissingField: func(rt reflect.Type, field string) error {
7777
id := fmt.Sprintf("%s.%s", rt.String(), field)
78-
if deprecated(id) {
79-
log.Warn("Config field is deprecated and won't have an effect", "name", id)
78+
if deprecatedConfigFields[id] {
79+
log.Warn(fmt.Sprintf("Config field '%s' is deprecated and won't have any effect.", id))
8080
return nil
8181
}
8282
var link string
@@ -87,6 +87,19 @@ var tomlSettings = toml.Config{
8787
},
8888
}
8989

90+
var deprecatedConfigFields = map[string]bool{
91+
"ethconfig.Config.EVMInterpreter": true,
92+
"ethconfig.Config.EWASMInterpreter": true,
93+
"ethconfig.Config.TrieCleanCacheJournal": true,
94+
"ethconfig.Config.TrieCleanCacheRejournal": true,
95+
"ethconfig.Config.LightServ": true,
96+
"ethconfig.Config.LightIngress": true,
97+
"ethconfig.Config.LightEgress": true,
98+
"ethconfig.Config.LightPeers": true,
99+
"ethconfig.Config.LightNoPrune": true,
100+
"ethconfig.Config.LightNoSyncServe": true,
101+
}
102+
90103
type ethstatsConfig struct {
91104
URL string `toml:",omitempty"`
92105
}
@@ -314,21 +327,6 @@ func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
314327
}
315328
}
316329

317-
func deprecated(field string) bool {
318-
switch field {
319-
case "ethconfig.Config.EVMInterpreter":
320-
return true
321-
case "ethconfig.Config.EWASMInterpreter":
322-
return true
323-
case "ethconfig.Config.TrieCleanCacheJournal":
324-
return true
325-
case "ethconfig.Config.TrieCleanCacheRejournal":
326-
return true
327-
default:
328-
return false
329-
}
330-
}
331-
332330
func setAccountManagerBackends(conf *node.Config, am *accounts.Manager, keydir string) error {
333331
scryptN := keystore.StandardScryptN
334332
scryptP := keystore.StandardScryptP

cmd/utils/flags_legacy.go

-4
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,21 @@ var (
9292
LightServeFlag = &cli.IntFlag{
9393
Name: "light.serve",
9494
Usage: "Maximum percentage of time allowed for serving LES requests (deprecated)",
95-
Value: ethconfig.Defaults.LightServ,
9695
Category: flags.DeprecatedCategory,
9796
}
9897
LightIngressFlag = &cli.IntFlag{
9998
Name: "light.ingress",
10099
Usage: "Incoming bandwidth limit for serving light clients (deprecated)",
101-
Value: ethconfig.Defaults.LightIngress,
102100
Category: flags.DeprecatedCategory,
103101
}
104102
LightEgressFlag = &cli.IntFlag{
105103
Name: "light.egress",
106104
Usage: "Outgoing bandwidth limit for serving light clients (deprecated)",
107-
Value: ethconfig.Defaults.LightEgress,
108105
Category: flags.DeprecatedCategory,
109106
}
110107
LightMaxPeersFlag = &cli.IntFlag{
111108
Name: "light.maxpeers",
112109
Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated)",
113-
Value: ethconfig.Defaults.LightPeers,
114110
Category: flags.DeprecatedCategory,
115111
}
116112
LightNoPruneFlag = &cli.BoolFlag{

eth/backend.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,8 @@ func (s *Ethereum) Start() error {
377377
// Regularly update shutdown marker
378378
s.shutdownTracker.Start()
379379

380-
// Figure out a max peers count based on the server limits
381-
maxPeers := s.p2pServer.MaxPeers
382-
if s.config.LightServ > 0 {
383-
if s.config.LightPeers >= s.p2pServer.MaxPeers {
384-
return fmt.Errorf("invalid peer config: light peer count (%d) >= total peer count (%d)", s.config.LightPeers, s.p2pServer.MaxPeers)
385-
}
386-
maxPeers -= s.config.LightPeers
387-
}
388-
// Start the networking layer and the light server if requested
389-
s.handler.Start(maxPeers)
380+
// Start the networking layer
381+
s.handler.Start(s.p2pServer.MaxPeers)
390382
return nil
391383
}
392384

eth/ethconfig/config.go

+4-11
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ var Defaults = Config{
5353
TxLookupLimit: 2350000,
5454
TransactionHistory: 2350000,
5555
StateHistory: params.FullImmutabilityThreshold,
56-
LightPeers: 100,
5756
DatabaseCache: 512,
5857
TrieCleanCache: 154,
5958
TrieDirtyCache: 256,
@@ -87,11 +86,13 @@ type Config struct {
8786
EthDiscoveryURLs []string
8887
SnapDiscoveryURLs []string
8988

89+
// State options.
9090
NoPruning bool // Whether to disable pruning and flush everything to disk
9191
NoPrefetch bool // Whether to disable prefetching and only load state on demand
9292

93-
// Deprecated, use 'TransactionHistory' instead.
94-
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
93+
// Deprecated: use 'TransactionHistory' instead.
94+
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
95+
9596
TransactionHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
9697
StateHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose state histories are reserved.
9798

@@ -105,14 +106,6 @@ type Config struct {
105106
// presence of these blocks for every new peer connection.
106107
RequiredBlocks map[uint64]common.Hash `toml:"-"`
107108

108-
// Light client options
109-
LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
110-
LightIngress int `toml:",omitempty"` // Incoming bandwidth limit for light servers
111-
LightEgress int `toml:",omitempty"` // Outgoing bandwidth limit for light servers
112-
LightPeers int `toml:",omitempty"` // Maximum number of LES client peers
113-
LightNoPrune bool `toml:",omitempty"` // Whether to disable light chain pruning
114-
LightNoSyncServe bool `toml:",omitempty"` // Whether to serve light clients before syncing
115-
116109
// Database options
117110
SkipBcVersionCheck bool `toml:"-"`
118111
DatabaseHandles int `toml:"-"`

eth/ethconfig/gen_config.go

-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)