End Block
Tally Exchange Rate Votes
At the end of every block, the Oracle
module checks whether it's the last block of the VotePeriod
. If it is, it runs the Voting Procedure:
All current active exchange rates are purged from the store
Received votes are organized into ballots by denomination. Votes by inactive or jailed validators are ignored.
Exchange rates not meeting the following requirements will be dropped:
- Must appear in the permitted denominations in
AcceptList
- Ballot for rate must have at least
VoteThreshold
total vote power
- Must appear in the permitted denominations in
For each remaining
denom
with a passing ballot:- Tally up votes and find the weighted median exchange rate and winners with
tally()
- Iterate through winners of the ballot and add their weight to their running total
- Set the exchange rate on the blockchain for that
denom
withk.SetExchangeRate()
- Emit an
exchange_rate_update
event
- Tally up votes and find the weighted median exchange rate and winners with
Count up the validators who missed the Oracle vote and increase the appropriate miss counters
If at the end of a
SlashWindow
, penalize validators who have missed more than the penalty threshold (submitted fewer valid votes thanMinValidPerWindow
)Distribute rewards to ballot winners with
k.RewardBallotWinners()
Clear all prevotes (except ones for the next
VotePeriod
) and votes from the store