diff --git a/CHANGELOG.md b/CHANGELOG.md index 7810811..44d0cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Unreleased +* [#108](https://github.com/babylonlabs-io/btc-staker/pull/108) Bump babylon to v1.0.0-rc.1 + +## v0.13.0 + * [#102](https://github.com/babylonlabs-io/btc-staker/pull/102) Bump babylon v18 and fix incompatibilities diff --git a/babylonclient/babyloncontroller.go b/babylonclient/babyloncontroller.go index 406c5ca..3ba293c 100644 --- a/babylonclient/babyloncontroller.go +++ b/babylonclient/babyloncontroller.go @@ -1004,13 +1004,13 @@ func (bc *BabylonController) InsertSpvProofs(submitter string, proofs []*btcctyp return res, nil } -func (bc *BabylonController) QueryBtcLightClientTip() (*btclctypes.BTCHeaderInfoResponse, error) { +func (bc *BabylonController) QueryBtcLightClientTipHeight() (uint32, error) { res, err := bc.bbnClient.QueryClient.BTCHeaderChainTip() if err != nil { - return nil, fmt.Errorf("failed to query BTC tip: %w", err) + return 0, fmt.Errorf("failed to query BTC tip: %w", err) } - return res.Header, nil + return res.Header.Height, nil } func (bc *BabylonController) ActivateDelegation( diff --git a/babylonclient/interface.go b/babylonclient/interface.go index f045b5c..34c7a57 100644 --- a/babylonclient/interface.go +++ b/babylonclient/interface.go @@ -85,6 +85,7 @@ type BabylonClient interface { IsTxAlreadyPartOfDelegation(stakingTxHash *chainhash.Hash) (bool, error) QueryDelegationInfo(stakingTxHash *chainhash.Hash) (*DelegationInfo, error) GetLatestBlockHeight() (uint64, error) + QueryBtcLightClientTipHeight() (uint32, error) } type MockBabylonClient struct { @@ -227,3 +228,7 @@ func GetMockClient() *MockBabylonClient { ActiveFinalityProvider: &vi, } } + +func (m *MockBabylonClient) QueryBtcLightClientTipHeight() (uint32, error) { + return 0, nil +} diff --git a/go.mod b/go.mod index e9ee1f2..fd776bc 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.4.0 github.com/avast/retry-go/v4 v4.5.1 - github.com/babylonlabs-io/babylon v0.18.0 + github.com/babylonlabs-io/babylon v1.0.0-rc.1 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 d363731..e71d683 100644 --- a/go.sum +++ b/go.sum @@ -1432,8 +1432,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.18.0 h1:phMY/GiR9N5MpD3XCmvyPpZkc1I3kTM9yX+Cf0h3OnU= -github.com/babylonlabs-io/babylon v0.18.0/go.mod h1:sT+KG2U+M0tDMNZZ2L5CwlXX0OpagGEs56BiWXqaZFw= +github.com/babylonlabs-io/babylon v1.0.0-rc.1 h1:esV0UJ1TmXfVkfKWOee/2ny+GMiqZXNni8f2H4ASD38= +github.com/babylonlabs-io/babylon v1.0.0-rc.1/go.mod h1:B8ma8IjGUEKhmoRfwv60Qa7DtUXssCgtmD89huQ4+5I= 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/stakerapp.go b/staker/stakerapp.go index 9e6b70d..da9efbb 100644 --- a/staker/stakerapp.go +++ b/staker/stakerapp.go @@ -977,7 +977,14 @@ func (app *App) retrieveExternalDelegationData( var params *cl.StakingParams if inclusionInfo == nil { - p, err := app.babylonClient.Params() + // chose params as babylon would through tip of btc light client + tipHeight, err := app.babylonClient.QueryBtcLightClientTipHeight() + + if err != nil { + return nil, err + } + + p, err := app.babylonClient.ParamsByBtcHeight(tipHeight) if err != nil { return nil, err