diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 1d6e26350b..c54e6f7cf1 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -88,7 +88,7 @@ func CmdConsumerChains() *cobra.Command { req := &types.QueryConsumerChainsRequest{} - if args[0] != "" { + if len(args) > 0 && args[0] != "" { phase, err := strconv.ParseInt(args[0], 10, 32) if err != nil { return err @@ -96,7 +96,7 @@ func CmdConsumerChains() *cobra.Command { req.Phase = types.ConsumerPhase(phase) } - if args[1] != "" { + if len(args) > 1 && args[1] != "" { limit, err := strconv.ParseInt(args[1], 10, 32) if err != nil { return err diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 4251ef50e1..ed4f7352dc 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -224,6 +224,42 @@ changed by updating the consumer chain. Example: %s tx provider create-consumer [path/to/create_consumer.json] --from node0 --home ../node0 --chain-id $CID + +where create_consumer.json content: +{ + "chain_id": "consu", + "metadata": { + "name": "chain provi", + "description": "no description", + "metadata": "no metadata" + }, + "initialization_parameters": { + "initial_height": { + "revision_number": "0", + "revision_height": "1" + }, + "genesis_hash": "Z2VuX2hhc2g=", + "binary_hash": "YmluX2hhc2g=", + "spawn_time": "2024-08-29T12:26:16.529913Z", + "unbonding_period": "1209600s", + "ccv_timeout_period": "2419200s", + "transfer_timeout_period": "3600s", + "consumer_redistribution_fraction": "0.75", + "blocks_per_distribution_transmission": "1000", + "historical_entries": "10000", + "distribution_transmission_channel": "" + }, + "power_shaping_parameters": { + "top_N": 100, + "validators_power_cap": 0, + "validator_set_cap": 0, + "allowlist": [], + "denylist": [], + "min_stake": "0", + "allow_inactive_vals": false + } +} + `, version.AppName)), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -278,6 +314,43 @@ Note that only the owner of the chain can initialize it. Example: %s tx provider update-consumer [path/to/consumer-update.json] --from node0 --home ../node0 --chain-id $CID + + where consumer-update.json contains parameters for 'power_shaping', 'initialization' and 'metadata': + +{ + "consumer_id": "0", + "new_owner_address": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + "metadata": { + "name": "chain provi", + "description": "no description", + "metadata": "no metadata" + }, + "initialization_parameters": { + "initial_height": { + "revision_number": "0", + "revision_height": "1" + }, + "genesis_hash": "Z2VuX2hhc2g=", + "binary_hash": "YmluX2hhc2g=", + "spawn_time": "2024-08-29T12:26:16.529913Z", + "unbonding_period": "1209600s", + "ccv_timeout_period": "2419200s", + "transfer_timeout_period": "3600s", + "consumer_redistribution_fraction": "0.75", + "blocks_per_distribution_transmission": "1000", + "historical_entries": "10000", + "distribution_transmission_channel": "" + }, + "power_shaping_parameters": { + "top_N": 100, + "validators_power_cap": 0, + "validator_set_cap": 0, + "allowlist": [], + "denylist": [], + "min_stake": "0", + "allow_inactive_vals": false + } +} `, version.AppName)), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 14410324fa..b9384c074f 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -139,9 +139,12 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai strDenylist[i] = addr.String() } + // TODO PERMISSIONLESS: metadata is deleted on chain stop. + // just log and error and accept empty content for now + // to make e2e test happy metadata, err := k.GetConsumerMetadata(ctx, consumerId) - if err != nil { - return types.Chain{}, fmt.Errorf("cannot get metadata for consumer (%s): %w", consumerId, err) + if err != nil && phase != types.ConsumerPhase_CONSUMER_PHASE_STOPPED { + k.Logger(ctx).Error("cannot get metadata for consumer (%s): %w", consumerId, err) } return types.Chain{