Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
gitferry committed Nov 11, 2024
1 parent 56914c6 commit 716ce1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 4 additions & 0 deletions finality-provider/service/fp_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ func (fp *FinalityProviderInstance) TestSubmitFinalitySignatureAndExtractPrivKey
return nil, nil, fmt.Errorf("failed to send finality signature to the consumer chain: %w", err)
}

if res.TxHash == "" {
return res, nil, nil
}

// try to extract the private key
var privKey *btcec.PrivateKey
for _, ev := range res.Events {
Expand Down
12 changes: 2 additions & 10 deletions itest/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package e2etest

import (
Expand Down Expand Up @@ -87,9 +84,10 @@ func TestDoubleSigning(t *testing.T) {
finalizedBlocks := tm.WaitForNFinalizedBlocks(t, 1)

// test duplicate vote which should be ignored
_, extractedKey, err := fpIns.TestSubmitFinalitySignatureAndExtractPrivKey(finalizedBlocks[0])
res, extractedKey, err := fpIns.TestSubmitFinalitySignatureAndExtractPrivKey(finalizedBlocks[0])
require.NoError(t, err)
require.Nil(t, extractedKey)
require.Empty(t, res)
t.Logf("duplicate vote for %d is sent", finalizedBlocks[0].Height)

// attack: manually submit a finality vote over a conflicting block
Expand All @@ -106,12 +104,6 @@ func TestDoubleSigning(t *testing.T) {
require.True(t, localKey.Key.Equals(&extractedKey.Key) || localKey.Key.Negate().Equals(&extractedKey.Key))

t.Logf("the equivocation attack is successful")

tm.WaitForFpShutDown(t)

// try to start the finality provider and should expect err
err = tm.Fpa.StartHandlingFinalityProvider(fpIns.GetBtcPkBIP340(), "")
require.Error(t, err)
}

// TestFastSync tests the fast sync process where the finality-provider is terminated and restarted with fast sync
Expand Down

0 comments on commit 716ce1f

Please sign in to comment.