Skip to content

Commit

Permalink
add on AllocateTokens
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Jan 22, 2024
1 parent a86272d commit 4a418c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/docs/adrs/adr-015-partial-set-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,17 @@ Note that we use `0` to remove validators that are not opted in as described [he
### How do we distribute rewards?
Currently, rewards are distributed as follows: The consumer [periodically sends rewards](https://github.com/cosmos/interchain-security/blob/v3.3.0/x/ccv/consumer/keeper/distribution.go#L148) on the provider `ConsumerRewardsPool` address. The provider then [transfers those rewards to the fee collector address](https://github.com/cosmos/interchain-security/blob/v3.3.0/x/ccv/provider/keeper/distribution.go#L77) and those transferred rewards are distributed to validators and delegators.

We could use something like `AllocateTokenRewards` but still needs a lot of work because we need to deduce tokens beforehand and so on … Probably doesn’t have to be exact science .. since we already do not distribute exactly.
In PSS, we distribute rewards only to validators that actually validated the consumer chain. To do this we generate a slice with bogus `VoteInfo` that contains the opted in (or Top N) validators and call [AllocateTokens](https://github.com/cosmos/cosmos-sdk/blob/v0.47.7/x/distribution/keeper/allocation.go#L14).

```
totalPower := 0
var []abci.VoteInfo votes
for _, val := range validators {
votes = append(votes, []abci.VoteInfo{{Validator: val, SignedLastBlock: true}})
}
k.AllocateTokens(ctx, totalPower, votes)
```

### Misbehaviour

Expand Down

0 comments on commit 4a418c8

Please sign in to comment.