Skip to content

Commit

Permalink
fix: added check for empty path in 06-solomachine (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei authored Nov 18, 2022
1 parent 1f140ea commit cb92f6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/light-clients/06-solomachine/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (cs *ClientState) VerifyMembership(
return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", commitmenttypes.MerklePath{}, path)
}

if merklePath.Empty() {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "path is empty")
}

signBytes := &SignBytes{
Sequence: sequence,
Timestamp: timestamp,
Expand Down
7 changes: 7 additions & 0 deletions modules/light-clients/06-solomachine/client_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
},
false,
},
{
"empty path",
func() {
path = commitmenttypes.MerklePath{}
},
false,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit cb92f6f

Please sign in to comment.