Skip to content

Commit

Permalink
feat!: migrations for permissionless (#2177)
Browse files Browse the repository at this point in the history
* initial commit

* took into account comments

* removed deprecated queries
  • Loading branch information
insumity committed Aug 28, 2024
1 parent 7d7fb7e commit 8abd23d
Show file tree
Hide file tree
Showing 19 changed files with 340 additions and 2,475 deletions.
8 changes: 4 additions & 4 deletions proto/interchain_security/ccv/provider/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ message GenesisState {
// empty for a new chain
repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5
[ (gogoproto.nullable) = false ];
// empty for a new chain
// [DEPRECATED] empty for a new chain
repeated ConsumerAdditionProposal consumer_addition_proposals = 6
[ (gogoproto.nullable) = false ];
// empty for a new chain
[ deprecated = true, (gogoproto.nullable) = false ];
// [DEPRECATED] empty for a new chain
repeated ConsumerRemovalProposal consumer_removal_proposals = 7
[ (gogoproto.nullable) = false ];
[ deprecated = true, (gogoproto.nullable) = false ];
Params params = 8 [ (gogoproto.nullable) = false ];
// empty for a new chain
repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 9
Expand Down
49 changes: 0 additions & 49 deletions proto/interchain_security/ccv/provider/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ service Query {
"/interchain_security/ccv/provider/consumer_chains";
}

// QueryConsumerChainStarts queries consumer chain start proposals.
rpc QueryConsumerChainStarts(QueryConsumerChainStartProposalsRequest)
returns (QueryConsumerChainStartProposalsResponse) {
option (google.api.http).get =
"/interchain_security/ccv/provider/consumer_chain_start_proposals";
}

// QueryConsumerChainStops queries consumer chain stop proposals.
rpc QueryConsumerChainStops(QueryConsumerChainStopProposalsRequest)
returns (QueryConsumerChainStopProposalsResponse) {
option (google.api.http).get =
"/interchain_security/ccv/provider/consumer_chain_stop_proposals";
}

// QueryValidatorConsumerAddr queries the address
// assigned by a validator for a consumer chain.
rpc QueryValidatorConsumerAddr(QueryValidatorConsumerAddrRequest)
Expand Down Expand Up @@ -82,15 +68,6 @@ service Query {
"/interchain_security/ccv/provider/registered_consumer_reward_denoms";
}

// QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals
// that are still in the voting period
rpc QueryProposedConsumerChainIDs(
QueryProposedChainIDsRequest)
returns (QueryProposedChainIDsResponse) {
option (google.api.http).get =
"/interchain_security/ccv/provider/proposed_consumer_chains";
}

// QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address
// between provider and consumer chain
rpc QueryAllPairsValConAddrByConsumerChainID (
Expand Down Expand Up @@ -195,18 +172,6 @@ message QueryConsumerChainsRequest {}

message QueryConsumerChainsResponse { repeated Chain chains = 1; }

message QueryConsumerChainStartProposalsRequest {}

message QueryConsumerChainStartProposalsResponse {
ConsumerAdditionProposals proposals = 1;
}

message QueryConsumerChainStopProposalsRequest {}

message QueryConsumerChainStopProposalsResponse {
ConsumerRemovalProposals proposals = 1;
}

message Chain {
string chain_id = 1;
string client_id = 2;
Expand Down Expand Up @@ -279,20 +244,6 @@ message QueryRegisteredConsumerRewardDenomsResponse {
repeated string denoms = 1;
}

message QueryProposedChainIDsRequest {}

message QueryProposedChainIDsResponse {
repeated ProposedChain proposedChains = 1
[ (gogoproto.nullable) = false ];
}

message ProposedChain {
// [DEPRECATED] use `consumer_id` instead
string chainID = 1 [deprecated = true];
uint64 proposalID = 2;
string consumer_id = 3;
}

message QueryAllPairsValConAddrByConsumerChainIDRequest {
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
Expand Down
178 changes: 0 additions & 178 deletions tests/integration/provider_gov_hooks.go

This file was deleted.

92 changes: 0 additions & 92 deletions x/ccv/provider/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ func NewQueryCmd() *cobra.Command {

cmd.AddCommand(CmdConsumerGenesis())
cmd.AddCommand(CmdConsumerChains())
cmd.AddCommand(CmdConsumerStartProposals())
cmd.AddCommand(CmdConsumerStopProposals())
cmd.AddCommand(CmdConsumerValidatorKeyAssignment())
cmd.AddCommand(CmdProviderValidatorKey())
cmd.AddCommand(CmdThrottleState())
cmd.AddCommand(CmdRegisteredConsumerRewardDenoms())
cmd.AddCommand(CmdProposedConsumerChains())
cmd.AddCommand(CmdAllPairsValConAddrByConsumerChainID())
cmd.AddCommand(CmdProviderParameters())
cmd.AddCommand(CmdConsumerChainOptedInValidators())
Expand Down Expand Up @@ -100,95 +97,6 @@ func CmdConsumerChains() *cobra.Command {
return cmd
}

func CmdProposedConsumerChains() *cobra.Command {
cmd := &cobra.Command{
Use: "list-proposed-consumer-chains",
Short: "Query chainIDs in consumer addition proposal before voting finishes",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryProposedChainIDsRequest{}
res, err := queryClient.QueryProposedConsumerChainIDs(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

func CmdConsumerStartProposals() *cobra.Command {
cmd := &cobra.Command{
Use: "list-start-proposals",
Short: "Query consumer chains start proposals on provider chain.",
Long: `Query mature and pending consumer chains start proposals on provider chain.
Matured proposals will be executed on the next block - their spawn_time has passed
Pending proposals are waiting for their spawn_time to pass.
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryConsumerChainStartProposalsRequest{}
res, err := queryClient.QueryConsumerChainStarts(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

func CmdConsumerStopProposals() *cobra.Command {
cmd := &cobra.Command{
Use: "list-stop-proposals",
Short: "Query consumer chains stop proposals on provider chain.",
Long: `Query mature and pending consumer chains stop proposals on provider chain.
Matured proposals will be executed on the next block - their stop_time has passed
Pending proposals are waiting for their stop_time to pass.
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryConsumerChainStopProposalsRequest{}
res, err := queryClient.QueryConsumerChainStops(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// TODO: fix naming
func CmdConsumerValidatorKeyAssignment() *cobra.Command {
bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix()
Expand Down
2 changes: 0 additions & 2 deletions x/ccv/provider/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
k.GetValidatorSetUpdateId(ctx),
k.GetAllValsetUpdateBlockHeights(ctx),
consumerStates,
k.GetAllPendingConsumerAdditionProps(ctx),
k.GetAllPendingConsumerRemovalProps(ctx),
params,
k.GetAllValidatorConsumerPubKeys(ctx, nil),
k.GetAllValidatorsByConsumerAddr(ctx, nil),
Expand Down
Loading

0 comments on commit 8abd23d

Please sign in to comment.