diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a74084..8d35f4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,12 +39,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * [#51](https://github.com/babylonlabs-io/btc-staker/pull/51) Use int64 for satoshi amount related values. - * [#65](https://github.com/babylonlabs-io/btc-staker/pull/65) Various fixes to pre-approval flow. Do not send signed staking transactions to Babylon. - +* [#66](https://github.com/babylonlabs-io/btc-staker/pull/66) Bump babylon to +v0.13.0 as it updates BTC block heights to uint32 and function naming. * [#67](https://github.com/babylonlabs-io/btc-staker/pull/67) Enable concurrent -sending of multiple pre-approval staking transactions +sending of multiple pre-approval staking transactions. ## v0.7.2 diff --git a/babylonclient/babyloncontroller.go b/babylonclient/babyloncontroller.go index 7a9a625..59c33bc 100644 --- a/babylonclient/babyloncontroller.go +++ b/babylonclient/babyloncontroller.go @@ -171,9 +171,9 @@ func (bc *BabylonController) Params() (*StakingParams, error) { return nil, err } - minUnbondingTimeU64 := sdkmath.Max[uint64]( + minUnbondingTimeU64 := sdkmath.Max[uint32]( bccParams.CheckpointFinalizationTimeout, - uint64(stakingTrackerParams.MinUnbondingTime), + uint32(stakingTrackerParams.MinUnbondingTime), ) if minUnbondingTimeU64 > math.MaxUint16 { @@ -663,7 +663,7 @@ func (bc *BabylonController) QueryFinalityProvider(btcPubKey *btcec.PublicKey) ( }, nil } -func (bc *BabylonController) QueryHeaderDepth(headerHash *chainhash.Hash) (uint64, error) { +func (bc *BabylonController) QueryHeaderDepth(headerHash *chainhash.Hash) (uint32, error) { ctx, cancel := getQueryContext(bc.cfg.Timeout) defer cancel() diff --git a/babylonclient/interface.go b/babylonclient/interface.go index 77e33a0..de6a6b9 100644 --- a/babylonclient/interface.go +++ b/babylonclient/interface.go @@ -70,7 +70,7 @@ type BabylonClient interface { Undelegate(req *UndelegationRequest) (*pv.RelayerTxResponse, error) QueryFinalityProviders(limit uint64, offset uint64) (*FinalityProvidersClientResponse, error) QueryFinalityProvider(btcPubKey *btcec.PublicKey) (*FinalityProviderClientResponse, error) - QueryHeaderDepth(headerHash *chainhash.Hash) (uint64, error) + QueryHeaderDepth(headerHash *chainhash.Hash) (uint32, error) IsTxAlreadyPartOfDelegation(stakingTxHash *chainhash.Hash) (bool, error) QueryDelegationInfo(stakingTxHash *chainhash.Hash) (*DelegationInfo, error) } @@ -142,9 +142,9 @@ func (m *MockBabylonClient) QueryFinalityProvider(btcPubKey *btcec.PublicKey) (* } } -func (m *MockBabylonClient) QueryHeaderDepth(headerHash *chainhash.Hash) (uint64, error) { +func (m *MockBabylonClient) QueryHeaderDepth(headerHash *chainhash.Hash) (uint32, error) { // return always confirmed depth - return uint64(m.ClientParams.ConfirmationTimeBlocks) + 1, nil + return m.ClientParams.ConfirmationTimeBlocks + 1, nil } func (m *MockBabylonClient) IsTxAlreadyPartOfDelegation(stakingTxHash *chainhash.Hash) (bool, error) { diff --git a/go.mod b/go.mod index e87b4d7..95e8fe4 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 github.com/avast/retry-go/v4 v4.5.1 - github.com/babylonlabs-io/babylon v0.12.0 + github.com/babylonlabs-io/babylon v0.13.0 github.com/babylonlabs-io/networks/parameters v0.2.2 github.com/btcsuite/btcd v0.24.2 github.com/btcsuite/btcd/btcec/v2 v2.3.2 diff --git a/go.sum b/go.sum index 61c9a22..266f12b 100644 --- a/go.sum +++ b/go.sum @@ -287,8 +287,8 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX github.com/aws/aws-sdk-go v1.44.312 h1:llrElfzeqG/YOLFFKjg1xNpZCFJ2xraIi3PqSuP+95k= github.com/aws/aws-sdk-go v1.44.312/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/babylonlabs-io/babylon v0.12.0 h1:s2OTcxpk0RzrkVBnVTfnPdJVYDSqnm/33YKPQqEzNCE= -github.com/babylonlabs-io/babylon v0.12.0/go.mod h1:ZOrTde9vs2xoqGTFw4xhupu2CMulnpywiuk0eh4kPOw= +github.com/babylonlabs-io/babylon v0.13.0 h1:h7cazmFmItePvZHEbLhDbsq2l7xN4e2AjDHRM7zDLkg= +github.com/babylonlabs-io/babylon v0.13.0/go.mod h1:cxRwVqVLoJ39FpyovTEHJLu1lwwrM1tE8davu7nRHwY= github.com/babylonlabs-io/networks/parameters v0.2.2 h1:TCu39fZvjX5f6ZZrjhYe54M6wWxglNewuKu56yE+zrc= github.com/babylonlabs-io/networks/parameters v0.2.2/go.mod h1:iEJVOzaLsE33vpP7J4u+CRGfkSIfErUAwRmgCFCBpyI= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= diff --git a/staker/types.go b/staker/types.go index 6a59991..f31db69 100644 --- a/staker/types.go +++ b/staker/types.go @@ -517,7 +517,7 @@ func parseWatchStakingRequest( } // 2. Check wheter slashing tx match staking tx - err = staking.CheckTransactions( + err = staking.CheckSlashingTxMatchFundingTx( slashingTx, stakingTx, stakingOutputIdx, @@ -584,7 +584,7 @@ func parseWatchStakingRequest( return nil, fmt.Errorf("failed to watch staking tx. Unbonding output does not match output produced from provided values") } - err = staking.CheckTransactions( + err = staking.CheckSlashingTxMatchFundingTx( slashUnbondingTx, unbondingTx, 0,