From 1632d4ebdced38634142b6a1a6a85e9b957b0faf Mon Sep 17 00:00:00 2001 From: Gurjot Date: Sun, 15 Dec 2024 16:04:32 +0530 Subject: [PATCH] activate del --- e2etest/e2e_test.go | 5 +++++ e2etest/test_manager_btcstaking.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/e2etest/e2e_test.go b/e2etest/e2e_test.go index 301ebee..aab77f9 100644 --- a/e2etest/e2e_test.go +++ b/e2etest/e2e_test.go @@ -99,6 +99,9 @@ func TestActivatingDelegation(t *testing.T) { mBlock := tm.mineBlock(t) require.Equal(t, 2, len(mBlock.Transactions)) + // get spv proof of the BTC staking tx + stakingTxInfo := getTxInfo(t, mBlock) + // wait until staking tx is on Bitcoin require.Eventually(t, func() bool { _, err := tm.WalletClient.GetRawTransaction(&stakingMsgTxHash) @@ -126,6 +129,8 @@ func TestActivatingDelegation(t *testing.T) { wg.Wait() + tm.SubmitInclusionProof(t, stakingMsgTxHash.String(), stakingTxInfo) + // // make sure we didn't submit any "invalid" incl proof // require.Eventually(t, func() bool { // return promtestutil.ToFloat64(stakingTrackerMetrics.FailedReportedActivateDelegations) == 0 diff --git a/e2etest/test_manager_btcstaking.go b/e2etest/test_manager_btcstaking.go index f4c9453..783921b 100644 --- a/e2etest/test_manager_btcstaking.go +++ b/e2etest/test_manager_btcstaking.go @@ -917,3 +917,17 @@ func (tm *TestManager) getHighUTXOAndSum() (*btcjson.ListUnspentResult, float64, } return &highUTXO, sum, nil } + +func (tm *TestManager) SubmitInclusionProof(t *testing.T, stakingTxHash string, txInfo *btcctypes.TransactionInfo) { + msg := &bstypes.MsgAddBTCDelegationInclusionProof{ + Signer: tm.MustGetBabylonSigner(), + StakingTxHash: stakingTxHash, + StakingTxInclusionProof: &bstypes.InclusionProof{ + Key: txInfo.Key, + Proof: txInfo.Proof, + }, + } + + _, err := tm.BabylonClient.ReliablySendMsg(context.Background(), msg, nil, nil) + require.NoError(t, err) +}