mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-11 15:34:26 +00:00
This commit is contained in:
parent
e4ee00adf0
commit
0ece8529c4
6 changed files with 29 additions and 8 deletions
|
|
@ -150,6 +150,7 @@ var (
|
||||||
rpcFlags = []cli.Flag{
|
rpcFlags = []cli.Flag{
|
||||||
utils.HTTPEnabledFlag,
|
utils.HTTPEnabledFlag,
|
||||||
utils.RPCGlobalGasCapFlag,
|
utils.RPCGlobalGasCapFlag,
|
||||||
|
utils.RPCGlobalEVMTimeoutFlag,
|
||||||
utils.HTTPListenAddrFlag,
|
utils.HTTPListenAddrFlag,
|
||||||
utils.HTTPPortFlag,
|
utils.HTTPPortFlag,
|
||||||
utils.HTTPReadTimeoutFlag,
|
utils.HTTPReadTimeoutFlag,
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,12 @@ var (
|
||||||
Value: ethconfig.Defaults.RPCGasCap,
|
Value: ethconfig.Defaults.RPCGasCap,
|
||||||
Category: flags.APICategory,
|
Category: flags.APICategory,
|
||||||
}
|
}
|
||||||
|
RPCGlobalEVMTimeoutFlag = &cli.DurationFlag{
|
||||||
|
Name: "rpc-evmtimeout",
|
||||||
|
Usage: "Sets a timeout used for eth_call (0=infinite)",
|
||||||
|
Value: ethconfig.Defaults.RPCEVMTimeout,
|
||||||
|
Category: flags.APICategory,
|
||||||
|
}
|
||||||
RPCGlobalTxFeeCap = &cli.Float64Flag{
|
RPCGlobalTxFeeCap = &cli.Float64Flag{
|
||||||
Name: "rpc-txfeecap",
|
Name: "rpc-txfeecap",
|
||||||
Aliases: []string{"rpc.txfeecap"},
|
Aliases: []string{"rpc.txfeecap"},
|
||||||
|
|
@ -1618,6 +1624,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
} else {
|
} else {
|
||||||
log.Info("Global gas cap disabled")
|
log.Info("Global gas cap disabled")
|
||||||
}
|
}
|
||||||
|
if ctx.IsSet(RPCGlobalEVMTimeoutFlag.Name) {
|
||||||
|
cfg.RPCEVMTimeout = ctx.Duration(RPCGlobalEVMTimeoutFlag.Name)
|
||||||
|
}
|
||||||
if ctx.IsSet(StoreRewardFlag.Name) {
|
if ctx.IsSet(StoreRewardFlag.Name) {
|
||||||
common.StoreRewardFolder = filepath.Join(stack.DataDir(), "XDC", "rewards")
|
common.StoreRewardFolder = filepath.Join(stack.DataDir(), "XDC", "rewards")
|
||||||
if !common.FileExist(common.StoreRewardFolder) {
|
if !common.FileExist(common.StoreRewardFolder) {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
||||||
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
||||||
|
|
@ -393,6 +394,10 @@ func (b *EthAPIBackend) RPCGasCap() uint64 {
|
||||||
return b.eth.config.RPCGasCap
|
return b.eth.config.RPCGasCap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *EthAPIBackend) RPCEVMTimeout() time.Duration {
|
||||||
|
return b.eth.config.RPCEVMTimeout
|
||||||
|
}
|
||||||
|
|
||||||
func (b *EthAPIBackend) AccountManager() *accounts.Manager {
|
func (b *EthAPIBackend) AccountManager() *accounts.Manager {
|
||||||
return b.eth.AccountManager()
|
return b.eth.AccountManager()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,11 @@ var Defaults = Config{
|
||||||
FilterLogCacheSize: 32,
|
FilterLogCacheSize: 32,
|
||||||
GasPrice: big.NewInt(0.25 * params.Shannon),
|
GasPrice: big.NewInt(0.25 * params.Shannon),
|
||||||
|
|
||||||
TxPool: txpool.DefaultConfig,
|
TxPool: txpool.DefaultConfig,
|
||||||
RPCGasCap: 50000000,
|
RPCGasCap: 50000000,
|
||||||
GPO: FullNodeGPO,
|
RPCEVMTimeout: 5 * time.Second,
|
||||||
RPCTxFeeCap: 1, // 1 ether
|
GPO: FullNodeGPO,
|
||||||
|
RPCTxFeeCap: 1, // 1 ether
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate go run github.com/fjl/gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
|
//go:generate go run github.com/fjl/gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
|
||||||
|
|
@ -112,6 +113,9 @@ type Config struct {
|
||||||
// RPCGasCap is the global gas cap for eth-call variants.
|
// RPCGasCap is the global gas cap for eth-call variants.
|
||||||
RPCGasCap uint64
|
RPCGasCap uint64
|
||||||
|
|
||||||
|
// RPCEVMTimeout is the global timeout for eth-call.
|
||||||
|
RPCEVMTimeout time.Duration
|
||||||
|
|
||||||
// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
|
// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
|
||||||
// send-transction variants. The unit is ether.
|
// send-transction variants. The unit is ether.
|
||||||
RPCTxFeeCap float64
|
RPCTxFeeCap float64
|
||||||
|
|
|
||||||
|
|
@ -1230,7 +1230,7 @@ func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrO
|
||||||
latest := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
latest := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
||||||
blockNrOrHash = &latest
|
blockNrOrHash = &latest
|
||||||
}
|
}
|
||||||
timeout := 5 * time.Second
|
timeout := s.b.RPCEVMTimeout()
|
||||||
if args.To != nil && *args.To == common.MasternodeVotingSMCBinary {
|
if args.To != nil && *args.To == common.MasternodeVotingSMCBinary {
|
||||||
timeout = 0
|
timeout = 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package ethapi
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
||||||
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
||||||
|
|
@ -51,9 +52,10 @@ type Backend interface {
|
||||||
BlobBaseFee(ctx context.Context) *big.Int
|
BlobBaseFee(ctx context.Context) *big.Int
|
||||||
ChainDb() ethdb.Database
|
ChainDb() ethdb.Database
|
||||||
AccountManager() *accounts.Manager
|
AccountManager() *accounts.Manager
|
||||||
RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection
|
RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection
|
||||||
RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs
|
RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection
|
||||||
UnprotectedAllowed() bool // allows only for EIP155 transactions.
|
RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs
|
||||||
|
UnprotectedAllowed() bool // allows only for EIP155 transactions.
|
||||||
|
|
||||||
XDCxService() *XDCx.XDCX
|
XDCxService() *XDCx.XDCX
|
||||||
LendingService() *XDCxlending.Lending
|
LendingService() *XDCxlending.Lending
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue