Skip to content

Commit

Permalink
fix: Ignore duplicated sig error (#30)
Browse files Browse the repository at this point in the history
* ignore duplicated sig error

* changelog
  • Loading branch information
gitferry authored Nov 13, 2024
1 parent cb8ea0b commit 14a045a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Bug fixes

* [#30](https://github.com/babylonlabs-io/covenant-emulator/pull/30) Ignore duplicated sig error

### Improvements

* [#22](https://github.com/babylonlabs-io/covenant-emulator/pull/22) Go releaser setup
Expand Down
4 changes: 4 additions & 0 deletions clientcontroller/babylon.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ func (bc *BabylonController) SubmitCovenantSigs(covSigs []*types.CovenantSigs) (
return nil, err
}

if res == nil {
return &types.TxResponse{}, nil
}

return &types.TxResponse{TxHash: res.TxHash, Events: res.Events}, nil
}

Expand Down
4 changes: 3 additions & 1 deletion clientcontroller/retry_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ var unrecoverableErrors = []*sdkErr.Error{
btcstakingtypes.ErrInvalidCovenantSig,
}

var expectedErrors = []*sdkErr.Error{}
var expectedErrors = []*sdkErr.Error{
btcstakingtypes.ErrDuplicatedCovenantSig,
}
13 changes: 12 additions & 1 deletion itest/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package e2etest
import (
"testing"
"time"

"github.com/stretchr/testify/require"
)

var (
Expand Down Expand Up @@ -37,5 +39,14 @@ func TestCovenantEmulatorLifeCycle(t *testing.T) {
time.Sleep(10 * time.Second)

// check the BTC delegation is verified
_ = tm.WaitForNVerifiedDels(t, 1)
dels := tm.WaitForNVerifiedDels(t, 1)

// test duplicate, should expect no error
// remove covenant sigs
dels[0].CovenantSigs = nil
dels[0].BtcUndelegation.CovenantSlashingSigs = nil
dels[0].BtcUndelegation.CovenantUnbondingSigs = nil
res, err := tm.CovenantEmulator.AddCovenantSignatures(dels)
require.NoError(t, err)
require.Empty(t, res)
}

0 comments on commit 14a045a

Please sign in to comment.