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

Cleanup params in Babylon custom modules. #334

Merged
merged 2 commits into from
Mar 28, 2023
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: 1 addition & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ func NewBabylonApp(
appCodec,
keys[zctypes.StoreKey],
keys[zctypes.MemStoreKey],
app.GetSubspace(zctypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
Expand Down Expand Up @@ -500,15 +499,13 @@ func NewBabylonApp(
appCodec,
keys[btclightclienttypes.StoreKey],
keys[btclightclienttypes.MemStoreKey],
app.GetSubspace(btclightclienttypes.ModuleName),
btcConfig,
)

app.MonitorKeeper = monitorkeeper.NewKeeper(
appCodec,
keys[monitortypes.StoreKey],
keys[monitortypes.StoreKey],
app.GetSubspace(monitortypes.ModuleName),
&btclightclientKeeper,
)

Expand All @@ -527,7 +524,6 @@ func NewBabylonApp(
keys[checkpointingtypes.MemStoreKey],
privSigner.WrappedPV,
app.EpochingKeeper,
app.GetSubspace(checkpointingtypes.ModuleName),
privSigner.ClientCtx,
)
app.CheckpointingKeeper = *checkpointingKeeper.SetHooks(
Expand Down Expand Up @@ -951,10 +947,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
// Babylon modules
paramsKeeper.Subspace(epochingtypes.ModuleName)
paramsKeeper.Subspace(btclightclienttypes.ModuleName)
paramsKeeper.Subspace(btccheckpointtypes.ModuleName)
paramsKeeper.Subspace(checkpointingtypes.ModuleName)
paramsKeeper.Subspace(monitortypes.ModuleName)

// IBC-related modules
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
Expand Down
5 changes: 1 addition & 4 deletions proto/babylon/btclightclient/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ syntax = "proto3";
package babylon.btclightclient.v1;

import "gogoproto/gogo.proto";
import "babylon/btclightclient/v1/params.proto";
import "babylon/btclightclient/v1/btclightclient.proto";

option go_package = "github.com/babylonchain/babylon/x/btclightclient/types";

// GenesisState defines the btclightclient module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, is it worth keeping params?


BTCHeaderInfo base_btc_header = 2 [ (gogoproto.nullable) = false ];
BTCHeaderInfo base_btc_header = 1 [ (gogoproto.nullable) = false ];
}
9 changes: 0 additions & 9 deletions proto/babylon/btclightclient/v1/params.proto

This file was deleted.

14 changes: 0 additions & 14 deletions proto/babylon/btclightclient/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ package babylon.btclightclient.v1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "babylon/btclightclient/v1/params.proto";
import "babylon/btclightclient/v1/btclightclient.proto";

option go_package = "github.com/babylonchain/babylon/x/btclightclient/types";

// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/babylon/btclightclient/v1/params";
}

// Hashes retrieves the hashes maintained by the module.
rpc Hashes(QueryHashesRequest) returns (QueryHashesResponse) {
option (google.api.http).get = "/babylon/btclightclient/v1/hashes";
Expand Down Expand Up @@ -52,14 +46,6 @@ service Query {
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
}
// QueryHashesRequest is request type for the Query/Hashes RPC method.
// It involves retrieving all hashes that are maintained by the module.
message QueryHashesRequest {
Expand Down
6 changes: 1 addition & 5 deletions proto/babylon/checkpointing/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ package babylon.checkpointing.v1;

import "gogoproto/gogo.proto";
import "cosmos/crypto/ed25519/keys.proto";
import "babylon/checkpointing/v1/params.proto";
import "babylon/checkpointing/v1/bls_key.proto";

option go_package = "github.com/babylonchain/babylon/x/checkpointing/types";

// GenesisState defines the checkpointing module's genesis state.
message GenesisState {
// params defines all the paramaters of related to checkpointing
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It it worth keeping the Params message and field here in case of any new parameters in the future?


// genesis_keys defines the public keys for the genesis validators
repeated GenesisKey genesis_keys = 2;
repeated GenesisKey genesis_keys = 1;
}

// GenesisKey defines public key information about the genesis validators
Expand Down
9 changes: 0 additions & 9 deletions proto/babylon/checkpointing/v1/params.proto

This file was deleted.

15 changes: 0 additions & 15 deletions proto/babylon/checkpointing/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "babylon/checkpointing/v1/bls_key.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "babylon/checkpointing/v1/params.proto";
import "babylon/checkpointing/v1/checkpoint.proto";

option go_package = "github.com/babylonchain/babylon/x/checkpointing/types";
Expand Down Expand Up @@ -55,11 +54,6 @@ service Query {
option (google.api.http).get =
"/babylon/checkpointing/v1/last_raw_checkpoint/{status}";
}

// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/babylon/checkpointing/v1/params";
}
}

// QueryRawCheckpointListRequest is the request type for the
Expand Down Expand Up @@ -145,12 +139,3 @@ message QueryLastCheckpointWithStatusRequest { CheckpointStatus status = 1; }
message QueryLastCheckpointWithStatusResponse {
RawCheckpoint raw_checkpoint = 1;
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
}
3 changes: 1 addition & 2 deletions proto/babylon/monitor/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ syntax = "proto3";
package babylon.monitor.v1;

import "gogoproto/gogo.proto";
import "babylon/monitor/v1/params.proto";

option go_package = "github.com/babylonchain/babylon/x/monitor/types";

// GenesisState defines the monitor module's genesis state.
message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

message GenesisState {}
9 changes: 0 additions & 9 deletions proto/babylon/monitor/v1/params.proto

This file was deleted.

16 changes: 0 additions & 16 deletions proto/babylon/monitor/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ package babylon.monitor.v1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "babylon/monitor/v1/params.proto";

option go_package = "github.com/babylonchain/babylon/x/monitor/types";

// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/babylon/monitor/v1/params";
}

