From b4651560ec3f363aa705424397b1e164c5594a1e Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 3 Apr 2024 22:11:57 +0200 Subject: [PATCH] chore: address solomachine testing refactor follow ups (#6085) * chore: address solomachine testing refactor follow ups * chore: rm redundant set in test malleate --------- Co-authored-by: DimitrisJim --- .../light_client_module_test.go | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/modules/light-clients/06-solomachine/light_client_module_test.go b/modules/light-clients/06-solomachine/light_client_module_test.go index 2c3777e01e7..5accf3e0579 100644 --- a/modules/light-clients/06-solomachine/light_client_module_test.go +++ b/modules/light-clients/06-solomachine/light_client_module_test.go @@ -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 @@ -1342,7 +1341,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() { suite.Require().NoError(err) h.Signature = sig - clientState = cs clientMsg = h }, solomachine.ErrSignatureVerificationFailed, @@ -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) @@ -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",