Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix solo machine merkle prefix casting bug #122

Merged
merged 4 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (modules/light-clients/06-solomachine) [\#122](https://github.com/cosmos/ibc-go/pull/122) Fix solo machine merkle prefix casting bug.
* (modules/light-clients/06-solomachine) [\#120](https://github.com/cosmos/ibc-go/pull/120) Fix solo machine handshake verification bug.


### API Breaking

* (modules/core) [\#109](https://github.com/cosmos/ibc-go/pull/109) Remove connection and channel handshake CLI commands.
Expand Down
3 changes: 3 additions & 0 deletions modules/light-clients/06-solomachine/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ timestampedSignatureData := &types.TimestampedSignatureData{
proof, err := cdc.MarshalBinaryBare(timestampedSignatureData)
```

NOTE: At the end of this process, the sequence associated with the key needs to be updated.
The sequence must be incremented each time proof is generated.

## Updates By Header

An update by a header will only succeed if:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ func produceVerificationArgs(
return nil, nil, 0, 0, sdkerrors.Wrap(commitmenttypes.ErrInvalidPrefix, "prefix cannot be empty")
}

_, ok := prefix.(commitmenttypes.MerklePrefix)
_, ok := prefix.(*commitmenttypes.MerklePrefix)
if !ok {
return nil, nil, 0, 0, sdkerrors.Wrapf(commitmenttypes.ErrInvalidPrefix, "invalid prefix type %T, expected MerklePrefix", prefix)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const (
)

var (
prefix = commitmenttypes.NewMerklePrefix([]byte("ibc"))
prefix = &commitmenttypes.MerklePrefix{
KeyPrefix: []byte("ibc"),
}
consensusHeight = clienttypes.ZeroHeight()
)

Expand Down Expand Up @@ -387,7 +389,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
}

func (suite *SoloMachineTestSuite) TestVerifyConnectionState() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, *prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions()), 0)

path := suite.solomachine.GetConnectionStatePath(testConnectionID)
Expand Down
4 changes: 2 additions & 2 deletions modules/light-clients/06-solomachine/types/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (suite SoloMachineTestSuite) TestUnmarshalDataByType() {
},
{
"connection", types.CONNECTION, func() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, *prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions()), 0)
path := solomachine.GetConnectionStatePath("connectionID")

Expand Down Expand Up @@ -98,7 +98,7 @@ func (suite SoloMachineTestSuite) TestUnmarshalDataByType() {
},
{
"bad channel (uses connection data)", types.CHANNEL, func() {
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, prefix)
counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, *prefix)
conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions()), 0)
path := solomachine.GetConnectionStatePath("connectionID")

Expand Down