// EndedEpochBtcHeight returns the BTC light client height at provided epoch
// finish
rpc EndedEpochBtcHeight(QueryEndedEpochBtcHeightRequest)
Expand All @@ -29,16 +23,6 @@ service Query {
"/babylon/monitor/v1/checkpoints/{ckpt_hash}";
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
}

// QueryEndedEpochBtcHeightRequest defines a query type for EndedEpochBtcHeight
// RPC method
message QueryEndedEpochBtcHeightRequest { uint64 epoch_num = 1; }
Expand Down
4 changes: 1 addition & 3 deletions proto/babylon/zoneconcierge/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ syntax = "proto3";
package babylon.zoneconcierge.v1;

import "gogoproto/gogo.proto";
import "babylon/zoneconcierge/v1/params.proto";

option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types";

// GenesisState defines the zoneconcierge module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Notably, a param that can be upgraded by gov prop might be useful when we add support to phase 3 when at phase 2.

string port_id = 2;
string port_id = 1;
}
9 changes: 0 additions & 9 deletions proto/babylon/zoneconcierge/v1/params.proto

This file was deleted.

16 changes: 1 addition & 15 deletions proto/babylon/zoneconcierge/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "babylon/btccheckpoint/v1/btccheckpoint.proto";
import "babylon/checkpointing/v1/checkpoint.proto";
import "babylon/epoching/v1/epoching.proto";
import "babylon/zoneconcierge/v1/params.proto";
import "babylon/zoneconcierge/v1/zoneconcierge.proto";

option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types";

// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/babylon/zoneconcierge/v1/params";
}
// Header queries the CZ header and fork headers at a given height.
rpc Header(QueryHeaderRequest) returns (QueryHeaderResponse) {
option (google.api.http).get =
Expand Down Expand Up @@ -68,22 +63,13 @@ service Query {
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
}

// QueryHeaderRequest is request type for the Query/Header RPC method.
message QueryHeaderRequest {
string chain_id = 1;
uint64 height = 2;
}

// QueryParamsResponse is response type for the Query/Header RPC method.
// QueryHeaderResponse is response type for the Query/Header RPC method.
message QueryHeaderResponse {
babylon.zoneconcierge.v1.IndexedHeader header = 1;
babylon.zoneconcierge.v1.Forks fork_headers = 2;
Expand Down
1 change: 0 additions & 1 deletion test/e2e/initialization/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func updateCrisisGenesis(crisisGenState *crisistypes.GenesisState) {
}

func updateBtcLightClientGenesis(blcGenState *blctypes.GenesisState) {
blcGenState.Params = blctypes.DefaultParams()
btcSimnetGenesisHex := "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000"
baseBtcHeader, err := bbn.NewBTCHeaderBytesFromHex(btcSimnetGenesisHex)
if err != nil {
Expand Down
12 changes: 0 additions & 12 deletions testutil/keeper/btclightclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"
)

Expand All @@ -32,27 +31,16 @@ func BTCLightClientKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
registry := codectypes.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(registry)

paramsSubspace := typesparams.NewSubspace(cdc,
types.Amino,
storeKey,
memStoreKey,
"BTCLightClientParams",
)

testCfg := bbn.ParseBtcOptionsFromConfig(bapp.EmptyAppOptions{})

k := keeper.NewKeeper(
cdc,
storeKey,
memStoreKey,
paramsSubspace,
testCfg,
)

ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())

// Initialize params
k.SetParams(ctx, types.DefaultParams())

return k, ctx
}
13 changes: 0 additions & 13 deletions testutil/keeper/checkpointing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"
)

Expand All @@ -32,28 +31,16 @@ func CheckpointingKeeper(t testing.TB, ek types.EpochingKeeper, signer keeper.Bl
types.RegisterInterfaces(registry)
cdc := codec.NewProtoCodec(registry)

paramsSubspace := typesparams.NewSubspace(
cdc,
types.Amino,
storeKey,
memStoreKey,
"CheckpointingParams",
)

k := keeper.NewKeeper(
cdc,
storeKey,
memStoreKey,
signer,
ek,
paramsSubspace,
cliCtx,
)

ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())

// Initialize params
k.SetParams(ctx, types.DefaultParams())

return &k, ctx, cdc
}
Loading