Skip to content

Commit

Permalink
store/v2: remove auto migration and fix restore cmd (#23568)
Browse files Browse the repository at this point in the history
Co-authored-by: mmsqe <[email protected]>
Co-authored-by: Marko <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
  • Loading branch information
4 people authored Jan 31, 2025
1 parent 009bcc3 commit 9a92843
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 209 deletions.
8 changes: 7 additions & 1 deletion runtime/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ require (
google.golang.org/protobuf v1.36.4
)

replace cosmossdk.io/store/v2 => ../../store/v2

require (
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect
cosmossdk.io/core/testing v0.0.1 // indirect
cosmossdk.io/errors/v2 v2.0.0 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/aybabtme/uniplot v0.0.0-20151203143629-039c559e5e7e // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bvinc/go-sqlite-lite v0.6.1 // indirect
github.com/bytedance/sonic v1.12.8 // indirect
github.com/bytedance/sonic/loader v0.2.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand All @@ -43,8 +47,10 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/iavl v1.3.4 // indirect
github.com/cosmos/iavl/v2 v2.0.0-alpha.4 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand All @@ -56,9 +62,9 @@ require (
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/kocubinski/costor-api v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/linxGnu/grocksdb v1.9.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand Down
22 changes: 18 additions & 4 deletions runtime/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ cosmossdk.io/server/v2/appmanager v1.0.0-beta.2 h1:58xH7Evpy/+9XbVwVf2+h009UN28N
cosmossdk.io/server/v2/appmanager v1.0.0-beta.2/go.mod h1:l6oCGNcucF6/U949UwRj+RemNzq5475ovNHohcvN1YM=
cosmossdk.io/server/v2/stf v1.0.0-beta.2 h1:d4zNeDvemOOxyIr0xDBpDKxhYKZBsLcxiK28sXAHm3o=
cosmossdk.io/server/v2/stf v1.0.0-beta.2/go.mod h1:O6Njxje0LbvC0RxdgwTmvBlbGcpKOfhbkdAguyq0ntQ=
cosmossdk.io/store/v2 v2.0.0-beta.1 h1:p1fdZ9uNijhpXZXdqs0QS6NmXNDVPNyT4DHV4yQnF64=
cosmossdk.io/store/v2 v2.0.0-beta.1/go.mod h1:qHQmf/9mnsXwo/Ypp2u2Zs6BmkYcx1R/Jrpyn9Ro13A=
cosmossdk.io/x/tx v1.1.0 h1:5C5XGNGYzbOTKbcf47oBI/VLObb5bmcMqH/C6H/sp1E=
cosmossdk.io/x/tx v1.1.0/go.mod h1:QF15QyTcGH4wfKawfRdSihWwutf4OhgiA+HIwWhjle0=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
Expand All @@ -34,10 +32,14 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/aybabtme/uniplot v0.0.0-20151203143629-039c559e5e7e h1:dSeuFcs4WAJJnswS8vXy7YY1+fdlbVPuEVmDAfqvFOQ=
github.com/aybabtme/uniplot v0.0.0-20151203143629-039c559e5e7e/go.mod h1:uh71c5Vc3VNIplXOFXsnDy21T1BepgT32c5X/YPrOyc=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bvinc/go-sqlite-lite v0.6.1 h1:JU8Rz5YAOZQiU3WEulKF084wfXpytRiqD2IaW2QjPz4=
github.com/bvinc/go-sqlite-lite v0.6.1/go.mod h1:2GiE60NUdb0aNhDdY+LXgrqAVDpi2Ijc6dB6ZMp9x6s=
github.com/bytedance/sonic v1.12.8 h1:4xYRVRlXIgvSZ4e8iVTlMF5szgpXd4AfvuWgA8I8lgs=
github.com/bytedance/sonic v1.12.8/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
Expand Down Expand Up @@ -73,13 +75,19 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.3.4 h1:A0RUAms7TZ0L6EFrrBIPg4Dy7qD9vvD5lJKUxEXURLM=
github.com/cosmos/iavl v1.3.4/go.mod h1:T6SfBcyhulVIY2G/ZtAtQm/QiJvsuhIos52V4dWYk88=
github.com/cosmos/iavl-bench/bench v0.0.4 h1:J6zQPiBqF4CXMM3QBsLqZgQEBGY0taX85vLIZMhmAfQ=
github.com/cosmos/iavl-bench/bench v0.0.4/go.mod h1:j2rLae77EffacWcp7mmj3Uaa4AOAmZA7ymvhsuBQKKI=
github.com/cosmos/iavl/v2 v2.0.0-alpha.4 h1:PfpQt7xl4hojw2UFS2JdJppJnx8sjlmcxRQ7Hxk7Cl0=
github.com/cosmos/iavl/v2 v2.0.0-alpha.4/go.mod h1:7RSm0aeApe3S1x4TrLffvUL6pjOtMYV4glYnpAhr2lw=
github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU=
github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A=
github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down Expand Up @@ -160,6 +168,8 @@ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iP
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand All @@ -175,6 +185,8 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kocubinski/costor-api v1.1.1 h1:sgfJA7T/8IfZ59zxiMrED0xdjerAFuPNBTqyO90GiEE=
github.com/kocubinski/costor-api v1.1.1/go.mod h1:ESMBMDkKfN+9vvvhhNVdKLhbOmzI3O/i16iXvRM9Tuc=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
Expand All @@ -185,8 +197,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik=
github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
Expand Down Expand Up @@ -265,6 +275,10 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
3 changes: 3 additions & 0 deletions server/v2/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ func topLevelCmd(ctx context.Context, use, short string) *cobra.Command {
var appBuildingCommands = [][]string{
{"start"},
{"genesis", "export"},
{"store", "restore"},
{"store", "prune"},
{"store", "export"},
}

// IsAppRequired determines if a command requires a full application to be built by
Expand Down
13 changes: 2 additions & 11 deletions server/v2/store/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,8 @@ Supported app-db-backend types include 'goleveldb', 'pebbledb'.`,
if err := vp.BindPFlags(cmd.PersistentFlags()); err != nil {
return err
}
logger := serverv2.GetLoggerFromCmd(cmd)

rootStore, opts, err := createRootStore(vp, logger)
if err != nil {
return fmt.Errorf("can not create root store %w", err)
}

latestHeight, err := rootStore.GetLatestVersion()
latestHeight, err := s.store.GetLatestVersion()
if err != nil {
return err
}
Expand All @@ -61,10 +55,7 @@ Supported app-db-backend types include 'goleveldb', 'pebbledb'.`,
return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight)
}

diff := latestHeight - opts.SCPruningOption.KeepRecent
cmd.Printf("pruning heights up to %v\n", diff)

err = rootStore.Prune(latestHeight)
err = s.store.Prune(latestHeight)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions server/v2/store/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const ServerName = "store"
// Server manages store config and contains prune & snapshot commands
type Server[T transaction.Tx] struct {
config *root.Config
store storev2.Backend
store storev2.RootStore
}

func New[T transaction.Tx](store storev2.Backend, cfg server.ConfigMap) (*Server[T], error) {
func New[T transaction.Tx](store storev2.RootStore, cfg server.ConfigMap) (*Server[T], error) {
config, err := UnmarshalConfig(cfg)
if err != nil {
return nil, err
Expand Down
19 changes: 2 additions & 17 deletions server/v2/store/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,10 @@ func (s *Server[T]) ExportSnapshotCmd() *cobra.Command {
}

logger := serverv2.GetLoggerFromCmd(cmd)
rootStore, _, err := createRootStore(v, logger)
if err != nil {
return err
}
if height == 0 {
lastCommitId, err := rootStore.LastCommitID()
if err != nil {
return err
}
height = lastCommitId.Version
}

cmd.Printf("Exporting snapshot for height %d\n", height)

sm, err := createSnapshotsManager(cmd, v, logger, rootStore)
sm, err := createSnapshotsManager(cmd, v, logger, s.store)
if err != nil {
return err
}
Expand Down Expand Up @@ -94,11 +83,7 @@ func (s *Server[T]) RestoreSnapshotCmd() *cobra.Command {
return err
}

rootStore, _, err := createRootStore(v, logger)
if err != nil {
return fmt.Errorf("failed to create root store: %w", err)
}
sm, err := createSnapshotsManager(cmd, v, logger, rootStore)
sm, err := createSnapshotsManager(cmd, v, logger, s.store)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion simapp/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -305,5 +305,4 @@ replace (
cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft
cosmossdk.io/server/v2/stf => ../../server/v2/stf
cosmossdk.io/store/v2 => ../../store/v2

)
2 changes: 1 addition & 1 deletion store/v2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]

### Improvements

* [#23568](https://github.com/cosmos/cosmos-sdk/pull/23568) Remove auto migration and fix restore cmd
* [#23013](https://github.com/cosmos/cosmos-sdk/pull/23013) Support memDB for sims

### Bug Fixes
Expand Down
3 changes: 3 additions & 0 deletions store/v2/commitment/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ loop:
node.Value = []byte{}
}
}
if node.Version == 0 {
node.Version = int64(version)
}
err := importer.Add(node)
if err != nil {
return snapshotstypes.SnapshotItem{}, fmt.Errorf("failed to add node to importer: %w", err)
Expand Down
47 changes: 2 additions & 45 deletions store/v2/root/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
"cosmossdk.io/store/v2/db"
"cosmossdk.io/store/v2/internal"
"cosmossdk.io/store/v2/metrics"
"cosmossdk.io/store/v2/migration"
"cosmossdk.io/store/v2/pruning"
"cosmossdk.io/store/v2/snapshots"
)

type (
Expand Down Expand Up @@ -115,31 +113,15 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) {
}

// check if we need to migrate the store
isMigrating := false
scType := storeOpts.SCType

if scType != SCTypeIavl {
isMigrating = true // need to migrate
scType = SCTypeIavl // only support iavl v1 for migration
}
scType := storeOpts.SCType

trees := make(map[string]commitment.Tree, len(opts.StoreKeys))
for _, key := range opts.StoreKeys {
tree, err := newTreeFn(key, scType)
if err != nil {
return nil, err
}
if isMigrating {
v, err := tree.GetLatestVersion()
if err != nil {
return nil, err
}
if v == 0 && latestVersion > 0 {
if err := tree.SetInitialVersion(latestVersion + 1); err != nil {
return nil, err
}
}
}
trees[key] = tree
}
oldTrees := make(map[string]commitment.Tree, len(opts.StoreKeys))
Expand All @@ -156,31 +138,6 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) {
return nil, err
}

var mm *migration.Manager
if isMigrating {
snapshotDB, err := snapshots.NewStore(fmt.Sprintf("%s/data/snapshots/store.db", opts.RootDir))
if err != nil {
return nil, err
}
snapshotMgr := snapshots.NewManager(snapshotDB, snapshots.SnapshotOptions{}, sc, nil, opts.Logger)
var newSC *commitment.CommitStore
if scType != storeOpts.SCType {
newTrees := make(map[string]commitment.Tree, len(opts.StoreKeys))
for _, key := range opts.StoreKeys {
tree, err := newTreeFn(key, storeOpts.SCType)
if err != nil {
return nil, err
}
newTrees[key] = tree
}
newSC, err = commitment.NewCommitStore(newTrees, nil, opts.SCRawDB, opts.Logger)
if err != nil {
return nil, err
}
}
mm = migration.NewManager(opts.SCRawDB, snapshotMgr, newSC, opts.Logger)
}

pm := pruning.NewManager(sc, storeOpts.SCPruningOption)
return New(opts.SCRawDB, opts.Logger, sc, pm, mm, metrics.NoOpMetrics{})
return New(opts.SCRawDB, opts.Logger, sc, pm, metrics.NoOpMetrics{})
}
1 change: 0 additions & 1 deletion store/v2/root/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestFactory(t *testing.T) {
f, err = CreateRootStore(&fop)
require.NoError(t, err)
require.NotNil(t, f)
require.False(t, f.(*Store).isMigrating)
}

func setLatestVersion(db corestore.KVStoreWithBatch, version int64) error {
Expand Down
8 changes: 1 addition & 7 deletions store/v2/root/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import (
"cosmossdk.io/store/v2/commitment"
"cosmossdk.io/store/v2/commitment/iavl"
dbm "cosmossdk.io/store/v2/db"
"cosmossdk.io/store/v2/migration"
"cosmossdk.io/store/v2/pruning"
"cosmossdk.io/store/v2/snapshots"
)

var storeKeys = []string{"store1", "store2", "store3"}
Expand Down Expand Up @@ -66,14 +64,10 @@ func (s *MigrateStoreTestSuite) SetupTest() {
sc, err := commitment.NewCommitStore(multiTrees1, nil, dbm.NewMemDB(), testLog)
s.Require().NoError(err)

snapshotsStore, err := snapshots.NewStore(s.T().TempDir())
s.Require().NoError(err)
snapshotManager := snapshots.NewManager(snapshotsStore, snapshots.NewSnapshotOptions(1500, 2), orgSC, nil, testLog)
migrationManager := migration.NewManager(dbm.NewMemDB(), snapshotManager, sc, testLog)
pm := pruning.NewManager(sc, nil)

// assume no storage store, simulate the migration process
s.rootStore, err = New(dbm.NewMemDB(), testLog, orgSC, pm, migrationManager, nil)
s.rootStore, err = New(dbm.NewMemDB(), testLog, orgSC, pm, nil)
s.Require().NoError(err)
}

Expand Down
Loading

0 comments on commit 9a92843

Please sign in to comment.