Skip to content

Commit

Permalink
separate test for babylon fp cascaded slashing
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Sep 13, 2024
1 parent 5511309 commit 571cacc
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions test/e2e/bcd_consumer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (s *BCDConsumerIntegrationTestSuite) Test5ActivateDelegation() {
}, time.Minute, time.Second*5)
}

func (s *BCDConsumerIntegrationTestSuite) Test6SubmitFinalitySig() {
func (s *BCDConsumerIntegrationTestSuite) Test6BabylonFPSubmitFinalitySig() {
// get the activated height
activatedHeight, err := s.babylonController.QueryActivatedHeight()
s.NoError(err)
Expand Down Expand Up @@ -309,9 +309,22 @@ func (s *BCDConsumerIntegrationTestSuite) Test6SubmitFinalitySig() {
s.NotEmpty(finalizedBlock)
s.Equal(strings.ToUpper(hex.EncodeToString(finalizedBlock.AppHash)), activatedHeightBlock.Block.AppHash.String())
s.True(finalizedBlock.Finalized)
}

func (s *BCDConsumerIntegrationTestSuite) Test7BabylonFPCascadedSlashing() {
// Get the activated height
activatedHeight, err := s.babylonController.QueryActivatedHeight()
s.NoError(err)
s.NotNil(activatedHeight)

// Generate random data for the invalid signature
randListInfo, _, err := datagen.GenRandomMsgCommitPubRandList(r, babylonFpBTCSK, activatedHeight.Height, 100)
s.NoError(err)

babylonFpBIP340PK := bbntypes.NewBIP340PubKeyFromBTCPK(babylonFpBTCPK)

// equivocate by submitting invalid finality signature
txResp, err = s.babylonController.SubmitInvalidFinalitySignature(
// Equivocate by submitting invalid finality signature
txResp, err := s.babylonController.SubmitInvalidFinalitySignature(
r,
babylonFpBTCSK,
babylonFpBIP340PK,
Expand All @@ -323,7 +336,7 @@ func (s *BCDConsumerIntegrationTestSuite) Test6SubmitFinalitySig() {
s.NoError(err)
s.NotNil(txResp)

// check the finality provider is slashed
// Check the finality provider is slashed on Babylon
s.Eventually(func() bool {
slashed, err := s.babylonController.QueryFinalityProviderSlashed(babylonFpBTCPK)
if err != nil {
Expand Down

0 comments on commit 571cacc

Please sign in to comment.