Skip to content

Commit

Permalink
chore: address solomachine testing refactor follow ups (#6085)
Browse files Browse the repository at this point in the history
* chore: address solomachine testing refactor follow ups

* chore: rm redundant set in test malleate

---------

Co-authored-by: DimitrisJim <[email protected]>
  • Loading branch information
damiannolan and DimitrisJim authored Apr 3, 2024
1 parent 92398e7 commit b465156
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions modules/light-clients/06-solomachine/light_client_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,9 +1243,8 @@ func (suite *SoloMachineTestSuite) TestUpdateStateOnMisbehaviour() {

func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {
var (
clientMsg exported.ClientMessage
clientState *solomachine.ClientState
clientID string
clientID string
clientMsg exported.ClientMessage
)

// test singlesig and multisig public keys
Expand Down Expand Up @@ -1342,7 +1341,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {
suite.Require().NoError(err)
h.Signature = sig

clientState = cs
clientMsg = h
},
solomachine.ErrSignatureVerificationFailed,
Expand All @@ -1352,6 +1350,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {
func() {
// store in temp before assigning to interface type
cs := sm.ClientState()

oldPubKey := sm.PublicKey
h := sm.CreateHeader(sm.Diversifier)

Expand All @@ -1360,23 +1359,18 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() {
sig := sm.GenerateSignature(data)
h.Signature = sig

clientState = cs
clientMsg = h

suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), clientID, sm.ClientState())
},
// TODO(jim): Doesn't fail on VerifySignature
clienttypes.ErrInvalidHeader,
solomachine.ErrSignatureVerificationFailed,
},
{
"failure: consensus state public key is nil - header",
func() {
clientState.ConsensusState.PublicKey = nil
clientMsg = sm.CreateHeader(sm.Diversifier)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), clientID, sm.ClientState())
h := sm.CreateHeader(sm.Diversifier)
h.NewPublicKey = nil
clientMsg = h
},
// TODO(jim): Doesn't fail on VerifySignature
clienttypes.ErrInvalidHeader,
solomachine.ErrSignatureVerificationFailed,
},
{
"failure: cannot find client state",
Expand Down

0 comments on commit b465156

Please sign in to comment.