Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump babylon v1 #108

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions babylonclient/babyloncontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions babylonclient/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -227,3 +228,7 @@ func GetMockClient() *MockBabylonClient {
ActiveFinalityProvider: &vi,
}
}

func (m *MockBabylonClient) QueryBtcLightClientTipHeight() (uint32, error) {
return 0, nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
9 changes: 8 additions & 1 deletion staker/stakerapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading