mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
PIP-35: enforce gas related configs for mainnet (#1290)
* enforce gas configs for all networks * eth/gasprice: remove else if for log * docs/cli: update example config * fix tests * internal/cli/server: fix tests * miner: fix tests
This commit is contained in:
parent
31545e5365
commit
dce4253605
24 changed files with 71 additions and 109 deletions
|
|
@ -56,7 +56,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[txpool]
|
[txpool]
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 30000000000 # 25000000000 for amoy
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
accountqueue = 16
|
accountqueue = 16
|
||||||
|
|
@ -69,7 +69,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "30000000000" # 25000000000 for amoy
|
gasprice = "25000000000"
|
||||||
# mine = true
|
# mine = true
|
||||||
# etherbase = "VALIDATOR ADDRESS"
|
# etherbase = "VALIDATOR ADDRESS"
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
|
|
@ -127,7 +127,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
ignoreprice = "30000000000" # 25000000000 for amoy
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,7 @@ var DefaultConfig = Config{
|
||||||
Journal: "transactions.rlp",
|
Journal: "transactions.rlp",
|
||||||
Rejournal: time.Hour,
|
Rejournal: time.Hour,
|
||||||
|
|
||||||
// (PIP-35): Update price limit to `params.BorDefaultTxPoolPriceLimit` once
|
PriceLimit: params.BorDefaultTxPoolPriceLimit,
|
||||||
// the change is applied over all networks.
|
|
||||||
PriceLimit: 1,
|
|
||||||
PriceBump: 10,
|
PriceBump: 10,
|
||||||
|
|
||||||
AccountSlots: 16,
|
AccountSlots: 16,
|
||||||
|
|
@ -163,23 +161,16 @@ var DefaultConfig = Config{
|
||||||
|
|
||||||
// sanitize checks the provided user configurations and changes anything that's
|
// sanitize checks the provided user configurations and changes anything that's
|
||||||
// unreasonable or unworkable.
|
// unreasonable or unworkable.
|
||||||
func (config *Config) sanitize(chainId *big.Int) Config {
|
func (config *Config) sanitize() Config {
|
||||||
conf := *config
|
conf := *config
|
||||||
if conf.Rejournal < time.Second {
|
if conf.Rejournal < time.Second {
|
||||||
log.Warn("Sanitizing invalid txpool journal time", "provided", conf.Rejournal, "updated", time.Second)
|
log.Warn("Sanitizing invalid txpool journal time", "provided", conf.Rejournal, "updated", time.Second)
|
||||||
conf.Rejournal = time.Second
|
conf.Rejournal = time.Second
|
||||||
}
|
}
|
||||||
// (PIP-35): Only enforce the 25gwei txpool price limit for amoy
|
// PIP-35: Enforce min price limit to 25 gwei
|
||||||
if chainId.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
if conf.PriceLimit != params.BorDefaultTxPoolPriceLimit {
|
||||||
if conf.PriceLimit != params.BorDefaultTxPoolPriceLimit {
|
log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", DefaultConfig.PriceLimit)
|
||||||
log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", params.BorDefaultTxPoolPriceLimit)
|
conf.PriceLimit = DefaultConfig.PriceLimit
|
||||||
conf.PriceLimit = params.BorDefaultTxPoolPriceLimit
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if conf.PriceLimit < 1 {
|
|
||||||
log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", DefaultConfig.PriceLimit)
|
|
||||||
conf.PriceLimit = DefaultConfig.PriceLimit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if conf.PriceBump < 1 {
|
if conf.PriceBump < 1 {
|
||||||
log.Warn("Sanitizing invalid txpool price bump", "provided", conf.PriceBump, "updated", DefaultConfig.PriceBump)
|
log.Warn("Sanitizing invalid txpool price bump", "provided", conf.PriceBump, "updated", DefaultConfig.PriceBump)
|
||||||
|
|
@ -259,7 +250,7 @@ type txpoolResetRequest struct {
|
||||||
// transactions from the network.
|
// transactions from the network.
|
||||||
func New(config Config, chain BlockChain, options ...func(pool *LegacyPool)) *LegacyPool {
|
func New(config Config, chain BlockChain, options ...func(pool *LegacyPool)) *LegacyPool {
|
||||||
// Sanitize the input to ensure no vulnerable gas prices are set
|
// Sanitize the input to ensure no vulnerable gas prices are set
|
||||||
config = (&config).sanitize(chain.Config().ChainID)
|
config = (&config).sanitize()
|
||||||
|
|
||||||
// Create the transaction pool with its initial settings
|
// Create the transaction pool with its initial settings
|
||||||
pool := &LegacyPool{
|
pool := &LegacyPool{
|
||||||
|
|
|
||||||
|
|
@ -296,9 +296,6 @@ func (c *testChain) State() (*state.StateDB, error) {
|
||||||
|
|
||||||
// TestTxPoolDefaultPriceLimit ensures the bor default tx pool price limit is set correctly.
|
// TestTxPoolDefaultPriceLimit ensures the bor default tx pool price limit is set correctly.
|
||||||
func TestTxPoolDefaultPriceLimit(t *testing.T) {
|
func TestTxPoolDefaultPriceLimit(t *testing.T) {
|
||||||
// (PIP-35): Only applicable to amoy
|
|
||||||
t.Skip("Skipped because the price enforcement is only applied to amoy")
|
|
||||||
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
pool, _ := setupPool()
|
pool, _ := setupPool()
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ devfakeauthor = false # Run miner without validator set authorization
|
||||||
nolocals = false # Disables price exemptions for locally submitted transactions
|
nolocals = false # Disables price exemptions for locally submitted transactions
|
||||||
journal = "transactions.rlp" # Disk journal for local transaction to survive node restarts
|
journal = "transactions.rlp" # Disk journal for local transaction to survive node restarts
|
||||||
rejournal = "1h0m0s" # Time interval to regenerate the local transaction journal
|
rejournal = "1h0m0s" # Time interval to regenerate the local transaction journal
|
||||||
pricelimit = 30000000000 # Minimum gas price limit to enforce for acceptance into the pool. Recommended for mainnet = 30000000000 (not enforced). For Amoy network, regardless the value set, it will be enforced to 25000000000 in bor.
|
pricelimit = 25000000000 # Minimum gas price limit to enforce for acceptance into the pool. Regardless the value set, it will be enforced to 25000000000 for all networks
|
||||||
pricebump = 10 # Price bump percentage to replace an already existing transaction
|
pricebump = 10 # Price bump percentage to replace an already existing transaction
|
||||||
accountslots = 16 # Minimum number of executable transaction slots guaranteed per account
|
accountslots = 16 # Minimum number of executable transaction slots guaranteed per account
|
||||||
globalslots = 32768 # Maximum number of executable transaction slots for all accounts
|
globalslots = 32768 # Maximum number of executable transaction slots for all accounts
|
||||||
|
|
@ -74,7 +74,7 @@ devfakeauthor = false # Run miner without validator set authorization
|
||||||
etherbase = "" # Public address for block mining rewards
|
etherbase = "" # Public address for block mining rewards
|
||||||
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 = "30000000000" # Minimum gas price for mining a transaction. Recommended for mainnet = 30000000000 (not enforced). For Amoy network, regardless the value set, it will be enforced to 25000000000 in bor.
|
gasprice = "25000000000" # Minimum gas price for mining a transaction. Regardless the value set, it will be enforced to 25000000000 for all networks
|
||||||
recommit = "2m5s" # The time interval for miner to re-create mining work
|
recommit = "2m5s" # The time interval for miner to re-create mining work
|
||||||
commitinterrupt = true # Interrupt the current mining work when time is exceeded and create partial blocks
|
commitinterrupt = true # Interrupt the current mining work when time is exceeded and create partial blocks
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ devfakeauthor = false # Run miner without validator set authorization
|
||||||
maxheaderhistory = 1024 # Maximum header history of gasprice oracle
|
maxheaderhistory = 1024 # Maximum header history of gasprice oracle
|
||||||
maxblockhistory = 1024 # Maximum block history of gasprice oracle
|
maxblockhistory = 1024 # Maximum block history of gasprice oracle
|
||||||
maxprice = "5000000000000" # Maximum gas price will be recommended by gpo
|
maxprice = "5000000000000" # Maximum gas price will be recommended by gpo
|
||||||
ignoreprice = "2" # Gas price below which gpo will ignore transactions. Recommended for mainnet = 30000000000 (not enforced). For Amoy network, regardless the value set, it will be enforced to 25000000000 in bor.
|
ignoreprice = "25000000000" # Gas price below which gpo will ignore transactions. Regardless the value set, it will be enforced to 25000000000 for all networks
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = false # Enable metrics collection and reporting
|
metrics = false # Enable metrics collection and reporting
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20)
|
- ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20)
|
||||||
|
|
||||||
- ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 2)
|
- ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 25000000000)
|
||||||
|
|
||||||
- ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024)
|
- ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024)
|
||||||
|
|
||||||
|
|
@ -250,7 +250,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```miner.gaslimit```: Target gas ceiling (gas limit) for mined blocks (default: 30000000)
|
- ```miner.gaslimit```: Target gas ceiling (gas limit) for mined blocks (default: 30000000)
|
||||||
|
|
||||||
- ```miner.gasprice```: Minimum gas price for mining a transaction (default: 1000000000)
|
- ```miner.gasprice```: Minimum gas price for mining a transaction (default: 25000000000)
|
||||||
|
|
||||||
- ```miner.interruptcommit```: Interrupt block commit when block creation time is passed (default: true)
|
- ```miner.interruptcommit```: Interrupt block commit when block creation time is passed (default: true)
|
||||||
|
|
||||||
|
|
@ -306,6 +306,6 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```txpool.pricebump```: Price bump percentage to replace an already existing transaction (default: 10)
|
- ```txpool.pricebump```: Price bump percentage to replace an already existing transaction (default: 10)
|
||||||
|
|
||||||
- ```txpool.pricelimit```: Minimum gas price limit to enforce for acceptance into the pool (default: 1)
|
- ```txpool.pricelimit```: Minimum gas price limit to enforce for acceptance into the pool (default: 25000000000)
|
||||||
|
|
||||||
- ```txpool.rejournal```: Time interval to regenerate the local transaction journal (default: 1h0m0s)
|
- ```txpool.rejournal```: Time interval to regenerate the local transaction journal (default: 1h0m0s)
|
||||||
|
|
@ -122,18 +122,13 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
if !config.SyncMode.IsValid() {
|
if !config.SyncMode.IsValid() {
|
||||||
return nil, fmt.Errorf("invalid sync mode %d", config.SyncMode)
|
return nil, fmt.Errorf("invalid sync mode %d", config.SyncMode)
|
||||||
}
|
}
|
||||||
// (PIP-35): Only enforce the minimum gas price of 25 gwei for amoy
|
|
||||||
if config.Genesis != nil && config.Genesis.Config.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
// PIP-35: Enforce min gas price to 25 gwei
|
||||||
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(big.NewInt(params.BorDefaultMinerGasPrice)) != 0 {
|
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(big.NewInt(params.BorDefaultMinerGasPrice)) != 0 {
|
||||||
log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", params.BorDefaultMinerGasPrice)
|
log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
|
||||||
config.Miner.GasPrice = new(big.Int).SetUint64(params.BorDefaultMinerGasPrice)
|
config.Miner.GasPrice = ethconfig.Defaults.Miner.GasPrice
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(common.Big0) <= 0 {
|
|
||||||
log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
|
|
||||||
config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.NoPruning && config.TrieDirtyCache > 0 {
|
if config.NoPruning && config.TrieDirtyCache > 0 {
|
||||||
if config.SnapshotCache > 0 {
|
if config.SnapshotCache > 0 {
|
||||||
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
|
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
|
||||||
|
|
@ -258,10 +253,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit, checker)
|
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit, checker)
|
||||||
}
|
}
|
||||||
|
|
||||||
// (PIP-35): Update the default ignore price for amoy
|
|
||||||
if chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
|
||||||
gasprice.DefaultIgnorePriceAmoy = new(big.Int).SetUint64(params.BorDefaultGpoIgnorePrice)
|
|
||||||
}
|
|
||||||
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
|
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -291,10 +282,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
|
|
||||||
// The `config.TxPool.PriceLimit` used above doesn't reflect the sanitized/enforced changes
|
// The `config.TxPool.PriceLimit` used above doesn't reflect the sanitized/enforced changes
|
||||||
// made in the txpool. Update the `gasTip` explicitly to reflect the enforced value.
|
// made in the txpool. Update the `gasTip` explicitly to reflect the enforced value.
|
||||||
// (PIP-35): This change is only applied for Amoy network. Remove the checks once it's applied for all networks.
|
eth.txPool.SetGasTip(new(big.Int).SetUint64(params.BorDefaultTxPoolPriceLimit))
|
||||||
if chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
|
||||||
eth.txPool.SetGasTip(new(big.Int).SetUint64(params.BorDefaultTxPoolPriceLimit))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Permit the downloader to use the trie cache allowance during fast sync
|
// Permit the downloader to use the trie cache allowance during fast sync
|
||||||
cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit
|
cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block) {
|
||||||
generate := func(i int, g *core.BlockGen) {
|
generate := func(i int, g *core.BlockGen) {
|
||||||
g.OffsetTime(5)
|
g.OffsetTime(5)
|
||||||
g.SetExtra([]byte("test"))
|
g.SetExtra([]byte("test"))
|
||||||
tx, _ := types.SignTx(types.NewTransaction(testNonce, common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"), big.NewInt(1), params.TxGas, big.NewInt(params.InitialBaseFee*2), nil), types.LatestSigner(&config), testKey)
|
tx, _ := types.SignTx(types.NewTransaction(testNonce, common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"), big.NewInt(1), params.TxGas, big.NewInt(params.InitialBaseFee*26), nil), types.LatestSigner(&config), testKey)
|
||||||
g.AddTx(tx)
|
g.AddTx(tx)
|
||||||
testNonce++
|
testNonce++
|
||||||
}
|
}
|
||||||
|
|
@ -604,7 +604,7 @@ func TestNewPayloadOnInvalidChain(t *testing.T) {
|
||||||
Nonce: statedb.GetNonce(testAddr),
|
Nonce: statedb.GetNonce(testAddr),
|
||||||
Value: new(big.Int),
|
Value: new(big.Int),
|
||||||
Gas: 1000000,
|
Gas: 1000000,
|
||||||
GasPrice: big.NewInt(2 * params.InitialBaseFee),
|
GasPrice: big.NewInt(26 * params.InitialBaseFee),
|
||||||
Data: logCode,
|
Data: logCode,
|
||||||
})
|
})
|
||||||
ethservice.TxPool().Add([]*types.Transaction{tx}, false, true)
|
ethservice.TxPool().Add([]*types.Transaction{tx}, false, true)
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,8 @@ import (
|
||||||
const sampleNumber = 3 // Number of transactions sampled in a block
|
const sampleNumber = 3 // Number of transactions sampled in a block
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultMaxPrice = big.NewInt(500 * params.GWei)
|
DefaultMaxPrice = big.NewInt(500 * params.GWei)
|
||||||
DefaultIgnorePrice = big.NewInt(2 * params.Wei)
|
DefaultIgnorePrice = big.NewInt(params.BorDefaultGpoIgnorePrice) // bor's default
|
||||||
DefaultIgnorePriceAmoy *big.Int // (PIP-35): Default ignore price for amoy (to be removed later)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
@ -101,21 +100,14 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
|
||||||
log.Warn("Sanitizing invalid gasprice oracle price cap", "provided", params.MaxPrice, "updated", maxPrice)
|
log.Warn("Sanitizing invalid gasprice oracle price cap", "provided", params.MaxPrice, "updated", maxPrice)
|
||||||
}
|
}
|
||||||
|
|
||||||
// (PIP-35): Enforce the ignore price for amoy. The default value for amoy (which is
|
// PIP-35: Enforce the ignore price to 25 gwei
|
||||||
// an indicator of being on amoy) should be set by the caller.
|
|
||||||
ignorePrice := params.IgnorePrice
|
ignorePrice := params.IgnorePrice
|
||||||
if DefaultIgnorePriceAmoy != nil {
|
if ignorePrice == nil || ignorePrice.Int64() != DefaultIgnorePrice.Int64() {
|
||||||
if ignorePrice == nil || ignorePrice.Int64() != DefaultIgnorePriceAmoy.Int64() {
|
ignorePrice = DefaultIgnorePrice
|
||||||
ignorePrice = DefaultIgnorePriceAmoy
|
log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
|
||||||
log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ignorePrice == nil || ignorePrice.Int64() <= 0 {
|
log.Info("Gasprice oracle is ignoring threshold set", "threshold", ignorePrice)
|
||||||
ignorePrice = DefaultIgnorePrice
|
|
||||||
log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.Info("Gasprice oracle is ignoring threshold set", "threshold", ignorePrice)
|
|
||||||
|
|
||||||
maxHeaderHistory := params.MaxHeaderHistory
|
maxHeaderHistory := params.MaxHeaderHistory
|
||||||
if maxHeaderHistory < 1 {
|
if maxHeaderHistory < 1 {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ func TestFlagsWithConfig(t *testing.T) {
|
||||||
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
|
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
require.Equal(t, c.config.Sealer.GasPrice, big.NewInt(30000000000))
|
require.Equal(t, c.config.Sealer.GasPrice, big.NewInt(25000000000))
|
||||||
require.Equal(t, c.config.Sealer.Recommit, recommit)
|
require.Equal(t, c.config.Sealer.Recommit, recommit)
|
||||||
require.Equal(t, c.config.JsonRPC.RPCEVMTimeout, evmTimeout)
|
require.Equal(t, c.config.JsonRPC.RPCEVMTimeout, evmTimeout)
|
||||||
require.Equal(t, c.config.JsonRPC.Http.API, []string{"eth", "bor"})
|
require.Equal(t, c.config.JsonRPC.Http.API, []string{"eth", "bor"})
|
||||||
|
|
|
||||||
|
|
@ -655,7 +655,7 @@ func DefaultConfig() *Config {
|
||||||
NoLocals: false,
|
NoLocals: false,
|
||||||
Journal: "transactions.rlp",
|
Journal: "transactions.rlp",
|
||||||
Rejournal: 1 * time.Hour,
|
Rejournal: 1 * time.Hour,
|
||||||
PriceLimit: 1, // Default for every network except Amoy
|
PriceLimit: params.BorDefaultTxPoolPriceLimit, // bor's default
|
||||||
PriceBump: 10,
|
PriceBump: 10,
|
||||||
AccountSlots: 16,
|
AccountSlots: 16,
|
||||||
GlobalSlots: 32768,
|
GlobalSlots: 32768,
|
||||||
|
|
@ -666,8 +666,8 @@ func DefaultConfig() *Config {
|
||||||
Sealer: &SealerConfig{
|
Sealer: &SealerConfig{
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Etherbase: "",
|
Etherbase: "",
|
||||||
GasCeil: 30_000_000, // geth's default
|
GasCeil: 30_000_000, // geth's default
|
||||||
GasPrice: big.NewInt(1 * params.GWei), // Default for every network except Amoy
|
GasPrice: big.NewInt(params.BorDefaultMinerGasPrice), // bor's default
|
||||||
ExtraData: "",
|
ExtraData: "",
|
||||||
Recommit: 125 * time.Second,
|
Recommit: 125 * time.Second,
|
||||||
CommitInterruptFlag: true,
|
CommitInterruptFlag: true,
|
||||||
|
|
@ -678,7 +678,7 @@ func DefaultConfig() *Config {
|
||||||
MaxHeaderHistory: 1024,
|
MaxHeaderHistory: 1024,
|
||||||
MaxBlockHistory: 1024,
|
MaxBlockHistory: 1024,
|
||||||
MaxPrice: gasprice.DefaultMaxPrice,
|
MaxPrice: gasprice.DefaultMaxPrice,
|
||||||
IgnorePrice: gasprice.DefaultIgnorePrice,
|
IgnorePrice: gasprice.DefaultIgnorePrice, // bor's default
|
||||||
},
|
},
|
||||||
JsonRPC: &JsonRPCConfig{
|
JsonRPC: &JsonRPCConfig{
|
||||||
IPCDisable: false,
|
IPCDisable: false,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func TestConfigLegacy(t *testing.T) {
|
||||||
"31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e",
|
"31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e",
|
||||||
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
|
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
|
||||||
}
|
}
|
||||||
testConfig.Sealer.GasPrice = big.NewInt(30000000000)
|
testConfig.Sealer.GasPrice = big.NewInt(25000000000)
|
||||||
testConfig.Sealer.Recommit = 20 * time.Second
|
testConfig.Sealer.Recommit = 20 * time.Second
|
||||||
testConfig.JsonRPC.RPCEVMTimeout = 5 * time.Second
|
testConfig.JsonRPC.RPCEVMTimeout = 5 * time.Second
|
||||||
testConfig.JsonRPC.TxFeeCap = 6.0
|
testConfig.JsonRPC.TxFeeCap = 6.0
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@ func TestConfigDefault(t *testing.T) {
|
||||||
|
|
||||||
// assertBorDefaultGasPrice asserts the bor default gas price is set correctly.
|
// assertBorDefaultGasPrice asserts the bor default gas price is set correctly.
|
||||||
func assertBorDefaultGasPrice(t *testing.T, ethConfig *ethconfig.Config) {
|
func assertBorDefaultGasPrice(t *testing.T, ethConfig *ethconfig.Config) {
|
||||||
// (PIP-35): Only applicable to amoy
|
|
||||||
t.Skip("Skipped because the price enforcement is only applied to amoy")
|
|
||||||
|
|
||||||
assert.NotNil(t, ethConfig)
|
assert.NotNil(t, ethConfig)
|
||||||
assert.Equal(t, ethConfig.Miner.GasPrice, big.NewInt(params.BorDefaultMinerGasPrice))
|
assert.Equal(t, ethConfig.Miner.GasPrice, big.NewInt(params.BorDefaultMinerGasPrice))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
internal/cli/server/testdata/default.toml
vendored
6
internal/cli/server/testdata/default.toml
vendored
|
|
@ -58,7 +58,7 @@ devfakeauthor = false
|
||||||
nolocals = false
|
nolocals = false
|
||||||
journal = "transactions.rlp"
|
journal = "transactions.rlp"
|
||||||
rejournal = "1h0m0s"
|
rejournal = "1h0m0s"
|
||||||
pricelimit = 1
|
pricelimit = 25000000000
|
||||||
pricebump = 10
|
pricebump = 10
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
|
|
@ -71,7 +71,7 @@ devfakeauthor = false
|
||||||
etherbase = ""
|
etherbase = ""
|
||||||
extradata = ""
|
extradata = ""
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "1000000000"
|
gasprice = "25000000000"
|
||||||
recommit = "2m5s"
|
recommit = "2m5s"
|
||||||
commitinterrupt = true
|
commitinterrupt = true
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ devfakeauthor = false
|
||||||
maxheaderhistory = 1024
|
maxheaderhistory = 1024
|
||||||
maxblockhistory = 1024
|
maxblockhistory = 1024
|
||||||
maxprice = "500000000000"
|
maxprice = "500000000000"
|
||||||
ignoreprice = "2"
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = false
|
metrics = false
|
||||||
|
|
|
||||||
2
internal/cli/server/testdata/test.toml
vendored
2
internal/cli/server/testdata/test.toml
vendored
|
|
@ -11,7 +11,7 @@ snapshot = true
|
||||||
"32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68"
|
"32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68"
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gasprice = "30000000000"
|
gasprice = "25000000000"
|
||||||
recommit = "20s"
|
recommit = "20s"
|
||||||
|
|
||||||
[jsonrpc]
|
[jsonrpc]
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,8 @@ type Config struct {
|
||||||
|
|
||||||
// DefaultConfig contains default settings for miner.
|
// DefaultConfig contains default settings for miner.
|
||||||
var DefaultConfig = Config{
|
var DefaultConfig = Config{
|
||||||
GasCeil: 30000000,
|
GasCeil: 30000000,
|
||||||
|
GasPrice: big.NewInt(params.BorDefaultMinerGasPrice), // enforce min gas price to 25 gwei for bor
|
||||||
// (PIP-35): Update the gas price to `params.BorDefaultMinerGasPrice` once
|
|
||||||
// the change is applied over all networks.
|
|
||||||
GasPrice: big.NewInt(params.GWei),
|
|
||||||
|
|
||||||
// The default recommit time is chosen as two seconds since
|
// The default recommit time is chosen as two seconds since
|
||||||
// consensus-layer usually will wait a half slot of time(6s)
|
// consensus-layer usually will wait a half slot of time(6s)
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ func (b *testWorkerBackend) PeerCount() int {
|
||||||
|
|
||||||
func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction {
|
func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction {
|
||||||
var tx *types.Transaction
|
var tx *types.Transaction
|
||||||
gasPrice := big.NewInt(10 * params.InitialBaseFee)
|
gasPrice := big.NewInt(26 * params.InitialBaseFee)
|
||||||
if creation {
|
if creation {
|
||||||
tx, _ = types.SignTx(types.NewContractCreation(b.txPool.Nonce(testBankAddress), big.NewInt(0), testGas, gasPrice, common.FromHex(testCode)), types.HomesteadSigner{}, testBankKey)
|
tx, _ = types.SignTx(types.NewContractCreation(b.txPool.Nonce(testBankAddress), big.NewInt(0), testGas, gasPrice, common.FromHex(testCode)), types.HomesteadSigner{}, testBankKey)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -297,7 +297,7 @@ func (b *testWorkerBackend) newRandomTxWithNonce(creation bool, nonce uint64) *t
|
||||||
func (b *testWorkerBackend) newStorageCreateContractTx() (*types.Transaction, common.Address) {
|
func (b *testWorkerBackend) newStorageCreateContractTx() (*types.Transaction, common.Address) {
|
||||||
var tx *types.Transaction
|
var tx *types.Transaction
|
||||||
|
|
||||||
gasPrice := big.NewInt(10 * params.InitialBaseFee)
|
gasPrice := big.NewInt(26 * params.InitialBaseFee)
|
||||||
|
|
||||||
tx, _ = types.SignTx(types.NewContractCreation(b.txPool.Nonce(TestBankAddress), big.NewInt(0), testGas, gasPrice, common.FromHex(storageContractByteCode)), types.HomesteadSigner{}, testBankKey)
|
tx, _ = types.SignTx(types.NewContractCreation(b.txPool.Nonce(TestBankAddress), big.NewInt(0), testGas, gasPrice, common.FromHex(storageContractByteCode)), types.HomesteadSigner{}, testBankKey)
|
||||||
contractAddr := crypto.CreateAddress(TestBankAddress, b.txPool.Nonce(TestBankAddress))
|
contractAddr := crypto.CreateAddress(TestBankAddress, b.txPool.Nonce(TestBankAddress))
|
||||||
|
|
@ -309,7 +309,7 @@ func (b *testWorkerBackend) newStorageCreateContractTx() (*types.Transaction, co
|
||||||
func (b *testWorkerBackend) newStorageContractCallTx(to common.Address, nonce uint64) *types.Transaction {
|
func (b *testWorkerBackend) newStorageContractCallTx(to common.Address, nonce uint64) *types.Transaction {
|
||||||
var tx *types.Transaction
|
var tx *types.Transaction
|
||||||
|
|
||||||
gasPrice := big.NewInt(10 * params.InitialBaseFee)
|
gasPrice := big.NewInt(26 * params.InitialBaseFee)
|
||||||
|
|
||||||
tx, _ = types.SignTx(types.NewTransaction(nonce, to, nil, storageCallTxGas, gasPrice, common.FromHex(storageContractTxCallData)), types.HomesteadSigner{}, testBankKey)
|
tx, _ = types.SignTx(types.NewTransaction(nonce, to, nil, storageCallTxGas, gasPrice, common.FromHex(storageContractTxCallData)), types.HomesteadSigner{}, testBankKey)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ gcmode = "archive"
|
||||||
|
|
||||||
[txpool]
|
[txpool]
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 30000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
accountqueue = 16
|
accountqueue = 16
|
||||||
|
|
@ -64,7 +64,7 @@ gcmode = "archive"
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "30000000000"
|
gasprice = "25000000000"
|
||||||
# mine = false
|
# mine = false
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
|
|
@ -121,7 +121,7 @@ gcmode = "archive"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
ignoreprice = "30000000000"
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[txpool]
|
[txpool]
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 30000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
accountqueue = 16
|
accountqueue = 16
|
||||||
|
|
@ -64,7 +64,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "30000000000"
|
gasprice = "25000000000"
|
||||||
# mine = false
|
# mine = false
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
|
|
@ -121,7 +121,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
ignoreprice = "30000000000"
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[txpool]
|
[txpool]
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 30000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
accountqueue = 16
|
accountqueue = 16
|
||||||
|
|
@ -67,7 +67,7 @@ syncmode = "full"
|
||||||
[miner]
|
[miner]
|
||||||
mine = true
|
mine = true
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "30000000000"
|
gasprice = "25000000000"
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
# recommit = "2m5s"
|
# recommit = "2m5s"
|
||||||
|
|
@ -123,7 +123,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
ignoreprice = "30000000000"
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ syncmode = "full"
|
||||||
|
|
||||||
[txpool]
|
[txpool]
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 30000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 32768
|
||||||
accountqueue = 16
|
accountqueue = 16
|
||||||
|
|
@ -67,7 +67,7 @@ syncmode = "full"
|
||||||
[miner]
|
[miner]
|
||||||
mine = true
|
mine = true
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
gasprice = "30000000000"
|
gasprice = "25000000000"
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
# recommit = "2m5s"
|
# recommit = "2m5s"
|
||||||
|
|
@ -123,7 +123,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
ignoreprice = "30000000000"
|
ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ gcmode = "archive"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
# rejournal = "1h0m0s"
|
# rejournal = "1h0m0s"
|
||||||
# pricelimit = 30000000000
|
# pricelimit = 25000000000
|
||||||
# pricebump = 10
|
# pricebump = 10
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
# gasprice = "30000000000"
|
# gasprice = "25000000000"
|
||||||
# mine = false
|
# mine = false
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
|
|
@ -121,7 +121,7 @@ gcmode = "archive"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
# ignoreprice = "30000000000"
|
# ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ syncmode = "full"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
# rejournal = "1h0m0s"
|
# rejournal = "1h0m0s"
|
||||||
# pricelimit = 30000000000
|
# pricelimit = 25000000000
|
||||||
# pricebump = 10
|
# pricebump = 10
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
# gasprice = "30000000000"
|
# gasprice = "25000000000"
|
||||||
# mine = false
|
# mine = false
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
|
|
@ -121,7 +121,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
# ignoreprice = "30000000000"
|
# ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,13 @@ syncmode = "full"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
# rejournal = "1h0m0s"
|
# rejournal = "1h0m0s"
|
||||||
# pricelimit = 30000000000
|
# pricelimit = 25000000000
|
||||||
# pricebump = 10
|
# pricebump = 10
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
mine = true
|
mine = true
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
# gasprice = "30000000000"
|
# gasprice = "25000000000"
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
# recommit = "2m5s"
|
# recommit = "2m5s"
|
||||||
|
|
@ -123,7 +123,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
# ignoreprice = "30000000000"
|
# ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,13 @@ syncmode = "full"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
# rejournal = "1h0m0s"
|
# rejournal = "1h0m0s"
|
||||||
# pricelimit = 30000000000
|
# pricelimit = 25000000000
|
||||||
# pricebump = 10
|
# pricebump = 10
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
mine = true
|
mine = true
|
||||||
gaslimit = 30000000
|
gaslimit = 30000000
|
||||||
# gasprice = "30000000000"
|
# gasprice = "25000000000"
|
||||||
# etherbase = ""
|
# etherbase = ""
|
||||||
# extradata = ""
|
# extradata = ""
|
||||||
# recommit = "2m5s"
|
# recommit = "2m5s"
|
||||||
|
|
@ -123,7 +123,7 @@ syncmode = "full"
|
||||||
# maxheaderhistory = 1024
|
# maxheaderhistory = 1024
|
||||||
# maxblockhistory = 1024
|
# maxblockhistory = 1024
|
||||||
# maxprice = "5000000000000"
|
# maxprice = "5000000000000"
|
||||||
# ignoreprice = "30000000000"
|
# ignoreprice = "25000000000"
|
||||||
|
|
||||||
[telemetry]
|
[telemetry]
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue