Skip to content

Commit 27f6378

Browse files
authored
Merge branch 'main' into marko/errorsv2
2 parents e64794a + fe22e9a commit 27f6378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1588
-914
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ updates:
6161
labels:
6262
- "A:automerge"
6363
- dependencies
64+
- package-ecosystem: gomod
65+
directory: "/core/testing"
66+
schedule:
67+
interval: weekly
68+
day: thursday
69+
time: "01:30"
70+
labels:
71+
- "A:automerge"
72+
- dependencies
6473
- package-ecosystem: gomod
6574
directory: "/depinject"
6675
schedule:

.github/pr_labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
- store/**/*
1717
"C:collections":
1818
- collections/**/*
19+
"C:core/testing":
20+
- core/testing/**/*
1921
"C:log":
2022
- log/*
2123
"C:orm":

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,36 @@ jobs:
335335
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
336336
with:
337337
projectBaseDir: core/
338+
test-coretesting:
339+
runs-on: ubuntu-latest
340+
steps:
341+
- uses: actions/checkout@v4
342+
- uses: actions/setup-go@v5
343+
with:
344+
go-version: "1.20"
345+
check-latest: true
346+
cache: true
347+
cache-dependency-path: core/testing/go.sum
348+
- uses: technote-space/get-diff-action@v6.1.2
349+
id: git_diff
350+
with:
351+
PATTERNS: |
352+
core/testing/**/*.go
353+
core/testing/go.mod
354+
core/testing/go.sum
355+
- name: tests
356+
if: env.GIT_DIFF
357+
run: |
358+
cd core/testing
359+
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./...
360+
- name: sonarcloud
361+
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
362+
uses: SonarSource/sonarcloud-github-action@master
363+
env:
364+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
365+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
366+
with:
367+
projectBaseDir: core/testing/
338368

339369
test-depinject:
340370
runs-on: ubuntu-latest

