added support for miner.recommit flag (#743)

This commit is contained in:
Pratik Patil 2023-03-17 16:13:23 +05:30 committed by GitHub
parent c917e6fe68
commit 238b4496d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 27 additions and 0 deletions

View file

@ -58,6 +58,7 @@ syncmode = "full"
# mine = true # mine = true
# etherbase = "VALIDATOR ADDRESS" # etherbase = "VALIDATOR ADDRESS"
# extradata = "" # extradata = ""
# recommit = "2m5s"
# [jsonrpc] # [jsonrpc]

View file

@ -59,6 +59,7 @@ devfakeauthor = false # Run miner without validator set authorization [de
extradata = "" # Block extra data set by the miner (default = client version) extradata = "" # Block extra data set by the miner (default = client version)
gaslimit = 30000000 # Target gas ceiling for mined blocks gaslimit = 30000000 # Target gas ceiling for mined blocks
gasprice = "1000000000" # Minimum gas price for mining a transaction (recommended for mainnet = 30000000000, default suitable for mumbai/devnet) gasprice = "1000000000" # Minimum gas price for mining a transaction (recommended for mainnet = 30000000000, default suitable for mumbai/devnet)
recommit = "2m5s" # The time interval for miner to re-create mining work
[jsonrpc] [jsonrpc]
ipcdisable = false # Disable the IPC-RPC server ipcdisable = false # Disable the IPC-RPC server

View file

@ -168,6 +168,8 @@ The ```bor server``` command runs the Bor client.
- ```miner.gasprice```: Minimum gas price for mining a transaction (default: 1000000000) - ```miner.gasprice```: Minimum gas price for mining a transaction (default: 1000000000)
- ```miner.recommit```: The time interval for miner to re-create mining work (default: 2m5s)
### Telemetry Options ### Telemetry Options
- ```metrics```: Enable metrics collection and reporting (default: false) - ```metrics```: Enable metrics collection and reporting (default: false)

View file

@ -58,6 +58,7 @@ func (c *DumpconfigCommand) Run(args []string) int {
userConfig.TxPool.RejournalRaw = userConfig.TxPool.Rejournal.String() userConfig.TxPool.RejournalRaw = userConfig.TxPool.Rejournal.String()
userConfig.TxPool.LifeTimeRaw = userConfig.TxPool.LifeTime.String() userConfig.TxPool.LifeTimeRaw = userConfig.TxPool.LifeTime.String()
userConfig.Sealer.GasPriceRaw = userConfig.Sealer.GasPrice.String() userConfig.Sealer.GasPriceRaw = userConfig.Sealer.GasPrice.String()
userConfig.Sealer.RecommitRaw = userConfig.Sealer.Recommit.String()
userConfig.Gpo.MaxPriceRaw = userConfig.Gpo.MaxPrice.String() userConfig.Gpo.MaxPriceRaw = userConfig.Gpo.MaxPrice.String()
userConfig.Gpo.IgnorePriceRaw = userConfig.Gpo.IgnorePrice.String() userConfig.Gpo.IgnorePriceRaw = userConfig.Gpo.IgnorePrice.String()
userConfig.Cache.RejournalRaw = userConfig.Cache.Rejournal.String() userConfig.Cache.RejournalRaw = userConfig.Cache.Rejournal.String()

View file

@ -235,6 +235,10 @@ type SealerConfig struct {
// GasPrice is the minimum gas price for mining a transaction // GasPrice is the minimum gas price for mining a transaction
GasPrice *big.Int `hcl:"-,optional" toml:"-"` GasPrice *big.Int `hcl:"-,optional" toml:"-"`
GasPriceRaw string `hcl:"gasprice,optional" toml:"gasprice,optional"` GasPriceRaw string `hcl:"gasprice,optional" toml:"gasprice,optional"`
// The time interval for miner to re-create mining work.
Recommit time.Duration `hcl:"-,optional" toml:"-"`
RecommitRaw string `hcl:"recommit,optional" toml:"recommit,optional"`
} }
type JsonRPCConfig struct { type JsonRPCConfig struct {
@ -505,6 +509,7 @@ func DefaultConfig() *Config {
GasCeil: 30_000_000, // geth's default GasCeil: 30_000_000, // geth's default
GasPrice: big.NewInt(1 * params.GWei), // geth's default GasPrice: big.NewInt(1 * params.GWei), // geth's default
ExtraData: "", ExtraData: "",
Recommit: 125 * time.Second,
}, },
Gpo: &GpoConfig{ Gpo: &GpoConfig{
Blocks: 20, Blocks: 20,
@ -638,6 +643,7 @@ func (c *Config) fillTimeDurations() error {
td *time.Duration td *time.Duration
str *string str *string
}{ }{
{"miner.recommit", &c.Sealer.Recommit, &c.Sealer.RecommitRaw},
{"jsonrpc.timeouts.read", &c.JsonRPC.HttpTimeout.ReadTimeout, &c.JsonRPC.HttpTimeout.ReadTimeoutRaw}, {"jsonrpc.timeouts.read", &c.JsonRPC.HttpTimeout.ReadTimeout, &c.JsonRPC.HttpTimeout.ReadTimeoutRaw},
{"jsonrpc.timeouts.write", &c.JsonRPC.HttpTimeout.WriteTimeout, &c.JsonRPC.HttpTimeout.WriteTimeoutRaw}, {"jsonrpc.timeouts.write", &c.JsonRPC.HttpTimeout.WriteTimeout, &c.JsonRPC.HttpTimeout.WriteTimeoutRaw},
{"jsonrpc.timeouts.idle", &c.JsonRPC.HttpTimeout.IdleTimeout, &c.JsonRPC.HttpTimeout.IdleTimeoutRaw}, {"jsonrpc.timeouts.idle", &c.JsonRPC.HttpTimeout.IdleTimeout, &c.JsonRPC.HttpTimeout.IdleTimeoutRaw},
@ -758,6 +764,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
// miner options // miner options
{ {
n.Miner.Recommit = c.Sealer.Recommit
n.Miner.GasPrice = c.Sealer.GasPrice n.Miner.GasPrice = c.Sealer.GasPrice
n.Miner.GasCeil = c.Sealer.GasCeil n.Miner.GasCeil = c.Sealer.GasCeil
n.Miner.ExtraData = []byte(c.Sealer.ExtraData) n.Miner.ExtraData = []byte(c.Sealer.ExtraData)

View file

@ -247,6 +247,13 @@ func (c *Command) Flags() *flagset.Flagset {
Group: "Sealer", Group: "Sealer",
Default: c.cliConfig.Sealer.GasPrice, Default: c.cliConfig.Sealer.GasPrice,
}) })
f.DurationFlag(&flagset.DurationFlag{
Name: "miner.recommit",
Usage: "The time interval for miner to re-create mining work",
Value: &c.cliConfig.Sealer.Recommit,
Default: c.cliConfig.Sealer.Recommit,
Group: "Sealer",
})
// ethstats // ethstats
f.StringFlag(&flagset.StringFlag{ f.StringFlag(&flagset.StringFlag{

View file

@ -52,6 +52,7 @@ gcmode = "archive"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -52,6 +52,7 @@ syncmode = "full"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -54,6 +54,7 @@ syncmode = "full"
gasprice = "30000000000" gasprice = "30000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -54,6 +54,7 @@ syncmode = "full"
gasprice = "30000000000" gasprice = "30000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -52,6 +52,7 @@ gcmode = "archive"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -52,6 +52,7 @@ syncmode = "full"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -54,6 +54,7 @@ syncmode = "full"
# gasprice = "1000000000" # gasprice = "1000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"

View file

@ -54,6 +54,7 @@ syncmode = "full"
# gasprice = "1000000000" # gasprice = "1000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s"
[jsonrpc] [jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc" ipcpath = "/var/lib/bor/bor.ipc"