-
Notifications
You must be signed in to change notification settings - Fork 360
fix(mempool): Prevent runTx failures #1425
Changes from 3 commits
b8ff23d
d20570d
b697a60
838fd0c
d50e582
7a2ea33
e8f31ad
a8bc57d
1cb455c
a77f174
69329b1
bc65f34
5262965
9e56706
cf9c1d5
1fdca16
ace17c4
127a25f
0e03eff
324e24a
6bd959e
0c0b3d0
f686f83
dc6302c
c1a9e54
51e7c77
40303ec
d5d59b7
49eb151
a76c9b5
7c420b0
7c758a1
deff092
0292437
af457a4
c82042a
92cadd1
a8222c0
66e3f65
ba7c9dc
f2c30d6
e0e30d7
9f08107
bd216d5
3fc2ac1
e50a5e9
c2870a8
2c752d7
80533a6
1cc85b8
8c96574
8a521ab
9b8fc41
a4363aa
9d39963
fce00ab
b75cafa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
// | ||
// Copyright (C) 2023, Berachain Foundation. All rights reserved. | ||
// Use of this software is govered by the Business Source License included | ||
// in the LICENSE file of this repository and at www.mariadb.com/bsl11. | ||
// | ||
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY | ||
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER | ||
// VERSIONS OF THE LICENSED WORK. | ||
// | ||
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF | ||
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF | ||
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). | ||
// | ||
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON | ||
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, | ||
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND | ||
// TITLE. | ||
|
||
package config | ||
|
||
import ( | ||
"github.com/berachain/polaris/eth/node" | ||
"github.com/berachain/polaris/eth/polar" | ||
|
||
cmtcfg "github.com/cometbft/cometbft/config" | ||
|
||
serverconfig "github.com/cosmos/cosmos-sdk/server/config" | ||
) | ||
|
||
// RecommendedCometBFTConfig returns the recommended CometBFT config | ||
// for the application. | ||
func RecommendedCometBFTConfig() *cmtcfg.Config { | ||
cfg := cmtcfg.DefaultConfig() | ||
cfg.Mempool.Size = 30000 | ||
cfg.Mempool.CacheSize = 30000 | ||
cfg.Mempool.Recheck = true | ||
cfg.Mempool.Type = "flood" | ||
|
||
cfg.P2P.MaxNumInboundPeers = 10 | ||
cfg.P2P.MaxNumOutboundPeers = 15 | ||
|
||
cfg.TxIndex.Indexer = "null" | ||
|
||
cfg.Instrumentation.Prometheus = true | ||
return cfg | ||
} | ||
|
||
// RecommendedServerConfig returns the recommended server config. | ||
func RecommendedServerConfig() *serverconfig.Config { | ||
cfg := serverconfig.DefaultConfig() | ||
cfg.MinGasPrices = "0abera" | ||
cfg.API.Enable = true | ||
cfg.Telemetry.Enabled = true | ||
cfg.Telemetry.PrometheusRetentionTime = 180 | ||
cfg.Telemetry.EnableHostnameLabel = true | ||
cfg.Telemetry.GlobalLabels = [][]string{} | ||
cfg.IAVLCacheSize = 20000 | ||
return cfg | ||
} | ||
|
||
// DefaultPolarisConfig returns the default polaris config. | ||
func DefaultPolarisConfig() *Config { | ||
nodeCfg := node.DefaultConfig() | ||
nodeCfg.DataDir = "" | ||
nodeCfg.KeyStoreDir = "" | ||
return &Config{ | ||
Polar: *polar.DefaultConfig(), | ||
Node: *nodeCfg, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,9 @@ import ( | |
"cosmossdk.io/log" | ||
confixcmd "cosmossdk.io/tools/confix/cmd" | ||
|
||
evmconfig "github.com/berachain/polaris/cosmos/config" | ||
polarconfig "github.com/berachain/polaris/cosmos/config" | ||
testapp "github.com/berachain/polaris/e2e/testapp" | ||
|
||
cmtcfg "github.com/cometbft/cometbft/config" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/debug" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
|
@@ -56,51 +54,22 @@ import ( | |
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" | ||
) | ||
|
||
// initCometBFTConfig helps to override default CometBFT Config values. | ||
// return cmtcfg.DefaultConfig if no custom configuration is required for | ||
// the application. | ||
func initCometBFTConfig() *cmtcfg.Config { | ||
cfg := cmtcfg.DefaultConfig() | ||
return cfg | ||
} | ||
|
||
// initAppConfig helps to override default appConfig template and configs. | ||
// return "", nil if no custom configuration is required for the application. | ||
func initAppConfig() (string, interface{}) { | ||
// The following code snippet is just for reference. | ||
|
||
type CustomAppConfig struct { | ||
serverconfig.Config | ||
Polaris evmconfig.Config `mapstructure:"polaris"` | ||
Polaris polarconfig.Config `mapstructure:"polaris"` | ||
} | ||
|
||
// Optionally allow the chain developer to overwrite the SDK's default | ||
// server config. | ||
srvCfg := serverconfig.DefaultConfig() | ||
// The SDK's default minimum gas price is set to "" (empty value) inside | ||
// app.toml. If left empty by validators, the node will halt on startup. | ||
// However, the chain developer can set a default app.toml value for their | ||
// validators here. | ||
// | ||
// In summary: | ||
// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their | ||
// own app.toml config, | ||
// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their | ||
// own app.toml to override, or use this default value. | ||
// | ||
// In simapp, we set the min gas prices to 0. | ||
srvCfg.MinGasPrices = "0stake" | ||
// srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default | ||
srvCfg.IAVLCacheSize = 10000 | ||
|
||
customAppConfig := CustomAppConfig{ | ||
Config: *srvCfg, | ||
Polaris: *evmconfig.DefaultConfig(), | ||
Config: *polarconfig.RecommendedServerConfig(), | ||
Polaris: *polarconfig.DefaultPolarisConfig(), | ||
} | ||
|
||
customAppConfig.Telemetry.Enabled = true | ||
|
||
customAppTemplate := serverconfig.DefaultConfigTemplate + evmconfig.PolarisConfigTemplate | ||
customAppTemplate := serverconfig.DefaultConfigTemplate + polarconfig.PolarisConfigTemplate | ||
Comment on lines
+64
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The review comment is partially correct. The Analysis chainThe modification of the Scripts ExecutedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Verify that the new configuration is correctly applied in the `initAppConfig` function.
rg 'initAppConfig' --type go -C 10
Length of output: 2915 Script: #!/bin/bash
# Search for any remaining references to `evmconfig` to ensure all replacements with `polarconfig` have been made.
rg 'evmconfig' --type go
# Check for any other parts of the code that might be affected by the changes in the `initAppConfig` function.
rg 'initAppConfig' --type go -C 30
Length of output: 8328 |
||
|
||
return customAppTemplate, customAppConfig | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The search results indicate that the
DefaultConfig
function is indeed used in various places within the codebase. Specifically, it is referenced in files such aseth/node/config.go
,eth/polar/config.go
,cosmos/precompile/governance/testutil.go
, and several times withincosmos/config/default.go
.Given this information, it appears that the removal of the
DefaultConfig
function fromcosmos/config/config.go
could potentially impact other parts of the codebase where this function is expected to exist.Analysis chain
The removal of the
DefaultConfig
function is not mentioned in the summary. Please confirm that this function is not used elsewhere in the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
Length of output: 445