Skip to content

Commit

Permalink
minor change in code example
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed May 8, 2024
1 parent 65c61f0 commit d83913c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/docs/adrs/adr-016-securityaggregation.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,24 @@ feature works.
// are used by the mixer. This can be an oracle, staking module or an
// IBC connected bridge.
type PowerSource interface {
GetValPowers() []abci.ValidatorUpdate
GetValidatorUpdates() []abci.ValidatorUpdate
}

// MixPowers calculates power updates by mixing validator powers from different sources
func (k *Keeper) MixPowers(source ...PowerSource) []abci.ValidatorUpdate {
var valUpdate []abci.ValidatorUpdate
for _, ps := range source {
valUpdate = mixPower(valUpdate, ps)
// mix powers from two sets of validator updates an return set of validator updates
// with aggregated powers
valUpdate = mixPower(valUpdate, ps.GetValidatorUpdates())
}
return valUpdate
}

func (k *keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
// GetPowerSources (including local staking module)
registeredPowerSource := GetPowerSources()
return am.keeper.MixPowers(registeredPowerSource...)
return k.MixPowers(registeredPowerSource...)
}
```

Expand Down

0 comments on commit d83913c

Please sign in to comment.