Skip to content

Commit

Permalink
Merge branch 'main' into ph/priority-validators
Browse files Browse the repository at this point in the history
  • Loading branch information
kirdatatjana authored Oct 17, 2024
2 parents b36e28f + 621af72 commit 171246d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 52 deletions.
30 changes: 15 additions & 15 deletions docs/docs/build/modules/02-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ message MsgUpdateParams {
}
```

### ChangeRewardDenomsProposal
### MsgChangeRewardDenoms

`MsgChangeRewardDenoms` updates the list of whitelisted denoms accepted by the provider as ICS rewards.
The list of accepted denoms is updated through a governance proposal where the signer is the gov module account address.
Expand Down Expand Up @@ -1557,7 +1557,7 @@ power_shaping_params:
allow_inactive_vals: false
allowlist: []
denylist: []
min_stake: "0"
min_stake: 0
top_N: 100
validator_set_cap: 0
validators_power_cap: 0
Expand Down Expand Up @@ -1627,7 +1627,7 @@ where `create-consumer-msg.json` contains:
"metadata": {
"name": "pion-1",
"description":"description of your chain and all other relevant information",
"metadata": "some metadata about your chain"
"metadata": "{\"forge_json_url\": \"...\", \"stage\": \"mainnet\"}"
}
}
```
Expand Down Expand Up @@ -1663,28 +1663,28 @@ where `update-consumer-msg.json` contains:
"metadata": {
"name": "pion-1",
"description":"description of your chain and all other relevant information",
"metadata": "some metadata about your"
"metadata": "{\"forge_json_url\": \"...\", \"stage\": \"mainnet\"}"
},
"initialization_parameters":{
"initial_height":{
"revision_number": 0,
"revision_height": 1
"revision_number": 1,
"revision_height": 0
},
"genesis_hash":"2D5C2110941DA54BE07CBB9FACD7E4A2E3253E79BE7BE3E5A1A7BDA518BAA4BE",
"binary_hash": "6EF05C2F38BE62A833E5AB51EBF3BA72D1BC1664D7E4A2E3253DA54BE07CF38A",
"genesis_hash": "",
"binary_hash": "",
"spawn_time": "2024-09-29T12:57:43Z",
"unbonding_period":"2419200s",
"ccv_timeout_period": "2419200s",
"transfer_timeout_period": "3600s",
"unbonding_period": 1728000000000000,
"ccv_timeout_period": 2419200000000000,
"transfer_timeout_period": 1800000000000,
"consumer_redistribution_fraction": "0.75",
"blocks_per_distribution_transmission": "1500",
"historical_entries":"1000",
"historical_entries": "1000",
"distribution_transmission_channel": ""
},
"power_shaping_parameters":{
"top_N":50,
"validators_power_cap":50,
"validator_set_cap":50,
"top_N": 0,
"validators_power_cap": 10,
"validator_set_cap": 50,
"allowlist":["cosmosvalcons1l9qq4m300z8c5ez86ak2mp8znftewkwgjlxh88"],
"denylist":[],
"min_stake": "1000",
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/build/modules/03-consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ The consumer module contains the following parameters.
Providing an IBC transfer channel enables a consumer chain to re-use one of the existing channels to the provider for consumer chain rewards distribution.
This will preserve the `ibc denom` that may already be in use.
This is especially important for standalone chains transitioning to become consumer chains.
For more details, see the [changeover procedure](../consumer-development/changeover-procedure.md).
For more details, see the [changeover procedure](../../consumer-development/changeover-procedure.md).

### ProviderFeePoolAddrStr

Expand Down Expand Up @@ -439,7 +439,7 @@ It is recommended that every consumer chain set and unbonding period shorter tha
| time.Duration | 3600s (1 hour) |

`RetryDelayPeriod` is the period at which the consumer retries to send a `SlashPacket` that was rejected by the provider.
For more details, see [ADR-008](../adrs/adr-008-throttle-retries.md).
For more details, see [ADR-008](../../adrs/adr-008-throttle-retries.md).

## Client

Expand Down
7 changes: 3 additions & 4 deletions docs/docs/consumer-development/changeover-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ However, here are the most important notes and differences between a new consume
// must correspond to a height that is at least 1 block after the upgrade
// that will add the `consumer` module to the standalone chain
// e.g. "upgrade_height": 100 => "revision_height": 101
"revision_height": 1,
"revision_height": 101,
},
...
}
```
RevisionNumber: 0, RevisionHeight: 111
:::

* `genesis_hash` can be safely ignored because the chain is already running. A hash of the standalone chain's initial genesis may be used
Expand Down Expand Up @@ -177,10 +176,10 @@ Example of initialization parameters (compare with the [those](./onboarding.md#
"spawn_time": "2023-02-28T20:40:00.000000Z",
// Unbonding period for the consumer chain.
// It should should be smaller than that of the provider.
"unbonding_period": 86400000000000,
"unbonding_period": 1728000000000000,
// Timeout period for CCV related IBC packets.
// Packets are considered timed-out after this interval elapses.
"ccv_timeout_period": 259200000000000,
"ccv_timeout_period": 2419200000000000,
// IBC transfer packets will timeout after this interval elapses.
"transfer_timeout_period": 1800000000000,
// The fraction of tokens allocated to the consumer redistribution address during distribution events.
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/consumer-development/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ Example of initialization parameters:
"spawn_time": "2023-02-28T20:40:00.000000Z",
// Unbonding period for the consumer chain.
// It should be smaller than that of the provider.
"unbonding_period": 86400000000000,
"unbonding_period": 1728000000000000,
// Timeout period for CCV related IBC packets.
// Packets are considered timed-out after this interval elapses.
"ccv_timeout_period": 259200000000000,
"ccv_timeout_period": 2419200000000000,
// IBC transfer packets will timeout after this interval elapses.
"transfer_timeout_period": 1800000000000,
// The fraction of tokens allocated to the consumer redistribution address during distribution events.
Expand Down Expand Up @@ -108,7 +108,7 @@ Example of power-shaping parameters:
// For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power
// have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100].
// A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain.
"top_N": 95,
"top_N": 0,
// Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if
// `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the
// consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only
Expand All @@ -120,7 +120,7 @@ Example of power-shaping parameters:
"validator_set_cap": 0,
// Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate
// the consumer chain.
"allowlist": [],
"allowlist": ["cosmosvalcons1l9qq4m300z8c5ez86ak2mp8znftewkwgjlxh88"],
// Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain.
"denylist": [],
// Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain.
Expand Down
46 changes: 23 additions & 23 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ An IBC misbehaviour contains two conflicting IBC client headers, which are used
The misbehaviour type definition can be found in the IBC client messages, see ibc-go/proto/ibc/core/client/v1/tx.proto.
Example:
%s tx provider submit-consumer-misbehaviour [consumer-id] [path/to/misbehaviour.json] --from node0 --home ../node0 --chain-id $CID
%s tx provider submit-consumer-misbehaviour [consumer-id] [path/to/misbehaviour.json]
`, version.AppName)),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -154,7 +154,7 @@ func NewSubmitConsumerDoubleVotingCmd() *cobra.Command {
definition can be found in the IBC messages, see ibc-go/proto/ibc/lightclients/tendermint/v1/tendermint.proto.
Example:
%s tx provider submit-consumer-double-voting [consumer-id] [path/to/evidence.json] [path/to/infraction_header.json] --from node0 --home ../node0 --chain-id $CID
%s tx provider submit-consumer-double-voting [consumer-id] [path/to/evidence.json] [path/to/infraction_header.json]
`, version.AppName)),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -221,23 +221,23 @@ Note that the one that signs this message is the owner of this consumer chain. T
changed by updating the consumer chain.
Example:
%s tx provider create-consumer [path/to/create_consumer.json] --from node0 --home ../node0 --chain-id $CID
%s tx provider create-consumer [path/to/create_consumer.json]
where create_consumer.json has the following structure:
{
"chain_id": "consu",
"chain_id": "consumer-1",
"metadata": {
"name": "chain consumer",
"description": "description",
"metadata": "metadata"
"metadata": "{\"forge_json_url\": \"...\", \"stage\": \"mainnet\"}"
},
"initialization_parameters": {
"initial_height": {
"revision_number": 0,
"revision_height": 1
"revision_number": 1,
"revision_height": 0
},
"genesis_hash": "Z2VuX2hhc2g=",
"binary_hash": "YmluX2hhc2g=",
"genesis_hash": "",
"binary_hash": "",
"spawn_time": "2024-08-29T12:26:16.529913Z",
"unbonding_period": 1728000000000000,
"ccv_timeout_period": 2419200000000000,
Expand All @@ -248,14 +248,14 @@ where create_consumer.json has the following structure:
"distribution_transmission_channel": ""
},
"power_shaping_parameters": {
"top_N": 100,
"validators_power_cap": 0,
"top_N": 0,
"validators_power_cap": 10,
"validator_set_cap": 0,
"allowlist": [],
"denylist": [],
"min_stake": "0",
"allow_inactive_vals": false,
"prioritylist": []
"prioritylist": []
},
"allowlisted_reward_denoms": {
"denoms": ["ibc/...", "ibc/..."]
Expand Down Expand Up @@ -319,7 +319,7 @@ func NewUpdateConsumerCmd() *cobra.Command {
Note that only the owner of the chain can initialize it.
Example:
%s tx provider update-consumer [path/to/update_consumer.json] --from node0 --home ../node0 --chain-id $CID
%s tx provider update-consumer [path/to/update_consumer.json]
where update_consumer.json has the following structure:
{
Expand All @@ -328,15 +328,15 @@ where update_consumer.json has the following structure:
"metadata": {
"name": "chain consumer",
"description": "description",
"metadata": "metadata"
"metadata": "{\"forge_json_url\": \"...\", \"stage\": \"mainnet\"}"
},
"initialization_parameters": {
"initial_height": {
"revision_number": 0,
"revision_height": 1
"revision_number": 1,
"revision_height": 0
},
"genesis_hash": "Z2VuX2hhc2g=",
"binary_hash": "YmluX2hhc2g=",
"genesis_hash": "",
"binary_hash": "",
"spawn_time": "2024-08-29T12:26:16.529913Z",
"unbonding_period": 1728000000000000,
"ccv_timeout_period": 2419200000000000,
Expand All @@ -347,14 +347,14 @@ where update_consumer.json has the following structure:
"distribution_transmission_channel": ""
},
"power_shaping_parameters": {
"top_N": 100,
"validators_power_cap": 0,
"top_N": 0,
"validators_power_cap": 10,
"validator_set_cap": 0,
"allowlist": [],
"denylist": [],
"min_stake": "0",
"allow_inactive_vals": false,
"prioritylist": []
"prioritylist": []
},
"allowlisted_reward_denoms": {
"denoms": ["ibc/...", "ibc/..."]
Expand Down Expand Up @@ -423,7 +423,7 @@ func NewRemoveConsumerCmd() *cobra.Command {
Long: strings.TrimSpace(
fmt.Sprintf(`Removes (and stops) a consumer chain. Note that only the owner of the chain can remove it.
Example:
%s tx provider remove-consumer [consumer-id] --from node0 --home ../node0 --chain-id $CID
%s tx provider remove-consumer [consumer-id]
`, version.AppName)),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -554,7 +554,7 @@ func NewSetConsumerCommissionRateCmd() *cobra.Command {
Long: strings.TrimSpace(
fmt.Sprintf(`Note that the "commission-rate" argument is a fraction and should be in the range [0,1].
Example:
%s set-consumer-commission-rate 123 0.5 --from node0 --home ../node0`,
%s set-consumer-commission-rate 123 0.5`,
version.AppName),
),
Args: cobra.ExactArgs(2),
Expand Down
9 changes: 5 additions & 4 deletions x/ccv/provider/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func (k Keeper) DeleteConsumerRewardsAllocationByDenom(ctx sdk.Context, consumer

// AllocateConsumerRewards allocates the given rewards to provider consumer chain with the given consumer id
func (k Keeper) AllocateConsumerRewards(ctx sdk.Context, consumerId string, alloc types.ConsumerRewardsAllocation) (types.ConsumerRewardsAllocation, error) {
if alloc.Rewards.IsZero() {
return types.ConsumerRewardsAllocation{}, nil
}

chainId, err := k.GetConsumerChainId(ctx, consumerId)
if err != nil {
Expand Down Expand Up @@ -268,10 +271,6 @@ func (k Keeper) AllocateConsumerRewards(ctx sdk.Context, consumerId string, allo
// AllocateTokens performs rewards distribution to the community pool and validators
// based on the Partial Set Security distribution specification.
func (k Keeper) AllocateTokens(ctx sdk.Context) {
// return if there is no coins in the consumer rewards pool
if k.GetConsumerRewardsPool(ctx).IsZero() {
return
}

// Iterate over all launched consumer chains.
// To avoid large iterations over all the consumer IDs, iterate only over
Expand Down Expand Up @@ -312,6 +311,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) {
)
continue
}

err = k.SetConsumerRewardsAllocationByDenom(cachedCtx, consumerId, denom, remainingRewardDec)
if err != nil {
k.Logger(ctx).Error(
Expand All @@ -321,6 +321,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) {
)
continue
}

writeCache()
}
}
Expand Down

0 comments on commit 171246d

Please sign in to comment.