Skip to content

Commit

Permalink
chore: bump babylon to v0.18.0 and update min unbonding time blocks t…
Browse files Browse the repository at this point in the history
…o just unbonding time blocks, affected one check from '<' to '!='
  • Loading branch information
RafilxTenfen committed Dec 5, 2024
1 parent bde58db commit 1c9e1b3
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion clientcontroller/babylon.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (bc *BabylonController) QueryStakingParamsByVersion(version uint32) (*types
CovenantQuorum: stakingParamRes.Params.CovenantQuorum,
SlashingRate: stakingParamRes.Params.SlashingRate,
MinComissionRate: stakingParamRes.Params.MinCommissionRate,
MinUnbondingTime: stakingParamRes.Params.MinUnbondingTimeBlocks,
UnbondingTimeBlocks: stakingParamRes.Params.UnbondingTimeBlocks,
UnbondingFee: btcutil.Amount(stakingParamRes.Params.UnbondingFeeSat),
MinStakingTime: minStakingTimeBlocksUint16,
MaxStakingTime: maxStakingTimeBlocksUint16,
Expand Down
6 changes: 3 additions & 3 deletions covenant/covenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ func (ce *CovenantEmulator) AddCovenantSignatures(btcDels []*types.Delegation) (
// 3. check unbonding time (staking time from unbonding tx) is larger or equal
// to the minimum unbonding time in Babylon node parameters
unbondingTime := btcDel.UnbondingTime
minUnbondingTime := params.MinUnbondingTime
if uint32(unbondingTime) < minUnbondingTime {
unbondingTimeBlocks := params.UnbondingTimeBlocks
if uint32(unbondingTime) != unbondingTimeBlocks {
ce.logger.Error("invalid unbonding time",
zap.Uint32("min_unbonding_time", minUnbondingTime),
zap.Uint32("expected_unbonding_time", unbondingTimeBlocks),
zap.Uint16("got_unbonding_time", unbondingTime),
)
continue
Expand Down
2 changes: 1 addition & 1 deletion covenant/covenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func FuzzAddCovenantSig(f *testing.F) {
require.NoError(t, err)
stakingTimeBlocks := uint32(testutil.RandRange(r, int(params.MinStakingTime), int(params.MaxStakingTime)))
stakingValue := int64(testutil.RandRange(r, int(params.MinStakingValue), int(params.MaxStakingValue)))
unbondingTime := uint16(params.MinUnbondingTime)
unbondingTime := uint16(params.UnbondingTimeBlocks)
fpNum := datagen.RandomInt(r, 5) + 1
fpPks := testutil.GenBtcPublicKeys(r, t, int(fpNum))
testInfo := datagen.GenBTCStakingSlashingInfo(
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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.17.1
github.com/babylonlabs-io/babylon v0.18.0
github.com/babylonlabs-io/covenant-emulator/covenant-signer v0.2.0
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 @@ -1419,8 +1419,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.17.1 h1:lyWGdR7B49qDw5pllLyTW/HAM5uQWXXPZefjFzy/Xy0=
github.com/babylonlabs-io/babylon v0.17.1/go.mod h1:sT+KG2U+M0tDMNZZ2L5CwlXX0OpagGEs56BiWXqaZFw=
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/covenant-emulator/covenant-signer v0.2.0 h1:bIosLYR/HUDN4gtUMqbPZjDKapcTHVJHFs0o9AGJt+U=
github.com/babylonlabs-io/covenant-emulator/covenant-signer v0.2.0/go.mod h1:9lAyEcdpfS21bMLMEa8WjTyLVfwHJABRh5TmoxC9LKU=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
Expand Down
2 changes: 1 addition & 1 deletion itest/test_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (tm *TestManager) InsertBTCDelegation(
delBtcPrivKey, delBtcPubKey, err := datagen.GenRandomBTCKeyPair(r)
require.NoError(t, err)

unbondingTime := uint16(tm.StakingParams.MinUnbondingTime)
unbondingTime := uint16(tm.StakingParams.UnbondingTimeBlocks)
testStakingInfo := testutil.GenBTCStakingSlashingInfo(
r,
t,
Expand Down
2 changes: 1 addition & 1 deletion testutil/datagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func GenRandomParams(r *rand.Rand, t *testing.T) *types.StakingParams {
return &types.StakingParams{
ComfirmationTimeBlocks: 10,
FinalizationTimeoutBlocks: 100,
MinUnbondingTime: 100,
UnbondingTimeBlocks: 100,
MinSlashingTxFeeSat: 1,
CovenantPks: covenantPks,
SlashingPkScript: slashingPkScript,
Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.1

toolchain go1.23.3

require github.com/babylonlabs-io/babylon v0.17.1
require github.com/babylonlabs-io/babylon v0.18.0

require (
cloud.google.com/go v0.112.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,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.17.1 h1:lyWGdR7B49qDw5pllLyTW/HAM5uQWXXPZefjFzy/Xy0=
github.com/babylonlabs-io/babylon v0.17.1/go.mod h1:sT+KG2U+M0tDMNZZ2L5CwlXX0OpagGEs56BiWXqaZFw=
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/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down
4 changes: 2 additions & 2 deletions types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type StakingParams struct {
// Minimum commission rate
MinComissionRate sdkmath.LegacyDec

// The minimum time for unbonding transaction timelock in BTC blocks
MinUnbondingTime uint32
// The time for unbonding transaction timelock in BTC blocks
UnbondingTimeBlocks uint32

// Fee required by unbonding transaction
UnbondingFee btcutil.Amount
Expand Down

0 comments on commit 1c9e1b3

Please sign in to comment.