[Issue 552] Disable debug protocol by default (#588)

This commit is contained in:
Andrew Ashikhmin 2020-05-28 19:58:08 +02:00 committed by GitHub
parent dd4db2b36e
commit 12d6851be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 7 deletions

View File

@ -160,6 +160,7 @@ var (
utils.LegacyGpoPercentileFlag,
utils.EWASMInterpreterFlag,
utils.EVMInterpreterFlag,
utils.DebugProtocolFlag,
configFileFlag,
}

View File

@ -186,6 +186,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.ExecFlag,
utils.PreloadJSFlag,
utils.RemoteDbListenAddress,
utils.DebugProtocolFlag,
},
},
{

View File

@ -307,6 +307,10 @@ var (
Name: "download-only",
Usage: "Run in download only mode - only fetch blocks but not process them",
}
DebugProtocolFlag = cli.BoolFlag{
Name: "debug-protocol",
Usage: "Enable the DBG (debug) protocol",
}
// Ethash settings
EthashCacheDirFlag = DirectoryFlag{
Name: "ethash.cachedir",
@ -1547,6 +1551,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
cfg.DownloadOnly = ctx.GlobalBoolT(DownloadOnlyFlag.Name)
cfg.EnableDebugProtocol = ctx.GlobalBool(DebugProtocolFlag.Name)
mode, err := eth.StorageModeFromString(ctx.GlobalString(StorageModeFlag.Name))
if err != nil {
Fatalf(fmt.Sprintf("error while parsing mode: %v", err))

View File

@ -599,8 +599,10 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
protos[i].DialCandidates = s.dialCandiates
}
// Debug
protos = append(protos, s.protocolManager.makeDebugProtocol())
if s.config.EnableDebugProtocol {
// Debug
protos = append(protos, s.protocolManager.makeDebugProtocol())
}
// MGR
protos = append(protos, s.protocolManager.makeMgrProtocol())

View File

@ -149,8 +149,8 @@ type Config struct {
// for nodes to connect to.
DiscoveryURLs []string
Pruning bool // Whether to disable pruning and flush everything to disk
NoPrefetch bool // Whether to disable prefetching and only load state on demand
Pruning bool // Whether to disable pruning and flush everything to disk
NoPrefetch bool // Whether to disable prefetching and only load state on demand
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
StorageMode StorageMode
@ -203,6 +203,9 @@ type Config struct {
// Enables tracking of SHA3 preimages in the VM
EnablePreimageRecording bool
// Enables the dbg protocol
EnableDebugProtocol bool
// Miscellaneous options
DocRoot string `toml:"-"`

View File

@ -235,7 +235,7 @@ func initPm(manager *ProtocolManager, txpool txPool, engine consensus.Engine, bl
func (pm *ProtocolManager) makeDebugProtocol() p2p.Protocol {
// Initiate Debug protocol
log.Info("Initialising Debug protocol", "versions", FirehoseVersions)
log.Info("Initialising Debug protocol", "versions", DebugVersions)
return p2p.Protocol{
Name: DebugName,
Version: DebugVersions[0],
@ -264,8 +264,7 @@ func (pm *ProtocolManager) makeDebugProtocol() p2p.Protocol {
}
func (pm *ProtocolManager) makeMgrProtocol() p2p.Protocol {
// Initiate Debug protocol
log.Info("Initialising Debug protocol", "versions", FirehoseVersions)
log.Info("Initialising Merry-Go-Round protocol", "versions", MGRVersions)
return p2p.Protocol{
Name: MGRName,
Version: MGRVersions[0],