Skip to content

Commit

Permalink
chore: Add unjail-finality-provider cmd (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitferry authored Sep 19, 2024
1 parent e7ac8fd commit dec7fa8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### State Machine Breaking

* [#80](https://github.com/babylonlabs-io/babylon/pull/80) Implement ADR-25 and
enable jailing/unjailing finality providers
* [#45](https://github.com/babylonlabs-io/babylon/pull/45) Implement ADR-23 and improve
BTC staking parameters
* [#51](https://github.com/babylonlabs-io/babylon/pull/51) Implement ADR-24 and
Expand All @@ -50,6 +52,11 @@ processes `MsgCreateFinalityProvider` message during upgrade execution
* [#4](https://github.com/babylonlabs-io/babylon/pull/4) Add upgrade that
Insert BTC headers into `btclightclient` module state during upgrade execution

### Misc Improvements

* [#84](https://github.com/babylonlabs-io/babylon/pull/84) Add `unjail-finality-provider`
cmd to `finality` module CLI.

## v0.9.3

## v0.9.2
Expand Down
40 changes: 38 additions & 2 deletions x/finality/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"strconv"
"strings"

bbn "github.com/babylonlabs-io/babylon/types"
"github.com/babylonlabs-io/babylon/x/finality/types"
cmtcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

bbn "github.com/babylonlabs-io/babylon/types"
"github.com/babylonlabs-io/babylon/x/finality/types"
)

// GetTxCmd returns the transaction commands for this module
Expand All @@ -28,6 +29,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(
NewCommitPubRandListCmd(),
NewAddFinalitySigCmd(),
NewUnjailFinalityProviderCmd(),
)

return cmd
Expand Down Expand Up @@ -165,3 +167,37 @@ func NewAddFinalitySigCmd() *cobra.Command {

return cmd
}

func NewUnjailFinalityProviderCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "unjail-finality-provider [fp_btc_pk]",
Args: cobra.ExactArgs(1),
Short: "Unjail a jailed finality provider",
Long: strings.TrimSpace(
`Unjail a jailed finality provider.`,
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

// get finality provider BTC PK
fpBTCPK, err := bbn.NewBIP340PubKeyFromHex(args[0])
if err != nil {
return err
}

msg := types.MsgUnjailFinalityProvider{
Signer: clientCtx.FromAddress.String(),
FpBtcPk: fpBTCPK,
}

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}

0 comments on commit dec7fa8

Please sign in to comment.