Skip to content

Commit bf33506

Browse files
authored
Merge branch 'main' into aaronc/schema-api-types
2 parents 13e84c4 + c44683d commit bf33506

Some content is hidden

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

82 files changed

+1280
-1097
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ that you would like early feedback and tagging whoever you would like to receive
200200
Codeowners are marked automatically as the reviewers.
201201

202202
All PRs require at least two review approvals before they can be merged (one review might be acceptable in
203-
the case of minor changes to [docs](./.github/PULL_REQUEST_TEMPLATE/docs.md) changes that do not affect production code). Each PR template has a reviewers checklist that must be completed before the PR can be merged. Each reviewer is responsible
203+
the case of minor changes to docs changes that do not affect production code). Each PR template has a reviewers checklist that must be completed before the PR can be merged. Each reviewer is responsible
204204
for all checked items unless they have indicated otherwise by leaving their handle next to specific
205205
items. In addition, use the following review explanations:
206206

baseapp/streaming.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const (
3333
// kv-store keys, and app modules. Using the built-in indexer framework is mutually exclusive from using other
3434
// types of streaming listeners.
3535
func (app *BaseApp) EnableIndexer(indexerOpts interface{}, keys map[string]*storetypes.KVStoreKey, appModules map[string]any) error {
36-
listener, err := indexer.StartManager(indexer.ManagerOptions{
36+
listener, err := indexer.StartIndexing(indexer.IndexingOptions{
3737
Config: indexerOpts,
3838
Resolver: decoding.ModuleSetDecoderResolver(appModules),
3939
SyncSource: nil,
@@ -47,7 +47,7 @@ func (app *BaseApp) EnableIndexer(indexerOpts interface{}, keys map[string]*stor
4747
app.cms.AddListeners(exposedKeys)
4848

4949
app.streamingManager = storetypes.StreamingManager{
50-
ABCIListeners: []storetypes.ABCIListener{listenerWrapper{listener}},
50+
ABCIListeners: []storetypes.ABCIListener{listenerWrapper{listener.Listener}},
5151
StopNodeOnErr: true,
5252
}
5353

client/v2/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
cosmossdk.io/errors v1.0.1 // indirect
2828
cosmossdk.io/log v1.4.1 // indirect
2929
cosmossdk.io/math v1.3.0
30-
cosmossdk.io/schema v0.3.0 // indirect
30+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect
3131
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect
3232
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect
3333
filippo.io/edwards25519 v1.1.0 // indirect

client/v2/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM=
1818
cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU=
1919
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
2020
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
21-
cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c=
22-
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
21+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU=
22+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
2323
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o=
2424
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg=
2525
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=

fuzz/fuzz.patch

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
diff --git a/types/address_test.go b/types/address_test.go
2+
index 014a48b73..99f9a1a86 100644
3+
--- a/types/address_test.go
4+
+++ b/types/address_test.go
5+
@@ -26,10 +26,6 @@ type addressTestSuite struct {
6+
suite.Suite
7+
}
8+
9+
-func TestAddressTestSuite(t *testing.T) {
10+
- suite.Run(t, new(addressTestSuite))
11+
-}
12+
-
13+
func (s *addressTestSuite) SetupSuite() {
14+
s.T().Parallel()
15+
}
16+
@@ -403,65 +399,6 @@ func (s *addressTestSuite) TestAddressInterface() {
17+
}
18+
}
19+
20+
-func (s *addressTestSuite) TestBech32ifyAddressBytes() {
21+
- type args struct {
22+
- prefix string
23+
- bs []byte
24+
- }
25+
- tests := []struct {
26+
- name string
27+
- args args
28+
- want string
29+
- wantErr bool
30+
- }{
31+
- {"empty address", args{"prefixa", []byte{}}, "", false},
32+
- {"empty prefix", args{"", addr20byte}, "", true},
33+
- {"10-byte address", args{"prefixa", addr10byte}, "prefixa1qqqsyqcyq5rqwzqf3953cc", false},
34+
- {"10-byte address", args{"prefixb", addr10byte}, "prefixb1qqqsyqcyq5rqwzqf20xxpc", false},
35+
- {"20-byte address", args{"prefixa", addr20byte}, "prefixa1qqqsyqcyq5rqwzqfpg9scrgwpugpzysn7hzdtn", false},
36+
- {"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false},
37+
- }
38+
- for _, tt := range tests {
39+
- s.T().Run(tt.name, func(t *testing.T) {
40+
- got, err := types.Bech32ifyAddressBytes(tt.args.prefix, tt.args.bs)
41+
- if (err != nil) != tt.wantErr {
42+
- t.Errorf("Bech32ifyBytes() error = %v, wantErr %v", err, tt.wantErr)
43+
- return
44+
- }
45+
- require.Equal(t, tt.want, got)
46+
- })
47+
- }
48+
-}
49+
-
50+
-func (s *addressTestSuite) TestMustBech32ifyAddressBytes() {
51+
- type args struct {
52+
- prefix string
53+
- bs []byte
54+
- }
55+
- tests := []struct {
56+
- name string
57+
- args args
58+
- want string
59+
- wantPanic bool
60+
- }{
61+
- {"empty address", args{"prefixa", []byte{}}, "", false},
62+
- {"empty prefix", args{"", addr20byte}, "", true},
63+
- {"10-byte address", args{"prefixa", addr10byte}, "prefixa1qqqsyqcyq5rqwzqf3953cc", false},
64+
- {"10-byte address", args{"prefixb", addr10byte}, "prefixb1qqqsyqcyq5rqwzqf20xxpc", false},
65+
- {"20-byte address", args{"prefixa", addr20byte}, "prefixa1qqqsyqcyq5rqwzqfpg9scrgwpugpzysn7hzdtn", false},
66+
- {"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false},
67+
- }
68+
- for _, tt := range tests {
69+
- s.T().Run(tt.name, func(t *testing.T) {
70+
- if tt.wantPanic {
71+
- require.Panics(t, func() { types.MustBech32ifyAddressBytes(tt.args.prefix, tt.args.bs) })
72+
- return
73+
- }
74+
- require.Equal(t, tt.want, types.MustBech32ifyAddressBytes(tt.args.prefix, tt.args.bs))
75+
- })
76+
- }
77+
-}
78+
-
79+
func (s *addressTestSuite) TestAddressTypesEquals() {
80+
addr1 := secp256k1.GenPrivKey().PubKey().Address()
81+
accAddr1 := types.AccAddress(addr1)

fuzz/oss-fuzz-build.sh

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
#!/bin/bash
22

3+
set -o nounset
4+
set -o pipefail
5+
set -o errexit
6+
set -x
7+
8+
cd $SRC
9+
wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
10+
mkdir $SRC/new-go
11+
rm -rf /root/.go && tar -C $SRC/new-go/ -xzf go1.23.1.linux-amd64.tar.gz
12+
mv $SRC/new-go/go /root/.go
13+
ls /root/.go
14+
15+
cd $SRC/go-118-fuzz-build
16+
go build .
17+
mv go-118-fuzz-build /root/go/bin/
18+
cd $SRC/cosmos-sdk
19+
git apply ./fuzz/fuzz.patch
20+
21+
mkdir $SRC/cosmos-sdk/types/fuzzing
22+
mv $SRC/cosmos-sdk/types/address*_test.go $SRC/cosmos-sdk/types/fuzzing/
23+
sed 's/package types_test/package fuzzing/g' -i "$SRC"/cosmos-sdk/types/fuzzing/*
24+
25+
rm $SRC/cosmos-sdk/math/dec_internal_test.go
26+
rm $SRC/cosmos-sdk/math/int_internal_test.go
27+
rm $SRC/cosmos-sdk/math/uint_internal_test.go
28+
mv $SRC/cosmos-sdk/types/fuzz_test.go $SRC/cosmos-sdk/types/fuzz.go
29+
rm $SRC/cosmos-sdk/types/*_test.go
30+
mv $SRC/cosmos-sdk/types/fuzz.go $SRC/cosmos-sdk/types/fuzz_test.go
31+
332
set -euo pipefail
433

534
export FUZZ_ROOT="github.com/cosmos/cosmos-sdk"
@@ -18,25 +47,22 @@ build_go_fuzzer() {
1847
compile_native_go_fuzzer cosmossdk.io/math FuzzLegacyNewDecFromStr fuzz_math_legacy_new_dec_from_str
1948
)
2049

21-
go get github.com/AdamKorcz/go-118-fuzz-build/testing
50+
printf "package types \nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > ./types/fuzz-register.go
51+
go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build=$SRC/go-118-fuzz-build
52+
go mod tidy
2253

2354
# TODO: fails to build with
2455
# main.413864645.go:12:2: found packages query (collections_pagination.go) and query_test (fuzz_test.go_fuzz.go) in /src/cosmos-sdk/types/query
2556
# because of the separate query_test package.
2657
# compile_native_go_fuzzer "$FUZZ_ROOT"/types/query FuzzPagination fuzz_types_query_pagination
2758
compile_native_go_fuzzer "$FUZZ_ROOT"/types FuzzCoinUnmarshalJSON fuzz_types_coin_unmarshal_json
28-
compile_native_go_fuzzer "$FUZZ_ROOT"/types FuzzBech32AccAddrConsistencyYAML fuzz_types_bech32_acc_addr_consistency_yaml
29-
59+
compile_native_go_fuzzer "$FUZZ_ROOT"/types/fuzzing FuzzBech32AccAddrConsistencyYAML fuzz_types_bech32_acc_addr_consistency_yaml
3060
build_go_fuzzer FuzzCryptoHDDerivePrivateKeyForPath fuzz_crypto_hd_deriveprivatekeyforpath
3161
build_go_fuzzer FuzzCryptoHDNewParamsFromPath fuzz_crypto_hd_newparamsfrompath
32-
3362
build_go_fuzzer FuzzCryptoTypesCompactbitarrayMarshalUnmarshal fuzz_crypto_types_compactbitarray_marshalunmarshal
34-
3563
build_go_fuzzer FuzzTendermintAminoDecodeTime fuzz_tendermint_amino_decodetime
36-
3764
build_go_fuzzer FuzzTypesParseCoin fuzz_types_parsecoin
3865
build_go_fuzzer FuzzTypesParseDecCoin fuzz_types_parsedeccoin
3966
build_go_fuzzer FuzzTypesParseTimeBytes fuzz_types_parsetimebytes
4067
build_go_fuzzer FuzzTypesDecSetString fuzz_types_dec_setstring
41-
4268
build_go_fuzzer FuzzUnknownProto fuzz_unknownproto

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
cosmossdk.io/errors v1.0.1
1212
cosmossdk.io/log v1.4.1
1313
cosmossdk.io/math v1.3.0
14-
cosmossdk.io/schema v0.3.0
14+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
1515
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc
1616
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
1717
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM=
1616
cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU=
1717
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
1818
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
19-
cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c=
20-
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
19+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU=
20+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
2121
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
2222
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
2323
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=

schema/indexer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Indexer implementations should be registered with the `indexer.Register` functio
66

77
# Integrating the Indexer Manager
88

9-
The indexer manager should be used for managing all indexers and should be integrated directly with applications wishing to support indexing. The `StartManager` function is used to start the manager. The configuration options for the manager and all indexer targets should be passed as the ManagerOptions.Config field and should match the json structure of ManagerConfig. An example configuration section in `app.toml` might look like this:
9+
The indexer manager should be used for managing all indexers and should be integrated directly with applications wishing to support indexing. The `StartIndexing` function is used to start the manager. The configuration options for the manager and all indexer targets should be passed as the ManagerOptions.Config field and should match the json structure of ManagerConfig. An example configuration section in `app.toml` might look like this:
1010

1111
```toml
1212
[indexer.target.postgres]

server/v2/cometbft/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
cosmossdk.io/depinject v1.0.0 // indirect
4747
cosmossdk.io/errors v1.0.1 // indirect
4848
cosmossdk.io/math v1.3.0 // indirect
49-
cosmossdk.io/schema v0.3.0 // indirect
49+
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect
5050
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect
5151
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect
5252
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect

0 commit comments

Comments
 (0)