client/v2/go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ require (
154154
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
155155
go.opencensus.io v0.24.0 // indirect
156156
go.uber.org/multierr v1.11.0 // indirect
157-
golang.org/x/crypto v0.23.0 // indirect
157+
golang.org/x/crypto v0.24.0 // indirect
158158
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
159159
golang.org/x/mod v0.17.0 // indirect
160160
golang.org/x/net v0.25.0 // indirect
161161
golang.org/x/sync v0.7.0 // indirect
162-
golang.org/x/sys v0.20.0 // indirect
163-
golang.org/x/term v0.20.0 // indirect
164-
golang.org/x/text v0.15.0 // indirect
165-
golang.org/x/tools v0.21.0 // indirect
162+
golang.org/x/sys v0.21.0 // indirect
163+
golang.org/x/term v0.21.0 // indirect
164+
golang.org/x/text v0.16.0 // indirect
165+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
166166
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
167167
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
168168
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
@@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ./../../
177177
replace (
178178
cosmossdk.io/api => ./../../api
179179
cosmossdk.io/core => ./../../core
180+
cosmossdk.io/core/testing => ../../core/testing
180181
cosmossdk.io/depinject => ./../../depinject
181182
cosmossdk.io/log => ./../../log
182183
cosmossdk.io/store => ./../../store

client/v2/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
513513
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
514514
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
515515
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
516-
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
517-
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
516+
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
517+
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
518518
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
519519
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg=
520520
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
@@ -598,19 +598,19 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
598598
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
599599
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
600600
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
601-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
602-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
601+
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
602+
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
603603
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
604604
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
605-
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
606-
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
605+
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
606+
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
607607
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
608608
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
609609
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
610610
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
611611
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
612-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
613-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
612+
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
613+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
614614
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
615615
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
616616
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -623,8 +623,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
623623
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
624624
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
625625
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
626-
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
627-
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
626+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
627+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
628628
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
629629
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
630630
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

collections/collections_test.go

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,16 @@ import (
55
"math"
66
"testing"
77

8-
db "github.com/cosmos/cosmos-db"
98
"github.com/stretchr/testify/require"
109

1110
"cosmossdk.io/core/store"
11+
"cosmossdk.io/core/testing"
1212
)
1313

14-
type testStore struct {
15-
db db.DB
16-
}
17-
18-
func (t testStore) OpenKVStore(ctx context.Context) store.KVStore {
19-
return t
20-
}
21-
22-
func (t testStore) Get(key []byte) ([]byte, error) {
23-
return t.db.Get(key)
24-
}
25-
26-
func (t testStore) Has(key []byte) (bool, error) {
27-
return t.db.Has(key)
28-
}
29-
30-
func (t testStore) Set(key, value []byte) error {
31-
return t.db.Set(key, value)
32-
}
33-
34-
func (t testStore) Delete(key []byte) error {
35-
return t.db.Delete(key)
36-
}
37-
38-
func (t testStore) Iterator(start, end []byte) (store.Iterator, error) {
39-
return t.db.Iterator(start, end)
40-
}
41-
42-
func (t testStore) ReverseIterator(start, end []byte) (store.Iterator, error) {
43-
return t.db.ReverseIterator(start, end)
44-
}
45-
46-
var _ store.KVStore = testStore{}
47-
4814
func deps() (store.KVStoreService, context.Context) {
49-
kv := db.NewMemDB()
50-
return &testStore{kv}, context.Background()
15+
ctx := coretesting.Context()
16+
kv := coretesting.KVStoreService(ctx, "test")
17+
return kv, ctx
5118
}
5219

5320
func TestPrefix(t *testing.T) {

collections/colltest/store.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

collections/go.mod

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,19 @@ module cosmossdk.io/collections
33
go 1.21
44

55
require (
6-
cosmossdk.io/core v0.11.0
7-
github.com/cosmos/cosmos-db v1.0.2
6+
cosmossdk.io/core v0.12.0
7+
cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000
88
github.com/stretchr/testify v1.9.0
99
pgregory.net/rapid v1.1.0
1010
)
1111

1212
require (
13-
cosmossdk.io/api v0.7.5 // indirect
14-
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
15-
github.com/DataDog/zstd v1.5.5 // indirect
16-
github.com/beorn7/perks v1.0.1 // indirect
17-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
18-
github.com/cockroachdb/errors v1.11.1 // indirect
19-
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
20-
github.com/cockroachdb/pebble v1.1.0 // indirect
21-
github.com/cockroachdb/redact v1.1.5 // indirect
22-
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
23-
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
24-
github.com/davecgh/go-spew v1.1.1 // indirect
25-
github.com/fsnotify/fsnotify v1.6.0 // indirect
26-
github.com/getsentry/sentry-go v0.27.0 // indirect
27-
github.com/gogo/protobuf v1.3.2 // indirect
28-
github.com/golang/snappy v0.0.4 // indirect
29-
github.com/google/btree v1.1.2 // indirect
30-
github.com/klauspost/compress v1.17.7 // indirect
31-
github.com/kr/pretty v0.3.1 // indirect
32-
github.com/kr/text v0.2.0 // indirect
33-
github.com/linxGnu/grocksdb v1.8.14 // indirect
34-
github.com/onsi/gomega v1.20.0 // indirect
35-
github.com/pkg/errors v0.9.1 // indirect
13+
github.com/cosmos/gogoproto v1.4.12 // indirect
14+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
15+
github.com/google/go-cmp v0.6.0 // indirect
3616
github.com/pmezard/go-difflib v1.0.0 // indirect
37-
github.com/prometheus/client_golang v1.19.1 // indirect
38-
github.com/prometheus/client_model v0.6.1 // indirect
39-
github.com/prometheus/common v0.54.0 // indirect
40-
github.com/prometheus/procfs v0.12.0 // indirect
4117
github.com/rogpeppe/go-internal v1.12.0 // indirect
42-
github.com/spf13/cast v1.6.0 // indirect
43-
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
18+
github.com/tidwall/btree v1.7.0 // indirect
4419
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
4520
golang.org/x/net v0.25.0 // indirect
4621
golang.org/x/sys v0.20.0 // indirect
@@ -50,3 +25,8 @@ require (
5025
google.golang.org/protobuf v1.34.1 // indirect
5126
gopkg.in/yaml.v3 v3.0.1 // indirect
5227
)
28+
29+
replace (
30+
cosmossdk.io/core => ../core
31+
cosmossdk.io/core/testing => ../core/testing
32+
)

0 commit comments

Comments
 (0)