From bc63ff719b650f5429742fdc7f8c1878d5789dbe Mon Sep 17 00:00:00 2001 From: Leo <52782564+LeoGuo621@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:44:24 +0800 Subject: [PATCH 1/3] dynamic config max_subscription_clients (#158) --- app/config/config.go | 25 ++++++++++++++++++- app/rpc/tests/rpc_test.go | 2 ++ cmd/client/flags.go | 4 +++ .../config/dynamic_config_okchain.go | 21 +++++++++++++--- libs/tendermint/lite/proxy/query_test.go | 9 +++++++ libs/tendermint/rpc/client/event_test.go | 12 +++++++++ libs/tendermint/rpc/core/events.go | 5 ++-- libs/tendermint/rpc/core/mempool.go | 5 ++-- libs/tendermint/rpc/grpc/grpc_test.go | 12 ++++++++- 9 files changed, 85 insertions(+), 10 deletions(-) diff --git a/app/config/config.go b/app/config/config.go index c1bd51fcb..159bc1bdc 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -128,6 +128,8 @@ type OkbcConfig struct { // commitGapOffset int64 + + maxSubscriptionClients int } const ( @@ -168,6 +170,7 @@ const ( FlagEnableHasBlockPartMsg = "enable-blockpart-ack" FlagDebugGcInterval = "debug.gc-interval" FlagCommitGapOffset = "commit-gap-offset" + FlagMaxSubscriptionClients = "max-subscription-clients" ) var ( @@ -320,6 +323,7 @@ func (c *OkbcConfig) loadFromConfig() { c.SetEnableHasBlockPartMsg(viper.GetBool(FlagEnableHasBlockPartMsg)) c.SetGcInterval(viper.GetInt(FlagDebugGcInterval)) c.SetIavlAcNoBatch(viper.GetBool(tmiavl.FlagIavlCommitAsyncNoBatch)) + c.SetMaxSubscriptionClients(viper.GetInt(FlagMaxSubscriptionClients)) } func resolveNodeKeyWhitelist(plain string) []string { @@ -392,7 +396,8 @@ func (c *OkbcConfig) format() string { commit-gap-height: %d enable-analyzer: %v iavl-commit-async-no-batch: %v - active-view-change: %v`, system.ChainName, + active-view-change: %v + max_subscription_clients: %v`, system.ChainName, c.GetMempoolRecheck(), c.GetMempoolForceRecheckGap(), c.GetMempoolSize(), @@ -422,6 +427,7 @@ func (c *OkbcConfig) format() string { c.GetEnableAnalyzer(), c.GetIavlAcNoBatch(), c.GetActiveVC(), + c.GetMaxSubscriptionClients(), ) } @@ -688,6 +694,12 @@ func (c *OkbcConfig) updateFromKVStr(k, v string) { return } c.SetCommitGapOffset(r) + case FlagMaxSubscriptionClients: + r, err := strconv.Atoi(v) + if err != nil { + return + } + c.SetMaxSubscriptionClients(r) } } @@ -1129,3 +1141,14 @@ func (c *OkbcConfig) GetIavlAcNoBatch() bool { func (c *OkbcConfig) SetIavlAcNoBatch(value bool) { c.iavlAcNoBatch = value } + +func (c *OkbcConfig) SetMaxSubscriptionClients(v int) { + if v < 0 { + v = 0 + } + c.maxSubscriptionClients = v +} + +func (c *OkbcConfig) GetMaxSubscriptionClients() int { + return c.maxSubscriptionClients +} diff --git a/app/rpc/tests/rpc_test.go b/app/rpc/tests/rpc_test.go index d45d97329..1a0be7c79 100644 --- a/app/rpc/tests/rpc_test.go +++ b/app/rpc/tests/rpc_test.go @@ -29,6 +29,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/okx/okbchain/app/config" "github.com/okx/okbchain/app/crypto/ethsecp256k1" "github.com/okx/okbchain/app/rpc/backend" cosmos_context "github.com/okx/okbchain/libs/cosmos-sdk/client/context" @@ -148,6 +149,7 @@ func (suite *RPCTestSuite) SetupTest() { viper.Set(flags.FlagKeyringBackend, "test") viper.Set(rpc.FlagPersonalAPI, true) + viper.Set(config.FlagMaxSubscriptionClients, 100) senderPv := suite.chain.SenderAccountPVBZ() genesisAcc = suite.chain.SenderAccount().GetAddress() diff --git a/cmd/client/flags.go b/cmd/client/flags.go index 3fb87042e..2f830cc3c 100644 --- a/cmd/client/flags.go +++ b/cmd/client/flags.go @@ -141,5 +141,9 @@ func RegisterAppFlag(cmd *cobra.Command) { cmd.Flags().Int(backend.FlagLogsLimit, 0, "Maximum number of logs returned when calling eth_getLogs") cmd.Flags().Int(backend.FlagLogsTimeout, 60, "Maximum query duration when calling eth_getLogs") cmd.Flags().Int(websockets.FlagSubscribeLimit, 15, "Maximum subscription on a websocket connection") + + // flags for tendermint rpc + cmd.Flags().Int(config.FlagMaxSubscriptionClients, 100, "Maximum number of unique clientIDs that Tendermint RPC server can /subscribe or /broadcast_tx_commit") + wasm.AddModuleInitFlags(cmd) } diff --git a/libs/tendermint/config/dynamic_config_okchain.go b/libs/tendermint/config/dynamic_config_okchain.go index 3185bc8d1..825a0030c 100644 --- a/libs/tendermint/config/dynamic_config_okchain.go +++ b/libs/tendermint/config/dynamic_config_okchain.go @@ -37,6 +37,7 @@ type IDynamicConfig interface { GetDynamicGpMaxTxNum() int64 GetDynamicGpMaxGasUsed() int64 GetGasLimitBuffer() uint64 + GetMaxSubscriptionClients() int } var DynamicConfig IDynamicConfig = MockDynamicConfig{} @@ -46,10 +47,11 @@ func SetDynamicConfig(c IDynamicConfig) { } type MockDynamicConfig struct { - enableDeleteMinGPTx bool - dynamicGpMode int - dynamicGpMaxTxNum int64 - dynamicGpMaxGasUsed int64 + enableDeleteMinGPTx bool + dynamicGpMode int + dynamicGpMaxTxNum int64 + dynamicGpMaxGasUsed int64 + maxSubscriptionClients int } func (d MockDynamicConfig) GetMempoolRecheck() bool { @@ -205,3 +207,14 @@ func (d MockDynamicConfig) GetDynamicGpMaxGasUsed() int64 { func (d MockDynamicConfig) GetGasLimitBuffer() uint64 { return 0 } + +func (d MockDynamicConfig) GetMaxSubscriptionClients() int { + return d.maxSubscriptionClients +} + +func (d *MockDynamicConfig) SetMaxSubscriptionClients(value int) { + if value < 0 { + return + } + d.maxSubscriptionClients = value +} diff --git a/libs/tendermint/lite/proxy/query_test.go b/libs/tendermint/lite/proxy/query_test.go index f91e975a8..1bda8cc79 100644 --- a/libs/tendermint/lite/proxy/query_test.go +++ b/libs/tendermint/lite/proxy/query_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/require" "github.com/okx/okbchain/libs/tendermint/abci/example/kvstore" + cfg "github.com/okx/okbchain/libs/tendermint/config" "github.com/okx/okbchain/libs/tendermint/crypto/merkle" "github.com/okx/okbchain/libs/tendermint/lite" certclient "github.com/okx/okbchain/libs/tendermint/lite/client" @@ -126,6 +127,7 @@ func _TestAppProofs(t *testing.T) { } func TestTxProofs(t *testing.T) { + setMocConfig(100) assert, require := assert.New(t), require.New(t) cl := rpclocal.New(node) @@ -163,3 +165,10 @@ func TestTxProofs(t *testing.T) { require.Nil(err, "%#v", err) require.Equal(res.Proof.RootHash, commit.Header.DataHash) } + +func setMocConfig(clientNum int) { + moc := cfg.MockDynamicConfig{} + moc.SetMaxSubscriptionClients(100) + + cfg.SetDynamicConfig(moc) +} diff --git a/libs/tendermint/rpc/client/event_test.go b/libs/tendermint/rpc/client/event_test.go index a83a48cd9..e48486a64 100644 --- a/libs/tendermint/rpc/client/event_test.go +++ b/libs/tendermint/rpc/client/event_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/okx/okbchain/libs/tendermint/abci/types" + cfg "github.com/okx/okbchain/libs/tendermint/config" tmrand "github.com/okx/okbchain/libs/tendermint/libs/rand" "github.com/okx/okbchain/libs/tendermint/rpc/client" ctypes "github.com/okx/okbchain/libs/tendermint/rpc/core/types" @@ -27,6 +28,7 @@ func MakeTxKV() ([]byte, []byte, []byte) { } func TestHeaderEvents(t *testing.T) { + setMocConfig(100) for i, c := range GetClients() { i, c := i, c // capture params t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { @@ -49,6 +51,7 @@ func TestHeaderEvents(t *testing.T) { } func TestBlockEvents(t *testing.T) { + setMocConfig(100) for i, c := range GetClients() { i, c := i, c // capture params t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { @@ -97,6 +100,7 @@ func TestTxEventsSentWithBroadcastTxAsync(t *testing.T) { testTxEventsSent(t, "a func TestTxEventsSentWithBroadcastTxSync(t *testing.T) { testTxEventsSent(t, "sync") } func testTxEventsSent(t *testing.T, broadcastMethod string) { + setMocConfig(100) for i, c := range GetClients() { i, c := i, c // capture params t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { @@ -150,6 +154,7 @@ func TestClientsResubscribe(t *testing.T) { } func TestHTTPReturnsErrorIfClientIsNotRunning(t *testing.T) { + setMocConfig(100) c := getHTTPClient() // on Subscribe @@ -166,3 +171,10 @@ func TestHTTPReturnsErrorIfClientIsNotRunning(t *testing.T) { err = c.UnsubscribeAll(context.Background(), "TestHeaderEvents") assert.Error(t, err) } + +func setMocConfig(clientNum int) { + moc := cfg.MockDynamicConfig{} + moc.SetMaxSubscriptionClients(100) + + cfg.SetDynamicConfig(moc) +} diff --git a/libs/tendermint/rpc/core/events.go b/libs/tendermint/rpc/core/events.go index 03c8552f1..0b46c7090 100644 --- a/libs/tendermint/rpc/core/events.go +++ b/libs/tendermint/rpc/core/events.go @@ -6,6 +6,7 @@ import ( "github.com/pkg/errors" + "github.com/okx/okbchain/libs/tendermint/config" tmpubsub "github.com/okx/okbchain/libs/tendermint/libs/pubsub" tmquery "github.com/okx/okbchain/libs/tendermint/libs/pubsub/query" ctypes "github.com/okx/okbchain/libs/tendermint/rpc/core/types" @@ -22,8 +23,8 @@ const ( func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error) { addr := ctx.RemoteAddr() - if env.EventBus.NumClients() >= env.Config.MaxSubscriptionClients { - return nil, fmt.Errorf("max_subscription_clients %d reached", env.Config.MaxSubscriptionClients) + if env.EventBus.NumClients() >= config.DynamicConfig.GetMaxSubscriptionClients() { + return nil, fmt.Errorf("max_subscription_clients %d reached", config.DynamicConfig.GetMaxSubscriptionClients()) } else if env.EventBus.NumClientSubscriptions(addr) >= env.Config.MaxSubscriptionsPerClient { return nil, fmt.Errorf("max_subscriptions_per_client %d reached", env.Config.MaxSubscriptionsPerClient) } diff --git a/libs/tendermint/rpc/core/mempool.go b/libs/tendermint/rpc/core/mempool.go index a68cf6434..09ca7b73a 100644 --- a/libs/tendermint/rpc/core/mempool.go +++ b/libs/tendermint/rpc/core/mempool.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" abci "github.com/okx/okbchain/libs/tendermint/abci/types" + "github.com/okx/okbchain/libs/tendermint/config" mempl "github.com/okx/okbchain/libs/tendermint/mempool" ctypes "github.com/okx/okbchain/libs/tendermint/rpc/core/types" rpctypes "github.com/okx/okbchain/libs/tendermint/rpc/jsonrpc/types" @@ -61,8 +62,8 @@ func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcas func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) { subscriber := ctx.RemoteAddr() - if env.EventBus.NumClients() >= env.Config.MaxSubscriptionClients { - return nil, fmt.Errorf("max_subscription_clients %d reached", env.Config.MaxSubscriptionClients) + if env.EventBus.NumClients() >= config.DynamicConfig.GetMaxSubscriptionClients() { + return nil, fmt.Errorf("max_subscription_clients %d reached", config.DynamicConfig.GetMaxSubscriptionClients()) } else if env.EventBus.NumClientSubscriptions(subscriber) >= env.Config.MaxSubscriptionsPerClient { return nil, fmt.Errorf("max_subscriptions_per_client %d reached", env.Config.MaxSubscriptionsPerClient) } diff --git a/libs/tendermint/rpc/grpc/grpc_test.go b/libs/tendermint/rpc/grpc/grpc_test.go index d38e7d077..485056d80 100644 --- a/libs/tendermint/rpc/grpc/grpc_test.go +++ b/libs/tendermint/rpc/grpc/grpc_test.go @@ -5,10 +5,12 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + "github.com/okx/okbchain/libs/tendermint/abci/example/kvstore" + cfg "github.com/okx/okbchain/libs/tendermint/config" core_grpc "github.com/okx/okbchain/libs/tendermint/rpc/grpc" rpctest "github.com/okx/okbchain/libs/tendermint/rpc/test" - "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { @@ -24,6 +26,7 @@ func TestMain(m *testing.M) { } func TestBroadcastTx(t *testing.T) { + setMocConfig(100) res, err := rpctest.GetGRPCClient().BroadcastTx( context.Background(), &core_grpc.RequestBroadcastTx{Tx: []byte("this is a tx")}, @@ -32,3 +35,10 @@ func TestBroadcastTx(t *testing.T) { require.EqualValues(t, 0, res.CheckTx.Code) require.EqualValues(t, 0, res.DeliverTx.Code) } + +func setMocConfig(clientNum int) { + moc := cfg.MockDynamicConfig{} + moc.SetMaxSubscriptionClients(100) + + cfg.SetDynamicConfig(moc) +} From 6a8be79597e10c5ad29a6332d07e32c7aa1ab480 Mon Sep 17 00:00:00 2001 From: chengzhinei Date: Thu, 1 Jun 2023 10:41:03 +0800 Subject: [PATCH 2/3] evm tx when outofgas not refund (#133) * evm tx when outofgas not refund * fix async refund --- app/refund/refund.go | 12 ++++++++++-- libs/cosmos-sdk/baseapp/baseapp_runtx.go | 13 ++++++++----- libs/cosmos-sdk/store/types/gas.go | 9 +++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/refund/refund.go b/app/refund/refund.go index 65445ec26..6ae020046 100644 --- a/app/refund/refund.go +++ b/app/refund/refund.go @@ -63,8 +63,16 @@ func gasRefund(ik innertx.InnerTxKeeper, ak accountKeeperInterface, sk types.Sup return nil, nil } - if tx.GetType() == sdk.StdTxType && ctx.GetOutOfGas() { - return nil, nil + if tmtypes.HigherThanEarth(ctx.BlockHeight()) { + if ctx.GetOutOfGas() { + ctx.GasMeter().SetGas(ctx.GasMeter().Limit()) + currentGasMeter.SetGas(gasLimit) + return nil, nil + } + } else { + if tx.GetType() == sdk.StdTxType && ctx.GetOutOfGas() { + return nil, nil + } } feeTx, ok := tx.(ante.FeeTx) diff --git a/libs/cosmos-sdk/baseapp/baseapp_runtx.go b/libs/cosmos-sdk/baseapp/baseapp_runtx.go index 57e6f6e53..f469103f4 100644 --- a/libs/cosmos-sdk/baseapp/baseapp_runtx.go +++ b/libs/cosmos-sdk/baseapp/baseapp_runtx.go @@ -4,13 +4,12 @@ import ( "fmt" "runtime/debug" - "github.com/pkg/errors" - - "github.com/okx/okbchain/libs/system/trace" - sdk "github.com/okx/okbchain/libs/cosmos-sdk/types" sdkerrors "github.com/okx/okbchain/libs/cosmos-sdk/types/errors" + "github.com/okx/okbchain/libs/system/trace" abci "github.com/okx/okbchain/libs/tendermint/abci/types" + tmtypes "github.com/okx/okbchain/libs/tendermint/types" + "github.com/pkg/errors" ) type runTxInfo struct { @@ -152,6 +151,10 @@ func (app *BaseApp) runtxWithInfo(info *runTxInfo, mode runTxMode, txBytes []byt if (tx.GetType() == sdk.StdTxType && isAnteSucceed && err == nil) || tx.GetType() == sdk.EvmTxType { handler.handleDeferRefund(info) + } else { + if tmtypes.HigherThanEarth(info.ctx.BlockHeight()) { + info.ctx.GasMeter().SetGas(info.ctx.GasMeter().Limit()) + } } }() @@ -386,7 +389,7 @@ func (app *BaseApp) runTx_defer_recover(r interface{}, info *runTxInfo) error { err = sdkerrors.Wrap( sdkerrors.ErrOutOfGas, fmt.Sprintf( "out of gas in location: %v; gasWanted: %d, gasUsed: %d", - rType.Descriptor, info.gasWanted, info.ctx.GasMeter().GasConsumed(), + rType.Descriptor, info.gasWanted, info.gasWanted, ), ) diff --git a/libs/cosmos-sdk/store/types/gas.go b/libs/cosmos-sdk/store/types/gas.go index 37c60b01f..882c2ec14 100644 --- a/libs/cosmos-sdk/store/types/gas.go +++ b/libs/cosmos-sdk/store/types/gas.go @@ -36,6 +36,7 @@ type GasMeter interface { GasConsumedToLimit() Gas Limit() Gas ConsumeGas(amount Gas, descriptor string) + SetGas(val Gas) IsPastLimit() bool IsOutOfGas() bool } @@ -96,6 +97,10 @@ func (g *basicGasMeter) ConsumeGas(amount Gas, descriptor string) { } } +func (g *basicGasMeter) SetGas(val Gas) { + g.consumed = val +} + func (g *basicGasMeter) IsPastLimit() bool { return g.consumed > g.limit } @@ -148,6 +153,10 @@ func (g *infiniteGasMeter) ConsumeGas(amount Gas, descriptor string) { } } +func (g *infiniteGasMeter) SetGas(val Gas) { + g.consumed = val +} + func (g *infiniteGasMeter) IsPastLimit() bool { return false } From 9c0b8c05d8cfea177876d81a438b16f53bbc81eb Mon Sep 17 00:00:00 2001 From: ylsGit Date: Thu, 1 Jun 2023 14:20:02 +0800 Subject: [PATCH 3/3] fix mpt flag env (#156) Co-authored-by: KamiD <44460798+KamiD@users.noreply.github.com> --- libs/cosmos-sdk/server/start.go | 8 ++++++++ libs/cosmos-sdk/server/start_okchain.go | 19 ++++++++----------- libs/cosmos-sdk/store/mpt/params.go | 2 -- libs/cosmos-sdk/store/mpt/store.go | 2 -- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libs/cosmos-sdk/server/start.go b/libs/cosmos-sdk/server/start.go index be5e987bc..ef80dbca2 100644 --- a/libs/cosmos-sdk/server/start.go +++ b/libs/cosmos-sdk/server/start.go @@ -354,4 +354,12 @@ func SetExternalPackageValue(cmd *cobra.Command) { consensus.SetActiveVC(viper.GetBool(FlagActiveViewChange)) tmtypes.EnableEventBlockTime = viper.GetBool(FlagEventBlockTime) + + mptstore.TrieDirtyDisabled = viper.GetBool(mptstore.FlagTrieDirtyDisabled) + mptstore.TrieCacheSize = viper.GetUint(mptstore.FlagTrieCacheSize) + mptstore.TriesInMemory = viper.GetUint(mptstore.FlagTrieInMemory) + mptstore.TrieAsyncDB = viper.GetBool(mptstore.FlagTrieAsyncDB) + mptstore.TrieAsyncDBInitCap = viper.GetInt(mptstore.FlagTrieAsyncDBInitCap) + mptstore.TrieAsyncDBAutoPruningOff = viper.GetBool(mptstore.FlagTrieAsyncDBAutoPruningOff) + mptstore.TrieAsyncDBSyncPruning = viper.GetBool(mptstore.FlagTrieAsyncDBSyncPruning) } diff --git a/libs/cosmos-sdk/server/start_okchain.go b/libs/cosmos-sdk/server/start_okchain.go index e4de8c2c4..5600bcd11 100644 --- a/libs/cosmos-sdk/server/start_okchain.go +++ b/libs/cosmos-sdk/server/start_okchain.go @@ -252,18 +252,15 @@ func RegisterServerFlags(cmd *cobra.Command) *cobra.Command { cmd.Flags().String(flags.FlagChainID, ChainID, "Chain ID of tendermint node for web3") cmd.Flags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async|block) for web3") - cmd.Flags().BoolVar(&mpt.TrieDirtyDisabled, mpt.FlagTrieDirtyDisabled, false, "Disable cache dirty trie nodes") - cmd.Flags().UintVar(&mpt.TrieCacheSize, mpt.FlagTrieCacheSize, 2048, "Size (MB) to cache trie nodes") - cmd.Flags().UintVar(&mpt.TrieNodesLimit, mpt.FlagTrieNodesLimit, 256, "Max node size (MB) cached in triedb") - cmd.Flags().UintVar(&mpt.TrieImgsLimit, mpt.FlagTrieImgsLimit, 4, "Max img size (MB) cached in triedb") - cmd.Flags().UintVar(&mpt.TrieAccStoreCache, mpt.FlagTrieAccStoreCache, 32, "Size (MB) to cache account") - cmd.Flags().UintVar(&mpt.TriesInMemory, mpt.FlagTrieInMemory, 100, "Max cache tire count in Memory") - cmd.Flags().BoolVar(&mpt.TrieAsyncDB, mpt.FlagTrieAsyncDB, true, "Enable async commit to trie db") - cmd.Flags().IntVar(&mpt.TrieAsyncDBInitCap, mpt.FlagTrieAsyncDBInitCap, 200_0000, "Init cap of trie async db") - cmd.Flags().BoolVar(&mpt.TrieAsyncDBAutoPruningOff, mpt.FlagTrieAsyncDBAutoPruningOff, false, "Disable auto prune of trie async db") - cmd.Flags().BoolVar(&mpt.TrieAsyncDBSyncPruning, mpt.FlagTrieAsyncDBSyncPruning, false, "if auto pruning is off and this is on, trie async db will be pruned every block in sync mode") - cmd.Flags().Int64(FlagCommitGapHeight, 10, "Block interval to commit cached data into db, affects iavl & mpt") + cmd.Flags().Bool(mpt.FlagTrieDirtyDisabled, false, "Disable cache dirty trie nodes") + cmd.Flags().Uint(mpt.FlagTrieCacheSize, 2048, "Size (MB) to cache trie nodes") + cmd.Flags().Uint(mpt.FlagTrieInMemory, 100, "Max cache tire count in Memory") + cmd.Flags().Bool(mpt.FlagTrieAsyncDB, true, "Enable async commit to trie db") + cmd.Flags().Int(mpt.FlagTrieAsyncDBInitCap, 200_0000, "Init cap of trie async db") + cmd.Flags().Bool(mpt.FlagTrieAsyncDBAutoPruningOff, false, "Disable auto prune of trie async db") + cmd.Flags().Bool(mpt.FlagTrieAsyncDBSyncPruning, false, "if auto pruning is off and this is on, trie async db will be pruned every block in sync mode") + cmd.Flags().Int64(FlagCommitGapHeight, 10, "Block interval to commit cached data into db, affects iavl & mpt") cmd.Flags().Int64(FlagFastSyncGap, 20, "Block height interval to switch fast-sync mode") return cmd diff --git a/libs/cosmos-sdk/store/mpt/params.go b/libs/cosmos-sdk/store/mpt/params.go index dc798948b..5ca978eaf 100644 --- a/libs/cosmos-sdk/store/mpt/params.go +++ b/libs/cosmos-sdk/store/mpt/params.go @@ -29,8 +29,6 @@ const ( var ( TrieDirtyDisabled = false TrieCacheSize uint = 2048 // MB - TrieNodesLimit uint = 256 // MB - TrieImgsLimit uint = 4 // MB TrieCommitGap int64 = 100 TriesInMemory uint = 100 diff --git a/libs/cosmos-sdk/store/mpt/store.go b/libs/cosmos-sdk/store/mpt/store.go index 0a492e3ce..2dbc9b8b7 100644 --- a/libs/cosmos-sdk/store/mpt/store.go +++ b/libs/cosmos-sdk/store/mpt/store.go @@ -37,8 +37,6 @@ const ( ) var ( - TrieAccStoreCache uint = 32 // MB - AccountStateRootRetriever StateRootRetriever = EmptyStateRootRetriever{} applyDelta = false