feat!: Add gas limits to queries (backport #16239) (#17324)

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2023-08-09 10:22:34 +02:00
committed by GitHub
co-authored by Dev Ojha
parent 6b395f61d9
commit bee95b19b5
10 changed files with 109 additions and 2 deletions
+5
View File
@@ -39,6 +39,10 @@ type BaseConfig struct {
// specified in this config (e.g. 0.25token1;0.0001token2).
MinGasPrices string `mapstructure:"minimum-gas-prices"`
// The maximum amount of gas a grpc/Rest query may consume.
// If set to 0, it is unbounded.
QueryGasLimit uint64 `mapstructure:"query-gas-limit"`
Pruning string `mapstructure:"pruning"`
PruningKeepRecent string `mapstructure:"pruning-keep-recent"`
PruningInterval string `mapstructure:"pruning-interval"`
@@ -225,6 +229,7 @@ func DefaultConfig() *Config {
return &Config{
BaseConfig: BaseConfig{
MinGasPrices: defaultMinGasPrices,
QueryGasLimit: 0,
InterBlockCache: true,
Pruning: pruningtypes.PruningOptionDefault,
PruningKeepRecent: "0",
+4
View File
@@ -21,6 +21,10 @@ const DefaultConfigTemplate = `# This is a TOML config file.
# specified in this config (e.g. 0.25token1;0.0001token2).
minimum-gas-prices = "{{ .BaseConfig.MinGasPrices }}"
# The maximum gas a query coming over rest/grpc may consume.
# If this is set to zero, the query can consume an unbounded amount of gas.
query-gas-limit = "{{ .BaseConfig.QueryGasLimit }}"
# default: the last 362880 states are kept, pruning at 10 block intervals
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
# everything: 2 latest states will be kept; pruning at 10 block intervals.