Skip to content

Commit

Permalink
fix: fix comments to the base branch 2 (#424)
Browse files Browse the repository at this point in the history
Fix comments in #402
  • Loading branch information
SebastianElvis authored Jan 22, 2025
1 parent 873f123 commit eaf20a1
Show file tree
Hide file tree
Showing 33 changed files with 171 additions and 165 deletions.
41 changes: 4 additions & 37 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,16 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [Unreleased](https://github.com/babylonchain/babylon-private/tree/HEAD)

[Full Changelog](https://github.com/babylonchain/babylon-private/compare/euphrates-0.2.0-rc.0...HEAD)


## [euphrates-v0.2.0-rc.0](https://github.com/babylonchain/babylon-private/tree/euphrates-v0.2.0-rc.0) (2024-05-17)

[Full Changelog](https://github.com/babylonchain/babylon-private/compare/euphrates-0.1.0-rc.1...euphrates-v0.2.0-rc.0)

## [euphrates-0.1.0-rc.1](https://github.com/babylonchain/babylon-private/tree/euphrates-0.1.0-rc.1) (2024-03-25)

[Full Changelog](https://github.com/babylonchain/babylon-private/compare/euphrates-0.1.0-rc.0...euphrates-0.1.0-rc.1)

**Fixed bugs:**

- Fix: only calculating Babylon FPs for FP set rotation (#223)

## [euphrates-0.1.0-rc.0](https://github.com/babylonchain/babylon-private/tree/euphrates-0.1.0-rc.0) (2024-03-22)

[Full Changelog](https://github.com/babylonchain/babylon-private/compare/v0.8.5...euphrates-0.1.0-rc.0)

**Closed issues:**

- handler for registering consumer chain finality providers [\#211](https://github.com/babylonchain/babylon-private/issues/211)
- restaking support and tests [\#208](https://github.com/babylonchain/babylon-private/issues/208)
- New module for BTC staking integration [\#204](https://github.com/babylonchain/babylon-private/issues/204)
- Consumer chain finality provider registry [\#203](https://github.com/babylonchain/babylon-private/issues/203)

## [v0.8.0](https://github.com/babylonchain/babylon/tree/v0.8.0) (2024-02-08)
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Improvements

- [#391](https://github.com/babylonlabs-io/babylon/pull/391) Fix e2e `TestBTCRewardsDistribution` flunky
check of rewards

### Bug fixes
### State Machine Breaking

- [#353](https://github.com/babylonlabs-io/babylon/pull/353) Bump to SDK
0.50.11
- [#402](https://github.com/babylonlabs-io/babylon/pull/402) **Babylon multi-staking support**.
This PR contains a series of PRs on multi-staking support and BTC stakingintegration.

## v1.0.0-rc3

Expand Down
6 changes: 3 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (ak *AppKeepers) InitKeepers(
homePath,
wasmConfig,
WasmCapabilities(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
appparams.AccGov.String(),
wasmOpts...,
)

Expand Down Expand Up @@ -514,7 +514,7 @@ func (ak *AppKeepers) InitKeepers(
ak.BankKeeper,
ak.IBCKeeper.ClientKeeper,
ak.WasmKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
appparams.AccGov.String(),
)

// set up BTC staking keeper
Expand Down Expand Up @@ -569,7 +569,7 @@ func (ak *AppKeepers) InitKeepers(
&ak.BTCStakingKeeper,
&ak.BTCStkConsumerKeeper,
scopedZoneConciergeKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
appparams.AccGov.String(),
)

// add msgServiceRouter so that the epoching module can forward unwrapped messages to the staking module
Expand Down
56 changes: 52 additions & 4 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,76 @@
}
},
{
"url": "./tmp-swagger-gen/babylon/btclightclient/v1/query.swagger.json",
"url": "./tmp-swagger-gen/babylon/btclightclient/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "BtcLightClientParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/epoching/v1/query.swagger.json",
"url": "./tmp-swagger-gen/babylon/epoching/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "EpochingParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/checkpointing/v1/query.swagger.json",
"url": "./tmp-swagger-gen/babylon/checkpointing/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "CheckpointingParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/btcstaking/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "BtcStakingParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/btcstkconsumer/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "BtcStkConsumerParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/finality/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "FinalityParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/incentive/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IncentiveParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/monitor/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "MonitorParams"
}
}
},
{
"url": "./tmp-swagger-gen/babylon/zoneconcierge/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "ZoneConciergeParams"
}
}
}
]
}
}
2 changes: 1 addition & 1 deletion contrib/images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cosmos-relayer: cosmos-relayer-rmi
cosmos-relayer-rmi:
docker rmi babylonlabs-io/cosmos-relayer 2>/dev/null; true

.PHONY: all babylond babylond-before-upgrade cosmos-relayer e2e-init-chain babylond-rmi babylond-rmi-upgrade cosmos-relayer-rmi
.PHONY: all babylond cosmos-relayer e2e-init-chain babylond-rmi cosmos-relayer-rmi
1 change: 0 additions & 1 deletion proto/babylon/finality/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ service Msg {
rpc CommitPubRandList(MsgCommitPubRandList) returns (MsgCommitPubRandListResponse);
// AddFinalitySig adds a finality signature to a given block
rpc AddFinalitySig(MsgAddFinalitySig) returns (MsgAddFinalitySigResponse);
// TODO: msg for evidence of equivocation. this is not specified yet
// UpdateParams updates the finality module parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// UnjailFinalityProvider defines a method for unjailing a jailed
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/configurer/chain/commands_btcstaking.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (n *NodeConfig) CreateBTCDelegation(
// broadcast stuff
cmd = append(cmd, "-b=sync", "--yes")
}
// cmd = append(cmd, fmt.Sprintf("--chain-id=%s", n.chainId), "-b=sync", "--yes", "--keyring-backend=test", "--log_format=json", "--home=/home/babylon/babylondata")

cmd = append(cmd, fmt.Sprintf("--chain-id=%s", n.chainId), "-b=sync", "--yes")
outBuff, _, err := n.containerManager.ExecCmd(n.t, n.Name, append(cmd, overallFlags...), "")

Expand Down
5 changes: 4 additions & 1 deletion test/e2e/containers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir st
Entrypoint: []string{
"sh",
"-c",
"babylond start " + FlagHome + " --log_level trace --trace",
// one can use the following for debugging purposes
// "babylond start " + FlagHome + " --log_level trace --trace",
// TODO: parameterise the log level
"babylond start " + FlagHome,
},
ExposedPorts: []string{"26656", "26657", "1317", "9090"},
Mounts: []string{
Expand Down
2 changes: 0 additions & 2 deletions testutil/btcstaking-helper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ var (
timestampedEpoch = uint64(10)
)

// TODO: move this to keeper package rather than keeper_test so that
// it can be inherited to test other modules?
type Helper struct {
t testing.TB

Expand Down
2 changes: 1 addition & 1 deletion x/btccheckpoint/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package cli

import (
"fmt"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"

// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/babylonlabs-io/babylon/x/btccheckpoint/types"
)

Expand Down
9 changes: 2 additions & 7 deletions x/btcstaking/keeper/btc_consumer_delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ import (
"github.com/cosmos/cosmos-sdk/types/query"
)

// IndexBTCConsumerDelegation indexes a BTC delegation into the BTC consumer delegator store
// indexBTCConsumerDelegation indexes a BTC delegation into the BTC consumer delegator store
// CONTRACT: this function only takes BTC delegations that have passed verifications
// imposed in `x/btcstaking/msg_server.go`
func (k Keeper) IndexBTCConsumerDelegation(ctx sdk.Context, btcDel *bstypes.BTCDelegation) error {
if err := btcDel.ValidateBasic(); err != nil {
return err
}

func (k Keeper) indexBTCConsumerDelegation(ctx sdk.Context, btcDel *bstypes.BTCDelegation) error {
// get staking tx hash
stakingTxHash, err := btcDel.GetStakingTxHash()
if err != nil {
Expand Down Expand Up @@ -58,7 +54,6 @@ func (k Keeper) GetBTCConsumerDelegatorDelegationsResponses(
ctx sdk.Context,
fpBTCPK *bbn.BIP340PubKey,
pagination *query.PageRequest,
wValue uint32,
btcHeight uint32,
covenantQuorum uint32,
) ([]*bstypes.BTCDelegatorDelegationsResponse, *query.PageResponse, error) {
Expand Down
1 change: 1 addition & 0 deletions x/btcstaking/keeper/btc_delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ func (k Keeper) validateRestakedFPs(ctx context.Context, fpBTCPKs []bbn.BIP340Pu
}

// restakedFPConsumerIDs returns the unique consumer IDs of non-Babylon finality providers
// The returned list is sorted in order to make sure the function is deterministic
func (k Keeper) restakedFPConsumerIDs(ctx context.Context, fpBTCPKs []bbn.BIP340PubKey) ([]string, error) {
consumerIDMap := make(map[string]struct{})

Expand Down
8 changes: 8 additions & 0 deletions x/btcstaking/keeper/btc_staking_consumer_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func FuzzSetBTCStakingEventStore_NewFp(f *testing.F) {
datagen.AddRandomSeedsToFuzzer(f, 10)

f.Fuzz(func(t *testing.T, seed int64) {
t.Parallel()

r := rand.New(rand.NewSource(seed))
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down Expand Up @@ -75,6 +77,8 @@ func FuzzSetBTCStakingEventStore_ActiveDel(f *testing.F) {
datagen.AddRandomSeedsToFuzzer(f, 10)

f.Fuzz(func(t *testing.T, seed int64) {
t.Parallel()

r := rand.New(rand.NewSource(seed))
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down Expand Up @@ -169,6 +173,8 @@ func FuzzSetBTCStakingEventStore_UnbondedDel(f *testing.F) {
datagen.AddRandomSeedsToFuzzer(f, 10)

f.Fuzz(func(t *testing.T, seed int64) {
t.Parallel()

r := rand.New(rand.NewSource(seed))
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down Expand Up @@ -270,6 +276,8 @@ func FuzzDeleteBTCStakingEventStore(f *testing.F) {
datagen.AddRandomSeedsToFuzzer(f, 10)

f.Fuzz(func(t *testing.T, seed int64) {
t.Parallel()

r := rand.New(rand.NewSource(seed))
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down
4 changes: 3 additions & 1 deletion x/btcstaking/keeper/finality_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (k Keeper) AddFinalityProvider(goCtx context.Context, msg *types.MsgCreateF
// default consumer ID is Babylon's chain ID
consumerID := msg.GetConsumerId()
if consumerID == "" {
// canonical chain id
// Babylon chain ID
consumerID = ctx.ChainID()
}

Expand Down Expand Up @@ -202,6 +202,8 @@ func (k Keeper) PropagateFPSlashingToConsumers(ctx context.Context, fpBTCPK *bbn
consumerID, exists := fpToConsumerMap[fpBTCPKHex]
if !exists {
// If not in map, check if it's a Babylon FP or get its consumer
// TODO: avoid querying GetFinalityProvider again by passing the result
// https://github.com/babylonlabs-io/babylon/blob/873f1232365573a97032037af4ac99b5e3fcada8/x/btcstaking/keeper/btc_delegators.go#L79 to this function
if _, err := k.GetFinalityProvider(ctx, delegationFPBTCPK); err == nil {
continue // It's a Babylon FP, skip
} else if consumerID, err = k.BscKeeper.GetConsumerOfFinalityProvider(ctx, &delegationFPBTCPK); err == nil {
Expand Down
3 changes: 1 addition & 2 deletions x/btcstaking/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func (k Keeper) FinalityProviderDelegations(ctx context.Context, req *types.Quer
}

sdkCtx := sdk.UnwrapSDKContext(ctx)
currentWValue := k.btccKeeper.GetParams(ctx).CheckpointFinalizationTimeout
btcHeight := k.btclcKeeper.GetTipInfo(ctx).Height
covenantQuorum := k.GetParams(ctx).CovenantQuorum

Expand Down Expand Up @@ -188,7 +187,7 @@ func (k Keeper) FinalityProviderDelegations(ctx context.Context, req *types.Quer

case k.BscKeeper.HasConsumerFinalityProvider(ctx, fpPK):
// this is a consumer finality provider
btcDels, pageRes, err = k.GetBTCConsumerDelegatorDelegationsResponses(sdkCtx, fpPK, req.Pagination, currentWValue, btcHeight, covenantQuorum)
btcDels, pageRes, err = k.GetBTCConsumerDelegatorDelegationsResponses(sdkCtx, fpPK, req.Pagination, btcHeight, covenantQuorum)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/btcstaking/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre
// if this BTC delegation is restaked to consumers' FPs, add it to btcstkconsumer indexes
// TODO: revisit the relationship between BTC staking module and BTC staking consumer module
if restakedToConsumers {
if err := ms.IndexBTCConsumerDelegation(ctx, newBTCDel); err != nil {
if err := ms.indexBTCConsumerDelegation(ctx, newBTCDel); err != nil {
panic(fmt.Errorf("failed to add BTC delegation restaked to consumers' finality providers despite it has passed verification: %w", err))
}
}
Expand Down
14 changes: 7 additions & 7 deletions x/btcstkconsumer/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ func GetTxCmd() *cobra.Command {
func NewRegisterConsumerCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "register-consumer <consumer-id> <name> [description]",
Args: cobra.RangeArgs(2, 3),
Short: "Registers a CZ consumer",
Args: cobra.ExactArgs(3),
Short: "Registers a consumer",
Long: strings.TrimSpace(
`Registers a CZ consumer.`,
`Registers a consumer with Babylon. The consumer-id must be unique and will be used to identify this consumer.
The name and optional description help identify the purpose of this consumer.`,
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

// get description
consumerId := args[0]
if consumerId == "" {
return fmt.Errorf("consumer's id cannot be empty")
Expand All @@ -53,9 +53,9 @@ func NewRegisterConsumerCmd() *cobra.Command {
if name == "" {
return fmt.Errorf("consumer's name cannot be empty")
}
description := ""
if len(args) == 3 {
description = args[2]
description := args[2]
if description == "" {
return fmt.Errorf("consumer's description cannot be empty")
}

msg := types.MsgRegisterConsumer{
Expand Down
Loading

0 comments on commit eaf20a1

Please sign in to comment.