From 6ebcec4593b328aeaa32fbc61af1d0aa85126911 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Fri, 17 Nov 2023 14:03:13 +0100 Subject: [PATCH] add integration tests for misbehaviour --- tests/integration/misbehaviour.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go index 63b0eafb6d..f6b737ad6a 100644 --- a/tests/integration/misbehaviour.go +++ b/tests/integration/misbehaviour.go @@ -408,6 +408,14 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { altSigners2, ) + // Set the equivocation evidence min height to a the previous block height + equivocationEvidenceMinHeight := clientHeight.RevisionHeight + 1 + s.providerApp.GetProviderKeeper().SetEquivocationEvidenceMinHeight( + s.providerCtx(), + s.consumerChain.ChainID, + equivocationEvidenceMinHeight, + ) + testCases := []struct { name string misbehaviour *ibctmtypes.Misbehaviour @@ -476,6 +484,24 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { }, false, }, + { + "invalid misbehaviour older than min equivocation evidence height - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(equivocationEvidenceMinHeight-1), + clientHeight, + headerTs, + altValset, + altValset, + clientTMValset, + altSigners, + ), + Header2: clientHeader, + }, + false, + }, { "one header of the misbehaviour has insufficient voting power - shouldn't pass", &ibctmtypes.Misbehaviour{