From 2378a246ee2f814f51f4b513b978e58f298def74 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 3 Apr 2024 18:48:37 +0200 Subject: [PATCH 1/2] chore: address solomachine testing refactor follow ups --- .../light_client_module_test.go | 24 ++++++++----------- 1 file changed, 10 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..51ff1b80cda 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,9 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() { func() { // store in temp before assigning to interface type cs := sm.ClientState() + + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), clientID, sm.ClientState()) + oldPubKey := sm.PublicKey h := sm.CreateHeader(sm.Diversifier) @@ -1360,23 +1361,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", From 753a5b49522bd9e93264687b8de9b99d047e8dbf Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 3 Apr 2024 19:09:07 +0200 Subject: [PATCH 2/2] chore: rm redundant set in test malleate --- .../light-clients/06-solomachine/light_client_module_test.go | 2 -- 1 file changed, 2 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 51ff1b80cda..5accf3e0579 100644 --- a/modules/light-clients/06-solomachine/light_client_module_test.go +++ b/modules/light-clients/06-solomachine/light_client_module_test.go @@ -1351,8 +1351,6 @@ func (suite *SoloMachineTestSuite) TestVerifyClientMessageHeader() { // store in temp before assigning to interface type cs := sm.ClientState() - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), clientID, sm.ClientState()) - oldPubKey := sm.PublicKey h := sm.CreateHeader(sm.Diversifier)