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

chore: Bump babylon version #48

Merged
merged 2 commits into from
Sep 5, 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
8 changes: 2 additions & 6 deletions clientcontroller/babylon.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,20 +556,16 @@ func (bc *BabylonController) QueryStakingParams() (*types.StakingParams, error)
}
covenantPks = append(covenantPks, covPk)
}
slashingAddress, err := btcutil.DecodeAddress(stakingParamRes.Params.SlashingAddress, bc.btcParams)
if err != nil {
return nil, err
}

return &types.StakingParams{
ComfirmationTimeBlocks: ckptParamRes.Params.BtcConfirmationDepth,
FinalizationTimeoutBlocks: ckptParamRes.Params.CheckpointFinalizationTimeout,
MinSlashingTxFeeSat: btcutil.Amount(stakingParamRes.Params.MinSlashingTxFeeSat),
CovenantPks: covenantPks,
SlashingAddress: slashingAddress,
SlashingPkScript: stakingParamRes.Params.SlashingPkScript,
CovenantQuorum: stakingParamRes.Params.CovenantQuorum,
SlashingRate: stakingParamRes.Params.SlashingRate,
MinUnbondingTime: stakingParamRes.Params.MinUnbondingTime,
MinUnbondingTime: stakingParamRes.Params.MinUnbondingTimeBlocks,
}, nil
}

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.3.0
github.com/avast/retry-go/v4 v4.5.1
github.com/babylonlabs-io/babylon v0.9.3-0.20240903035004-5c732382e9a4
github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/btcsuite/btcd/btcutil v1.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,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.9.3-0.20240903035004-5c732382e9a4 h1:WKR81WDZnf9tWi5sQTx9JN3k4254UjteCg6VRUEFT8w=
github.com/babylonlabs-io/babylon v0.9.3-0.20240903035004-5c732382e9a4/go.mod h1:9VUUAwVaalXiDdPZT65SPoawKWpp6ple6tBr8Vw0NI8=
github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177 h1:rcbSkxPZVl5AdWt40prUUzj7Rpuv3jD6PvlLh1dQ0DM=
github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177/go.mod h1:9VUUAwVaalXiDdPZT65SPoawKWpp6ple6tBr8Vw0NI8=
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
14 changes: 12 additions & 2 deletions itest/babylon_node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ package e2etest

import (
"bytes"
"encoding/hex"
"fmt"
"log"
"math/rand"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"time"

"github.com/babylonlabs-io/babylon/testutil/datagen"
"github.com/babylonlabs-io/babylon/types"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -117,7 +123,11 @@ func NewBabylonNodeHandler(t *testing.T, covenantQuorum int, covenantPks []*type
walletName := "node0"
nodeDataDir := filepath.Join(testDir, walletName, "babylond")

slashingAddr := "SZtRT4BySL3o4efdGLh3k7Kny8GAnsBrSW"
r := rand.New(rand.NewSource(time.Now().Unix()))
slashingAddress, err := datagen.GenRandomBTCAddress(r, &chaincfg.SigNetParams)
require.NoError(t, err)
slashingPkScript, err := txscript.PayToAddrScript(slashingAddress)
require.NoError(t, err)

var covenantPksStr []string
for _, pk := range covenantPks {
Expand All @@ -134,7 +144,7 @@ func NewBabylonNodeHandler(t *testing.T, covenantQuorum int, covenantPks []*type
"--chain-id=chain-test",
"--additional-sender-account",
fmt.Sprintf("--epoch-interval=%d", 5),
fmt.Sprintf("--slashing-address=%s", slashingAddr),
fmt.Sprintf("--slashing-pk-script=%s", hex.EncodeToString(slashingPkScript)),
fmt.Sprintf("--covenant-quorum=%d", covenantQuorum),
fmt.Sprintf("--covenant-pks=%s", strings.Join(covenantPksStr, ",")),
)
Expand Down
2 changes: 1 addition & 1 deletion itest/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

var (
stakingTime = uint16(1000)
stakingAmount = int64(20000)
stakingAmount = int64(500000)
)

// TestFinalityProviderLifeCycle tests the whole life cycle of a finality-provider
Expand Down
14 changes: 7 additions & 7 deletions itest/test_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ type TestDelegationData struct {
DelegatorSig *bbntypes.BIP340Signature
FpPks []*btcec.PublicKey

SlashingAddr string
ChangeAddr string
StakingTime uint16
StakingAmount int64
SlashingPkScript []byte
ChangeAddr string
StakingTime uint16
StakingAmount int64
}

func StartManager(t *testing.T) *TestManager {
Expand Down Expand Up @@ -677,7 +677,7 @@ func (tm *TestManager) InsertBTCDelegation(t *testing.T, fpPks []*btcec.PublicKe
params.CovenantQuorum,
stakingTime,
stakingAmount,
params.SlashingAddress.String(),
params.SlashingPkScript,
params.SlashingRate,
unbondingTime,
)
Expand Down Expand Up @@ -742,7 +742,7 @@ func (tm *TestManager) InsertBTCDelegation(t *testing.T, fpPks []*btcec.PublicKe
wire.NewOutPoint(&stakingTxHash, 0),
unbondingTime,
unbondingValue,
params.SlashingAddress.String(),
params.SlashingPkScript,
params.SlashingRate,
unbondingTime,
)
Expand Down Expand Up @@ -791,7 +791,7 @@ func (tm *TestManager) InsertBTCDelegation(t *testing.T, fpPks []*btcec.PublicKe
SlashingTx: testStakingInfo.SlashingTx,
StakingTxInfo: txInfo,
DelegatorSig: delegatorSig,
SlashingAddr: params.SlashingAddress.String(),
SlashingPkScript: params.SlashingPkScript,
StakingTime: stakingTime,
StakingAmount: stakingAmount,
}
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.21

toolchain go1.21.4

require github.com/babylonlabs-io/babylon v0.9.3-0.20240903035004-5c732382e9a4
require github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177

require (
cloud.google.com/go v0.112.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,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.9.3-0.20240903035004-5c732382e9a4 h1:WKR81WDZnf9tWi5sQTx9JN3k4254UjteCg6VRUEFT8w=
github.com/babylonlabs-io/babylon v0.9.3-0.20240903035004-5c732382e9a4/go.mod h1:9VUUAwVaalXiDdPZT65SPoawKWpp6ple6tBr8Vw0NI8=
github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177 h1:rcbSkxPZVl5AdWt40prUUzj7Rpuv3jD6PvlLh1dQ0DM=
github.com/babylonlabs-io/babylon v0.9.3-0.20240904154239-00330e49b177/go.mod h1:9VUUAwVaalXiDdPZT65SPoawKWpp6ple6tBr8Vw0NI8=
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
5 changes: 3 additions & 2 deletions types/stakingparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ type StakingParams struct {
// Bitcoin public keys of the covenant committee
CovenantPks []*btcec.PublicKey

// Address to which slashing transactions are sent
SlashingAddress btcutil.Address
// The pk_script expected in slashing output i.e., the first
// output of slashing transaction
SlashingPkScript []byte

// Minimum number of signatures needed for the covenant multisignature
CovenantQuorum uint32
Expand Down
Loading