From afa67ac02b85dc2807215f0db1dd0fc44dd11e41 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:01:40 +0100 Subject: [PATCH] feat: add configurable iavl cache size (backport #10561) (#10698) * feat: add configurable iavl cache size (#10561) ## Description Closes: #1714 Bump default cache size to 50mb from 10kb. Allow node operators to set cache size. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit 76dde985364729222a53df33ffe14a0f60d46b7a) # Conflicts: # CHANGELOG.md # store/rootmulti/store.go * fix conflicts * fix conflicts++ * Update CHANGELOG.md Co-authored-by: Marko Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- CHANGELOG.md | 9 ++ baseapp/options.go | 16 +-- server/config/config.go | 28 ++--- server/config/toml.go | 200 +++++++++++++++++++++++++++++++++- server/mock/store.go | 3 + store/iavl/store.go | 10 +- store/iavl/store_test.go | 6 +- store/rootmulti/proof_test.go | 4 +- store/rootmulti/store.go | 74 +++++-------- store/types/iterator_test.go | 5 +- store/types/store.go | 18 --- 11 files changed, 261 insertions(+), 112 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b114907138..f6ad5abf50c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,8 +47,17 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [v0.44.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.5) - 2021-12-02 ### Improvements + * (baseapp) [\#10631](https://github.com/cosmos/cosmos-sdk/pull/10631) Emit ante events even for the failed txs. +### Features + +* [\#10561](https://github.com/cosmos/cosmos-sdk/pull/10561) Add configurable IAVL cache size to app.toml + +### API Breaking Changes + +* [\#10561](https://github.com/cosmos/cosmos-sdk/pull/10561) The `CommitMultiStore` interface contains a new `SetIAVLCacheSize` method + ### Bug Fixes * [\#10648](https://github.com/cosmos/cosmos-sdk/pull/10648) Upgrade IAVL to 0.17.3 to solve race condition bug in IAVL. diff --git a/baseapp/options.go b/baseapp/options.go index 53286b2540b9..9cb9ffde7a62 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -26,7 +26,7 @@ import ( // for options that need access to non-exported fields of the BaseApp // SetPruning sets a pruning option on the multistore associated with the app -func SetPruning(opts pruningtypes.PruningOptions) func(*BaseApp) { +func SetPruning(opts sdk.PruningOptions) func(*BaseApp) { return func(bapp *BaseApp) { bapp.cms.SetPruning(opts) } } @@ -40,15 +40,6 @@ func SetMinGasPrices(gasPricesStr string) func(*BaseApp) { return func(bapp *BaseApp) { bapp.setMinGasPrices(gasPrices) } } -// SetQueryGasLimit returns an option that sets a gas limit for queries. -func SetQueryGasLimit(queryGasLimit uint64) func(*BaseApp) { - if queryGasLimit == 0 { - queryGasLimit = math.MaxUint64 - } - - return func(bapp *BaseApp) { bapp.queryGasLimit = queryGasLimit } -} - // SetHaltHeight returns a BaseApp option function that sets the halt block height. func SetHaltHeight(blockHeight uint64) func(*BaseApp) { return func(bapp *BaseApp) { bapp.setHaltHeight(blockHeight) } @@ -81,11 +72,6 @@ func SetIAVLCacheSize(size int) func(*BaseApp) { return func(bapp *BaseApp) { bapp.cms.SetIAVLCacheSize(size) } } -// SetIAVLDisableFastNode enables(false)/disables(true) fast node usage from the IAVL store. -func SetIAVLDisableFastNode(disable bool) func(*BaseApp) { - return func(bapp *BaseApp) { bapp.cms.SetIAVLDisableFastNode(disable) } -} - // SetInterBlockCache provides a BaseApp option function that sets the // inter-block cache. func SetInterBlockCache(cache storetypes.MultiStorePersistentCache) func(*BaseApp) { diff --git a/server/config/config.go b/server/config/config.go index b75b5bd87f8c..bd03c9a5245c 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -81,16 +81,8 @@ type BaseConfig struct { // IndexEvents defines the set of events in the form {eventType}.{attributeKey}, // which informs CometBFT what to index. If empty, all events will be indexed. IndexEvents []string `mapstructure:"index-events"` - // IavlCacheSize set the size of the iavl tree cache. IAVLCacheSize uint64 `mapstructure:"iavl-cache-size"` - - // IAVLDisableFastNode enables or disables the fast sync node. - IAVLDisableFastNode bool `mapstructure:"iavl-disable-fastnode"` - - // AppDBBackend defines the type of Database to use for the application and snapshots databases. - // An empty string indicates that the CometBFT config's DBBackend value should be used. - AppDBBackend string `mapstructure:"app-db-backend"` } // APIConfig defines the API listener configuration. @@ -212,17 +204,15 @@ func (c *Config) GetMinGasPrices() sdk.DecCoins { func DefaultConfig() *Config { return &Config{ BaseConfig: BaseConfig{ - MinGasPrices: defaultMinGasPrices, - QueryGasLimit: 0, - InterBlockCache: true, - Pruning: pruningtypes.PruningOptionDefault, - PruningKeepRecent: "0", - PruningInterval: "0", - MinRetainBlocks: 0, - IndexEvents: make([]string, 0), - IAVLCacheSize: 781250, - IAVLDisableFastNode: false, - AppDBBackend: "", + MinGasPrices: defaultMinGasPrices, + InterBlockCache: true, + Pruning: storetypes.PruningOptionDefault, + PruningKeepRecent: "0", + PruningKeepEvery: "0", + PruningInterval: "0", + MinRetainBlocks: 0, + IndexEvents: make([]string, 0), + IAVLCacheSize: 781250, // 50 MB }, Telemetry: telemetry.Config{ Enabled: false, diff --git a/server/config/toml.go b/server/config/toml.go index 758f59da6afa..6f91fa2e893a 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -10,8 +10,204 @@ import ( "github.com/spf13/viper" ) -//go:embed config.toml.tpl -var DefaultConfigTemplate string +const DefaultConfigTemplate = `# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Base Configuration ### +############################################################################### + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = "{{ .BaseConfig.MinGasPrices }}" + +# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals +# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals +# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' +pruning = "{{ .BaseConfig.Pruning }}" + +# These are applied if and only if the pruning strategy is custom. +pruning-keep-recent = "{{ .BaseConfig.PruningKeepRecent }}" +pruning-keep-every = "{{ .BaseConfig.PruningKeepEvery }}" +pruning-interval = "{{ .BaseConfig.PruningInterval }}" + +# HaltHeight contains a non-zero block height at which a node will gracefully +# halt and shutdown that can be used to assist upgrades and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-height = {{ .BaseConfig.HaltHeight }} + +# HaltTime contains a non-zero minimum block time (in Unix seconds) at which +# a node will gracefully halt and shutdown that can be used to assist upgrades +# and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-time = {{ .BaseConfig.HaltTime }} + +# MinRetainBlocks defines the minimum block height offset from the current +# block being committed, such that all blocks past this offset are pruned +# from Tendermint. It is used as part of the process of determining the +# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates +# that no blocks should be pruned. +# +# This configuration value is only responsible for pruning Tendermint blocks. +# It has no bearing on application state pruning which is determined by the +# "pruning-*" configurations. +# +# Note: Tendermint block pruning is dependant on this parameter in conunction +# with the unbonding (safety threshold) period, state pruning and state sync +# snapshot parameters to determine the correct minimum value of +# ResponseCommit.RetainHeight. +min-retain-blocks = {{ .BaseConfig.MinRetainBlocks }} + +# InterBlockCache enables inter-block caching. +inter-block-cache = {{ .BaseConfig.InterBlockCache }} + +# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, +# which informs Tendermint what to index. If empty, all events will be indexed. +# +# Example: +# ["message.sender", "message.recipient"] +index-events = {{ .BaseConfig.IndexEvents }} + +# IavlCacheSize set the size of the iavl tree cache. +# Default cache size is 50mb. +iavl-cache-size = {{ .BaseConfig.IAVLCacheSize }} + +############################################################################### +### Telemetry Configuration ### +############################################################################### + +[telemetry] + +# Prefixed with keys to separate services. +service-name = "{{ .Telemetry.ServiceName }}" + +# Enabled enables the application telemetry functionality. When enabled, +# an in-memory sink is also enabled by default. Operators may also enabled +# other sinks such as Prometheus. +enabled = {{ .Telemetry.Enabled }} + +# Enable prefixing gauge values with hostname. +enable-hostname = {{ .Telemetry.EnableHostname }} + +# Enable adding hostname to labels. +enable-hostname-label = {{ .Telemetry.EnableHostnameLabel }} + +# Enable adding service to labels. +enable-service-label = {{ .Telemetry.EnableServiceLabel }} + +# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. +prometheus-retention-time = {{ .Telemetry.PrometheusRetentionTime }} + +# GlobalLabels defines a global set of name/value label tuples applied to all +# metrics emitted using the wrapper functions defined in telemetry package. +# +# Example: +# [["chain_id", "cosmoshub-1"]] +global-labels = [{{ range $k, $v := .Telemetry.GlobalLabels }} + ["{{index $v 0 }}", "{{ index $v 1}}"],{{ end }} +] + +############################################################################### +### API Configuration ### +############################################################################### + +[api] + +# Enable defines if the API server should be enabled. +enable = {{ .API.Enable }} + +# Swagger defines if swagger documentation should automatically be registered. +swagger = {{ .API.Swagger }} + +# Address defines the API server to listen on. +address = "{{ .API.Address }}" + +# MaxOpenConnections defines the number of maximum open connections. +max-open-connections = {{ .API.MaxOpenConnections }} + +# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). +rpc-read-timeout = {{ .API.RPCReadTimeout }} + +# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). +rpc-write-timeout = {{ .API.RPCWriteTimeout }} + +# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). +rpc-max-body-bytes = {{ .API.RPCMaxBodyBytes }} + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enabled-unsafe-cors = {{ .API.EnableUnsafeCORS }} + +############################################################################### +### Rosetta Configuration ### +############################################################################### + +[rosetta] + +# Enable defines if the Rosetta API server should be enabled. +enable = {{ .Rosetta.Enable }} + +# Address defines the Rosetta API server to listen on. +address = "{{ .Rosetta.Address }}" + +# Network defines the name of the blockchain that will be returned by Rosetta. +blockchain = "{{ .Rosetta.Blockchain }}" + +# Network defines the name of the network that will be returned by Rosetta. +network = "{{ .Rosetta.Network }}" + +# Retries defines the number of retries when connecting to the node before failing. +retries = {{ .Rosetta.Retries }} + +# Offline defines if Rosetta server should run in offline mode. +offline = {{ .Rosetta.Offline }} + +############################################################################### +### gRPC Configuration ### +############################################################################### + +[grpc] + +# Enable defines if the gRPC server should be enabled. +enable = {{ .GRPC.Enable }} + +# Address defines the gRPC server address to bind to. +address = "{{ .GRPC.Address }}" + +############################################################################### +### gRPC Web Configuration ### +############################################################################### + +[grpc-web] + +# GRPCWebEnable defines if the gRPC-web should be enabled. +# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. +enable = {{ .GRPCWeb.Enable }} + +# Address defines the gRPC-web server address to bind to. +address = "{{ .GRPCWeb.Address }}" + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enable-unsafe-cors = {{ .GRPCWeb.EnableUnsafeCORS }} + +############################################################################### +### State Sync Configuration ### +############################################################################### + +# State sync snapshots allow other nodes to rapidly join the network without replaying historical +# blocks, instead downloading and applying a snapshot of the application state at a given height. +[state-sync] + +# snapshot-interval specifies the block interval at which local state sync snapshots are +# taken (0 to disable). Must be a multiple of pruning-keep-every. +snapshot-interval = {{ .StateSync.SnapshotInterval }} + +# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). +snapshot-keep-recent = {{ .StateSync.SnapshotKeepRecent }} +` var configTemplate *template.Template diff --git a/server/mock/store.go b/server/mock/store.go index 18bb4f2d7d40..fa7721f44ea5 100644 --- a/server/mock/store.go +++ b/server/mock/store.go @@ -141,6 +141,9 @@ func (ms multiStore) SetIAVLCacheSize(size int) { func (ms multiStore) SetIAVLDisableFastNode(disable bool) { panic("not implemented") } +func (ms multiStore) SetIAVLCacheSize(size int) { + panic("not implemented") +} func (ms multiStore) SetInitialVersion(version int64) error { panic("not implemented") diff --git a/store/iavl/store.go b/store/iavl/store.go index 51ea2cdaf7bc..3e916184380a 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -44,18 +44,16 @@ type Store struct { // LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the // store's version (id) from the provided DB. An error is returned if the version // fails to load, or if called with a positive version on an empty tree. -func LoadStore(db corestore.KVStoreWithBatch, logger types.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - return LoadStoreWithInitialVersion(db, logger, key, id, 0, cacheSize, disableFastNode, metrics) +func LoadStore(db dbm.DB, id types.CommitID, lazyLoading bool, cacheSize int) (types.CommitKVStore, error) { + return LoadStoreWithInitialVersion(db, id, lazyLoading, 0, cacheSize) } // LoadStoreWithInitialVersion returns an IAVL Store as a CommitKVStore setting its initialVersion // to the one given. Internally, it will load the store's version (id) from the // provided DB. An error is returned if the version fails to load, or if called with a positive // version on an empty tree. -func LoadStoreWithInitialVersion(db corestore.KVStoreWithBatch, logger types.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - tree := iavl.NewMutableTree(db, cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion), iavl.AsyncPruningOption(true)) - - isUpgradeable, err := tree.IsUpgradeable() +func LoadStoreWithInitialVersion(db dbm.DB, id types.CommitID, lazyLoading bool, initialVersion uint64, cacheSize int) (types.CommitKVStore, error) { + tree, err := iavl.NewMutableTreeWithOpts(db, cacheSize, &iavl.Options{InitialVersion: initialVersion}) if err != nil { return nil, err } diff --git a/store/iavl/store_test.go b/store/iavl/store_test.go index d0339c59a107..27cf3be0b02a 100644 --- a/store/iavl/store_test.go +++ b/store/iavl/store_test.go @@ -105,17 +105,17 @@ func TestLoadStore(t *testing.T) { require.Equal(t, string(hcStore.Get([]byte("hello"))), "ciao") // Querying a new store at some previous non-pruned height H - newHStore, err := LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), cIDH, DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + newHStore, err := LoadStore(db, cIDH, false, DefaultIAVLCacheSize) require.NoError(t, err) require.Equal(t, string(newHStore.Get([]byte("hello"))), "hallo") // Querying a new store at some previous pruned height Hp - newHpStore, err := LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), cIDHp, DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + newHpStore, err := LoadStore(db, cIDHp, false, DefaultIAVLCacheSize) require.NoError(t, err) require.Equal(t, string(newHpStore.Get([]byte("hello"))), "hola") // Querying a new store at current height H - newHcStore, err := LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), cIDHc, DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + newHcStore, err := LoadStore(db, cIDHc, false, DefaultIAVLCacheSize) require.NoError(t, err) require.Equal(t, string(newHcStore.Get([]byte("hello"))), "ciao") } diff --git a/store/rootmulti/proof_test.go b/store/rootmulti/proof_test.go index aa595aa784c4..f6ad340935bc 100644 --- a/store/rootmulti/proof_test.go +++ b/store/rootmulti/proof_test.go @@ -14,8 +14,8 @@ import ( func TestVerifyIAVLStoreQueryProof(t *testing.T) { // Create main tree for testing. - db := coretesting.NewMemDB() - iStore, err := iavl.LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + db := dbm.NewMemDB() + iStore, err := iavl.LoadStore(db, types.CommitID{}, false, iavl.DefaultIAVLCacheSize) store := iStore.(*iavl.Store) require.Nil(t, err) store.Set([]byte("MYKEY"), []byte("MYVALUE")) diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 13799182690b..a21a7381a424 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -57,24 +57,23 @@ func keysFromStoreKeyMap[V any](m map[types.StoreKey]V) []types.StoreKey { // cacheMultiStore which is used for branching other MultiStores. It implements // the CommitMultiStore interface. type Store struct { - db corestore.KVStoreWithBatch - logger iavltree.Logger - lastCommitInfo *types.CommitInfo - pruningManager *pruning.Manager - iavlCacheSize int - iavlDisableFastNode bool - storesParams map[types.StoreKey]storeParams - stores map[types.StoreKey]types.CommitKVStore - keysByName map[string]types.StoreKey - initialVersion int64 - removalMap map[types.StoreKey]bool - traceWriter io.Writer - traceContext types.TraceContext - traceContextMutex sync.Mutex - interBlockCache types.MultiStorePersistentCache - listeners map[types.StoreKey]*types.MemoryListener - metrics metrics.StoreMetrics - commitHeader cmtproto.Header + db dbm.DB + lastCommitInfo *types.CommitInfo + pruningOpts types.PruningOptions + iavlCacheSize int + storesParams map[types.StoreKey]storeParams + stores map[types.StoreKey]types.CommitKVStore + keysByName map[string]types.StoreKey + lazyLoading bool + pruneHeights []int64 + initialVersion int64 + + traceWriter io.Writer + traceContext types.TraceContext + + interBlockCache types.MultiStorePersistentCache + + listeners map[types.StoreKey][]types.WriteListener } var ( @@ -88,17 +87,14 @@ var ( // LoadVersion must be called. func NewStore(db corestore.KVStoreWithBatch, logger iavltree.Logger, metricGatherer metrics.StoreMetrics) *Store { return &Store{ - db: db, - logger: logger, - iavlCacheSize: iavl.DefaultIAVLCacheSize, - iavlDisableFastNode: iavlDisablefastNodeDefault, - storesParams: make(map[types.StoreKey]storeParams), - stores: make(map[types.StoreKey]types.CommitKVStore), - keysByName: make(map[string]types.StoreKey), - listeners: make(map[types.StoreKey]*types.MemoryListener), - removalMap: make(map[types.StoreKey]bool), - pruningManager: pruning.NewManager(db, logger), - metrics: metricGatherer, + db: db, + pruningOpts: types.PruneNothing, + iavlCacheSize: iavl.DefaultIAVLCacheSize, + storesParams: make(map[types.StoreKey]storeParams), + stores: make(map[types.StoreKey]types.CommitKVStore), + keysByName: make(map[string]types.StoreKey), + pruneHeights: make([]int64, 0), + listeners: make(map[types.StoreKey][]types.WriteListener), } } @@ -114,23 +110,13 @@ func (rs *Store) SetPruning(pruningOpts pruningtypes.PruningOptions) { rs.pruningManager.SetOptions(pruningOpts) } -// SetMetrics sets the metrics gatherer for the store package -func (rs *Store) SetMetrics(metrics metrics.StoreMetrics) { - rs.metrics = metrics -} - -// SetSnapshotInterval sets the interval at which the snapshots are taken. -// It is used by the store to determine which heights to retain until after the snapshot is complete. -func (rs *Store) SetSnapshotInterval(snapshotInterval uint64) { - rs.pruningManager.SetSnapshotInterval(snapshotInterval) -} - func (rs *Store) SetIAVLCacheSize(cacheSize int) { rs.iavlCacheSize = cacheSize } -func (rs *Store) SetIAVLDisableFastNode(disableFastNode bool) { - rs.iavlDisableFastNode = disableFastNode +// SetLazyLoading sets if the iavl store should be loaded lazily or not +func (rs *Store) SetLazyLoading(lazyLoading bool) { + rs.lazyLoading = lazyLoading } // GetStoreType implements Store. @@ -1047,9 +1033,9 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID var err error if params.initialVersion == 0 { - store, err = iavl.LoadStore(db, rs.logger, key, id, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) + store, err = iavl.LoadStore(db, id, rs.lazyLoading, rs.iavlCacheSize) } else { - store, err = iavl.LoadStoreWithInitialVersion(db, rs.logger, key, id, params.initialVersion, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) + store, err = iavl.LoadStoreWithInitialVersion(db, id, rs.lazyLoading, params.initialVersion, rs.iavlCacheSize) } if err != nil { diff --git a/store/types/iterator_test.go b/store/types/iterator_test.go index f8a1af65b83a..86fc9e5a8cf9 100644 --- a/store/types/iterator_test.go +++ b/store/types/iterator_test.go @@ -13,9 +13,8 @@ import ( ) func newMemTestKVStore(t *testing.T) types.KVStore { - t.Helper() - db := coretesting.NewMemDB() - store, err := iavl.LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + db := dbm.NewMemDB() + store, err := iavl.LoadStore(db, types.CommitID{}, false, iavl.DefaultIAVLCacheSize) require.NoError(t, err) return store } diff --git a/store/types/store.go b/store/types/store.go index de77e2c548aa..f655e881a37f 100644 --- a/store/types/store.go +++ b/store/types/store.go @@ -216,24 +216,6 @@ type CommitMultiStore interface { // SetIAVLCacheSize sets the cache size of the IAVL tree. SetIAVLCacheSize(size int) - - // SetIAVLDisableFastNode enables/disables fastnode feature on iavl. - SetIAVLDisableFastNode(disable bool) - - // RollbackToVersion rollback the db to specific version(height). - RollbackToVersion(version int64) error - - // ListeningEnabled returns if listening is enabled for the KVStore belonging the provided StoreKey - ListeningEnabled(key StoreKey) bool - - // AddListeners adds a listener for the KVStore belonging to the provided StoreKey - AddListeners(keys []StoreKey) - - // PopStateCache returns the accumulated state change messages from the CommitMultiStore - PopStateCache() []*StoreKVPair - - // SetMetrics sets the metrics for the KVStore - SetMetrics(metrics metrics.StoreMetrics) } //---------subsp-------------------------------