Skip to content

Commit 55dbc14

Browse files
kocubinskimergify[bot]
authored andcommitted
feat(store/v2): add support for iavl/v2 (#22424)
(cherry picked from commit 24d456d) # Conflicts: # runtime/v2/go.mod # runtime/v2/go.sum # server/v2/go.mod # server/v2/go.sum # server/v2/testdata/app.toml # simapp/v2/go.mod # simapp/v2/go.sum # store/v2/commitment/iavl/tree_test.go # store/v2/commitment/store_test_suite.go # store/v2/go.mod # store/v2/go.sum # store/v2/pruning/manager_test.go # store/v2/root/factory.go # store/v2/root/migrate_test.go # store/v2/root/store_test.go # store/v2/root/upgrade_test.go # store/v2/storage/pebbledb/batch.go # store/v2/storage/storage_bench_test.go # store/v2/storage/store.go
1 parent 9273375 commit 55dbc14

File tree

30 files changed

+4515
-24
lines changed

30 files changed

+4515
-24
lines changed

runtime/v2/go.mod

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
module cosmossdk.io/runtime/v2
2+
3+
go 1.23
4+
5+
// server v2 integration
6+
replace (
7+
cosmossdk.io/api => ../../api
8+
cosmossdk.io/core/testing => ../../core/testing
9+
cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager
10+
cosmossdk.io/server/v2/stf => ../../server/v2/stf
11+
cosmossdk.io/store/v2 => ../../store/v2
12+
cosmossdk.io/x/tx => ../../x/tx
13+
)
14+
15+
require (
16+
cosmossdk.io/api v0.7.6
17+
cosmossdk.io/core v1.0.0-alpha.6
18+
cosmossdk.io/depinject v1.1.0
19+
cosmossdk.io/log v1.5.0
20+
cosmossdk.io/schema v0.3.0
21+
cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000
22+
cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000
23+
cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000
24+
cosmossdk.io/x/tx v1.0.0-alpha.1
25+
github.com/cosmos/gogoproto v1.7.0
26+
github.com/stretchr/testify v1.10.0
27+
google.golang.org/grpc v1.68.0
28+
google.golang.org/protobuf v1.35.2
29+
)
30+
31+
require (
32+
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect
33+
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect
34+
cosmossdk.io/core/testing v0.0.0 // indirect
35+
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect
36+
github.com/DataDog/zstd v1.5.5 // indirect
37+
github.com/beorn7/perks v1.0.1 // indirect
38+
github.com/bytedance/sonic v1.12.4 // indirect
39+
github.com/bytedance/sonic/loader v0.2.1 // indirect
40+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
41+
github.com/cloudwego/base64x v0.1.4 // indirect
42+
github.com/cloudwego/iasm v0.2.0 // indirect
43+
github.com/cockroachdb/errors v1.11.1 // indirect
44+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
45+
github.com/cockroachdb/pebble v1.1.0 // indirect
46+
github.com/cockroachdb/redact v1.1.5 // indirect
47+
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
48+
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
49+
github.com/cosmos/iavl v1.3.1 // indirect
50+
github.com/cosmos/ics23/go v0.11.0 // indirect
51+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
52+
github.com/emicklei/dot v1.6.2 // indirect
53+
github.com/getsentry/sentry-go v0.27.0 // indirect
54+
github.com/gogo/protobuf v1.3.2 // indirect
55+
github.com/golang/snappy v0.0.4 // indirect
56+
github.com/google/btree v1.1.3 // indirect
57+
github.com/google/go-cmp v0.6.0 // indirect
58+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
59+
github.com/hashicorp/go-metrics v0.5.3 // indirect
60+
github.com/hashicorp/golang-lru v1.0.2 // indirect
61+
github.com/klauspost/compress v1.17.9 // indirect
62+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
63+
github.com/kr/pretty v0.3.1 // indirect
64+
github.com/kr/text v0.2.0 // indirect
65+
github.com/linxGnu/grocksdb v1.9.3 // indirect
66+
github.com/mattn/go-colorable v0.1.13 // indirect
67+
github.com/mattn/go-isatty v0.0.20 // indirect
68+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
69+
github.com/onsi/gomega v1.28.1 // indirect
70+
github.com/pkg/errors v0.9.1 // indirect
71+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
72+
github.com/prometheus/client_golang v1.20.5 // indirect
73+
github.com/prometheus/client_model v0.6.1 // indirect
74+
github.com/prometheus/common v0.60.1 // indirect
75+
github.com/prometheus/procfs v0.15.1 // indirect
76+
github.com/rogpeppe/go-internal v1.12.0 // indirect
77+
github.com/rs/zerolog v1.33.0 // indirect
78+
github.com/spf13/cast v1.7.0 // indirect
79+
github.com/stretchr/objx v0.5.2 // indirect
80+
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
81+
github.com/tendermint/go-amino v0.16.0 // indirect
82+
github.com/tidwall/btree v1.7.0 // indirect
83+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
84+
golang.org/x/arch v0.12.0 // indirect
85+
golang.org/x/crypto v0.29.0 // indirect
86+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
87+
golang.org/x/net v0.30.0 // indirect
88+
golang.org/x/sync v0.9.0 // indirect
89+
golang.org/x/sys v0.27.0 // indirect
90+
golang.org/x/text v0.20.0 // indirect
91+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
92+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
93+
gopkg.in/yaml.v3 v3.0.1 // indirect
94+
sigs.k8s.io/yaml v1.4.0 // indirect
95+
)

runtime/v2/go.sum

Lines changed: 376 additions & 0 deletions
Large diffs are not rendered by default.

server/v2/cometbft/abci_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ package cometbft
22

33
import (
44
"context"
5-
"cosmossdk.io/core/server"
65
"crypto/sha256"
76
"encoding/json"
87
"errors"
9-
abci "github.com/cometbft/cometbft/abci/types"
108
"io"
119
"strings"
1210
"sync"
1311
"testing"
1412
"time"
1513

16-
"cosmossdk.io/server/v2/cometbft/oe"
14+
abci "github.com/cometbft/cometbft/abci/types"
1715
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
1816
v1 "github.com/cometbft/cometbft/api/cometbft/types/v1"
1917
"github.com/cosmos/gogoproto/proto"
2018
gogotypes "github.com/cosmos/gogoproto/types"
2119
"github.com/stretchr/testify/require"
2220

2321
appmodulev2 "cosmossdk.io/core/appmodule/v2"
22+
"cosmossdk.io/core/server"
2423
"cosmossdk.io/core/store"
2524
"cosmossdk.io/core/transaction"
2625
"cosmossdk.io/log"
2726
"cosmossdk.io/server/v2/appmanager"
2827
"cosmossdk.io/server/v2/cometbft/handlers"
2928
cometmock "cosmossdk.io/server/v2/cometbft/internal/mock"
3029
"cosmossdk.io/server/v2/cometbft/mempool"
30+
"cosmossdk.io/server/v2/cometbft/oe"
3131
"cosmossdk.io/server/v2/cometbft/types"
3232
"cosmossdk.io/server/v2/stf"
3333
"cosmossdk.io/server/v2/stf/branch"
@@ -60,10 +60,10 @@ func getQueryRouterBuilder[T any, PT interface {
6060
*T
6161
proto.Message
6262
},
63-
U any, UT interface {
64-
*U
65-
proto.Message
66-
}](
63+
U any, UT interface {
64+
*U
65+
proto.Message
66+
}](
6767
t *testing.T,
6868
handler func(ctx context.Context, msg PT) (UT, error),
6969
) *stf.MsgRouterBuilder {
@@ -90,10 +90,10 @@ func getMsgRouterBuilder[T any, PT interface {
9090
*T
9191
transaction.Msg
9292
},
93-
U any, UT interface {
94-
*U
95-
transaction.Msg
96-
}](
93+
U any, UT interface {
94+
*U
95+
transaction.Msg
96+
}](
9797
t *testing.T,
9898
handler func(ctx context.Context, msg PT) (UT, error),
9999
) *stf.MsgRouterBuilder {

server/v2/cometbft/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ require (
126126
github.com/magiconair/properties v1.8.7 // indirect
127127
github.com/mattn/go-colorable v0.1.13 // indirect
128128
github.com/mattn/go-isatty v0.0.20 // indirect
129-
github.com/mattn/go-sqlite3 v1.14.22 // indirect
130129
github.com/minio/highwayhash v1.0.3 // indirect
131130
github.com/mitchellh/mapstructure v1.5.0 // indirect
132131
github.com/mtibben/percent v0.2.1 // indirect

server/v2/cometbft/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
361361
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
362362
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
363363
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
364-
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
365-
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
366364
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
367365
github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q=
368366
github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=

server/v2/cometbft/internal/mock/mock_store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
dbm "cosmossdk.io/store/v2/db"
1313
"cosmossdk.io/store/v2/proof"
1414
"cosmossdk.io/store/v2/storage"
15-
"cosmossdk.io/store/v2/storage/sqlite"
15+
"cosmossdk.io/store/v2/storage/pebbledb"
1616
)
1717

1818
type MockStore struct {
@@ -21,7 +21,7 @@ type MockStore struct {
2121
}
2222

2323
func NewMockStorage(logger log.Logger, dir string) storev2.VersionedWriter {
24-
storageDB, _ := sqlite.New(dir)
24+
storageDB, _ := pebbledb.New(dir)
2525
ss := storage.NewStorageStore(storageDB, logger)
2626
return ss
2727
}

server/v2/cometbft/oe/optimistic_execution_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import (
55
"errors"
66
"testing"
77

8+
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
9+
"github.com/stretchr/testify/assert"
10+
811
"cosmossdk.io/core/server"
912
"cosmossdk.io/core/store"
1013
"cosmossdk.io/core/transaction"
1114
"cosmossdk.io/log"
12-
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
13-
"github.com/stretchr/testify/assert"
1415
)
1516

1617
func testFinalizeBlock[T transaction.Tx](context.Context, *abci.FinalizeBlockRequest) (*server.BlockResponse, store.WriterMap, []T, error) {

server/v2/cometbft/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cometbft
22

33
import (
44
"context"
5-
"cosmossdk.io/server/v2/cometbft/oe"
65
"crypto/sha256"
76
"encoding/json"
87
"fmt"
@@ -35,6 +34,7 @@ import (
3534
"cosmossdk.io/server/v2/appmanager"
3635
cometlog "cosmossdk.io/server/v2/cometbft/log"
3736
"cosmossdk.io/server/v2/cometbft/mempool"
37+
"cosmossdk.io/server/v2/cometbft/oe"
3838
"cosmossdk.io/server/v2/cometbft/types"
3939
"cosmossdk.io/store/v2/snapshots"
4040

server/v2/go.mod

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
module cosmossdk.io/server/v2
2+
3+
go 1.23
4+
5+
replace (
6+
cosmossdk.io/api => ../../api
7+
cosmossdk.io/server/v2/appmanager => ./appmanager
8+
cosmossdk.io/server/v2/stf => ./stf
9+
cosmossdk.io/store/v2 => ../../store/v2
10+
cosmossdk.io/store/v2/db => ../../store/v2/db
11+
cosmossdk.io/x/tx => ../../x/tx
12+
)
13+
14+
require (
15+
cosmossdk.io/api v0.7.6
16+
cosmossdk.io/core v1.0.0-alpha.6
17+
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e
18+
cosmossdk.io/log v1.5.0
19+
cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000
20+
cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000
21+
github.com/cosmos/cosmos-proto v1.0.0-beta.5
22+
github.com/cosmos/gogogateway v1.2.0
23+
github.com/cosmos/gogoproto v1.7.0
24+
github.com/golang/protobuf v1.5.4
25+
github.com/grpc-ecosystem/grpc-gateway v1.16.0
26+
github.com/hashicorp/go-hclog v1.6.3
27+
github.com/hashicorp/go-metrics v0.5.3
28+
github.com/hashicorp/go-plugin v1.6.2
29+
github.com/mitchellh/mapstructure v1.5.0
30+
github.com/pelletier/go-toml/v2 v2.2.2
31+
github.com/prometheus/client_golang v1.20.5
32+
github.com/prometheus/common v0.60.1
33+
github.com/rs/zerolog v1.33.0
34+
github.com/spf13/cobra v1.8.1
35+
github.com/spf13/pflag v1.0.5
36+
github.com/spf13/viper v1.19.0
37+
github.com/stretchr/testify v1.10.0
38+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
39+
google.golang.org/grpc v1.68.0
40+
google.golang.org/protobuf v1.35.2
41+
)
42+
43+
require (
44+
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect
45+
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac // indirect
46+
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
47+
github.com/DataDog/zstd v1.5.5 // indirect
48+
github.com/Microsoft/go-winio v0.6.1 // indirect
49+
github.com/beorn7/perks v1.0.1 // indirect
50+
github.com/bytedance/sonic v1.12.4 // indirect
51+
github.com/bytedance/sonic/loader v0.2.1 // indirect
52+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
53+
github.com/cloudwego/base64x v0.1.4 // indirect
54+
github.com/cloudwego/iasm v0.2.0 // indirect
55+
github.com/cockroachdb/errors v1.11.1 // indirect
56+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
57+
github.com/cockroachdb/pebble v1.1.0 // indirect
58+
github.com/cockroachdb/redact v1.1.5 // indirect
59+
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
60+
github.com/cosmos/iavl v1.3.1 // indirect
61+
github.com/cosmos/ics23/go v0.11.0 // indirect
62+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
63+
github.com/emicklei/dot v1.6.2 // indirect
64+
github.com/fatih/color v1.18.0 // indirect
65+
github.com/fsnotify/fsnotify v1.8.0 // indirect
66+
github.com/getsentry/sentry-go v0.27.0 // indirect
67+
github.com/gogo/googleapis v1.4.1 // indirect
68+
github.com/gogo/protobuf v1.3.2 // indirect
69+
github.com/golang/snappy v0.0.4 // indirect
70+
github.com/google/btree v1.1.3 // indirect
71+
github.com/google/go-cmp v0.6.0 // indirect
72+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
73+
github.com/hashicorp/golang-lru v1.0.2 // indirect
74+
github.com/hashicorp/hcl v1.0.0 // indirect
75+
github.com/hashicorp/yamux v0.1.2 // indirect
76+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
77+
github.com/jhump/protoreflect v1.17.0 // indirect
78+
github.com/klauspost/compress v1.17.9 // indirect
79+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
80+
github.com/kr/pretty v0.3.1 // indirect
81+
github.com/kr/text v0.2.0 // indirect
82+
github.com/linxGnu/grocksdb v1.9.3 // indirect
83+
github.com/magiconair/properties v1.8.7 // indirect
84+
github.com/mattn/go-colorable v0.1.13 // indirect
85+
github.com/mattn/go-isatty v0.0.20 // indirect
86+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
87+
github.com/oklog/run v1.1.0 // indirect
88+
github.com/onsi/gomega v1.28.1 // indirect
89+
github.com/pkg/errors v0.9.1 // indirect
90+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
91+
github.com/prometheus/client_model v0.6.1 // indirect
92+
github.com/prometheus/procfs v0.15.1 // indirect
93+
github.com/rogpeppe/go-internal v1.12.0 // indirect
94+
github.com/sagikazarmark/locafero v0.4.0 // indirect
95+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
96+
github.com/sourcegraph/conc v0.3.0 // indirect
97+
github.com/spf13/afero v1.11.0 // indirect
98+
github.com/spf13/cast v1.7.0 // indirect
99+
github.com/stretchr/objx v0.5.2 // indirect
100+
github.com/subosito/gotenv v1.6.0 // indirect
101+
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
102+
github.com/tendermint/go-amino v0.16.0 // indirect
103+
github.com/tidwall/btree v1.7.0 // indirect
104+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
105+
go.uber.org/multierr v1.11.0 // indirect
106+
golang.org/x/arch v0.12.0 // indirect
107+
golang.org/x/crypto v0.29.0 // indirect
108+
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
109+
golang.org/x/mod v0.17.0 // indirect
110+
golang.org/x/net v0.30.0 // indirect
111+
golang.org/x/sync v0.9.0 // indirect
112+
golang.org/x/sys v0.27.0 // indirect
113+
golang.org/x/text v0.20.0 // indirect
114+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
115+
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
116+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
117+
gopkg.in/ini.v1 v1.67.0 // indirect
118+
gopkg.in/yaml.v3 v3.0.1 // indirect
119+
)

0 commit comments

Comments
 (0)