Skip to content

Commit

Permalink
chore: update babylon v0.13 (#66)
Browse files Browse the repository at this point in the history
* Refactor stakerApp logic in regards to two flows

* Remove unnecesary state

* Fix: do not send signed staking transaction to btc

* change log entry

* add mising commands file

* fix linter

* chore: update babylon to branch rafilx/btc-staking-activation-height

* chore: update babylon new funciton names

* chore: update to babylon v013

* chore: add #66 to changelog

* chore: better changelog desc for #66

---------

Co-authored-by: KonradStaniec <[email protected]>
  • Loading branch information
RafilxTenfen and KonradStaniec authored Oct 16, 2024
1 parent 7dd2055 commit a5d6e85
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions babylonclient/babyloncontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()

Expand Down
6 changes: 3 additions & 3 deletions babylonclient/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand Down
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.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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions staker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func parseWatchStakingRequest(
}

// 2. Check wheter slashing tx match staking tx
err = staking.CheckTransactions(
err = staking.CheckSlashingTxMatchFundingTx(
slashingTx,
stakingTx,
stakingOutputIdx,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a5d6e85

Please sign in to comment.