Skip to content

Commit b306e7a

Browse files
08-wasm: pin ibc-go v7.3 (#5391)
* pin ibc-go v7.3 * go mod tidy * add generate string function that is not available in ibc-go v7.3 * another mock key path and height * mock fixes
1 parent 4f22957 commit b306e7a

File tree

7 files changed

+53
-9
lines changed

7 files changed

+53
-9
lines changed

modules/light-clients/08-wasm/go.mod

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/cosmos/ibc-go/modules/light-clients/08-wasm
22

33
go 1.21
44

5-
replace github.com/cosmos/ibc-go/v7 => ../../../
6-
75
replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
86

97
require (

modules/light-clients/08-wasm/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK
346346
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
347347
github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
348348
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
349+
github.com/cosmos/ibc-go/v7 v7.3.0 h1:QtGeVMi/3JeLWuvEuC60sBHpAF40Oenx/y+bP8+wRRw=
350+
github.com/cosmos/ibc-go/v7 v7.3.0/go.mod h1:mUmaHFXpXrEdcxfdXyau+utZf14pGKVUiXwYftRZZfQ=
349351
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
350352
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
351353
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=

modules/light-clients/08-wasm/keeper/msg_server_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (suite *KeeperTestSuite) TestMsgStoreCode() {
6969
{
7070
"fails with wasm code too large",
7171
func() {
72-
msg = types.NewMsgStoreCode(signer, wasmtesting.CreateMockContract([]byte(ibctesting.GenerateString(uint(types.MaxWasmByteSize())))))
72+
msg = types.NewMsgStoreCode(signer, wasmtesting.CreateMockContract([]byte(wasmtesting.GenerateString(uint(types.MaxWasmByteSize())))))
7373
},
7474
types.ErrWasmCodeTooLarge,
7575
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package mock
2+
3+
import (
4+
"github.com/cosmos/ibc-go/v7/modules/core/exported"
5+
)
6+
7+
var _ exported.Path = KeyPath{}
8+
9+
// KeyPath defines a placeholder struct which implements the exported.Path interface
10+
type KeyPath struct{}
11+
12+
// String implements the exported.Path interface
13+
func (KeyPath) String() string {
14+
return ""
15+
}
16+
17+
// Empty implements the exported.Path interface
18+
func (KeyPath) Empty() bool {
19+
return false
20+
}
21+
22+
var _ exported.Height = Height{}
23+
24+
// Height defines a placeholder struct which implements the exported.Height interface
25+
type Height struct {
26+
exported.Height
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package testing
2+
3+
import (
4+
"math/rand"
5+
)
6+
7+
// GenerateString generates a random string of the given length in bytes
8+
func GenerateString(length uint) string {
9+
bytes := make([]byte, length)
10+
for i := range bytes {
11+
bytes[i] = charset[rand.Intn(len(charset))]
12+
}
13+
return string(bytes)
14+
}

modules/light-clients/08-wasm/testing/values.go

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ var (
3030

3131
ErrMockContract = errors.New("mock contract error")
3232
ErrMockVM = errors.New("mock vm error")
33+
34+
// character set used for generating a random string in GenerateString
35+
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
3336
)
3437

3538
// CreateMockTendermintClientState returns a valid Tendermint client state for use in tests.

modules/light-clients/08-wasm/types/client_state_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm"
1313
wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing"
14+
mock "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/mock"
1415
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
1516
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
1617
commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
@@ -19,7 +20,6 @@ import (
1920
"github.com/cosmos/ibc-go/v7/modules/core/exported"
2021
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
2122
ibctesting "github.com/cosmos/ibc-go/v7/testing"
22-
ibcmock "github.com/cosmos/ibc-go/v7/testing/mock"
2323
)
2424

2525
func (suite *TypesTestSuite) TestStatus() {
@@ -137,7 +137,7 @@ func (suite *TypesTestSuite) TestGetTimestampAtHeight() {
137137
{
138138
"error: invalid height",
139139
func() {
140-
height = ibcmock.Height{}
140+
height = mock.Height{}
141141
},
142142
ibcerrors.ErrInvalidType,
143143
},
@@ -438,14 +438,14 @@ func (suite *TypesTestSuite) TestVerifyMembership() {
438438
{
439439
"invalid path argument",
440440
func() {
441-
path = ibcmock.KeyPath{}
441+
path = mock.KeyPath{}
442442
},
443443
ibcerrors.ErrInvalidType,
444444
},
445445
{
446446
"proof height is invalid type",
447447
func() {
448-
proofHeight = ibcmock.Height{}
448+
proofHeight = mock.Height{}
449449
},
450450
ibcerrors.ErrInvalidType,
451451
},
@@ -579,14 +579,14 @@ func (suite *TypesTestSuite) TestVerifyNonMembership() {
579579
{
580580
"invalid path argument",
581581
func() {
582-
path = ibcmock.KeyPath{}
582+
path = mock.KeyPath{}
583583
},
584584
ibcerrors.ErrInvalidType,
585585
},
586586
{
587587
"proof height is invalid type",
588588
func() {
589-
proofHeight = ibcmock.Height{}
589+
proofHeight = mock.Height{}
590590
},
591591
ibcerrors.ErrInvalidType,
592592
},

0 commit comments

Comments
 (0)