From 01fb05f09207d050fe99bd0452386bdc3638a6eb Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Mon, 11 Nov 2024 12:38:40 +0800 Subject: [PATCH 1/2] ignore duplicated sig error --- clientcontroller/babylon.go | 4 ++++ clientcontroller/retry_utils.go | 4 +++- itest/e2e_test.go | 13 ++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/clientcontroller/babylon.go b/clientcontroller/babylon.go index 9887fd1..7ec9812 100644 --- a/clientcontroller/babylon.go +++ b/clientcontroller/babylon.go @@ -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 } diff --git a/clientcontroller/retry_utils.go b/clientcontroller/retry_utils.go index 70d28c5..2d8fd7a 100644 --- a/clientcontroller/retry_utils.go +++ b/clientcontroller/retry_utils.go @@ -12,4 +12,6 @@ var unrecoverableErrors = []*sdkErr.Error{ btcstakingtypes.ErrInvalidCovenantSig, } -var expectedErrors = []*sdkErr.Error{} +var expectedErrors = []*sdkErr.Error{ + btcstakingtypes.ErrDuplicatedCovenantSig, +} diff --git a/itest/e2e_test.go b/itest/e2e_test.go index f160f4a..e425971 100644 --- a/itest/e2e_test.go +++ b/itest/e2e_test.go @@ -6,6 +6,8 @@ package e2etest import ( "testing" "time" + + "github.com/stretchr/testify/require" ) var ( @@ -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) } From e2e1f2a5ae51ddc0a00f2b7668a749e4fbf87888 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Mon, 11 Nov 2024 12:44:54 +0800 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cece387..bb1ffa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Unreleased +* [#30](https://github.com/babylonlabs-io/covenant-emulator/pull/30) Ignore duplicated sig error + ## v0.7.0 ### Improvements