diff --git a/clientcontroller/babylon.go b/clientcontroller/babylon.go index f7c5783..eb2fa38 100644 --- a/clientcontroller/babylon.go +++ b/clientcontroller/babylon.go @@ -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 } diff --git a/itest/babylon_node_handler.go b/itest/babylon_node_handler.go index 716b117..825609f 100644 --- a/itest/babylon_node_handler.go +++ b/itest/babylon_node_handler.go @@ -2,6 +2,7 @@ package e2etest import ( "bytes" + "encoding/hex" "fmt" "log" "os" @@ -117,7 +118,7 @@ func NewBabylonNodeHandler(t *testing.T, covenantQuorum int, covenantPks []*type walletName := "node0" nodeDataDir := filepath.Join(testDir, walletName, "babylond") - slashingAddr := "SZtRT4BySL3o4efdGLh3k7Kny8GAnsBrSW" + slashingPkScript := hex.EncodeToString([]byte("slashing-script")) var covenantPksStr []string for _, pk := range covenantPks { @@ -134,7 +135,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", slashingPkScript), fmt.Sprintf("--covenant-quorum=%d", covenantQuorum), fmt.Sprintf("--covenant-pks=%s", strings.Join(covenantPksStr, ",")), ) diff --git a/itest/test_manager.go b/itest/test_manager.go index 3ddee10..9aff681 100644 --- a/itest/test_manager.go +++ b/itest/test_manager.go @@ -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 { @@ -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, ) @@ -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, ) @@ -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, } diff --git a/types/stakingparams.go b/types/stakingparams.go index 4c71c22..835835a 100644 --- a/types/stakingparams.go +++ b/types/stakingparams.go @@ -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