1.5 KiB
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 Luna exchange rates are purged from the store
-
Received votes are organized into ballots by denomination. Abstained votes, as well as votes by inactive or jailed validators are ignored
-
Denominations not meeting the following requirements will be dropped:
- Must appear in the permitted denominations in
Whitelist - Ballot for denomination must have at least
VoteThresholdtotal vote power
- Must appear in the permitted denominations in
-
For each remaining
denomwith 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 Luna exchange rate on the blockchain for that Luna<>
denomwithk.SetLunaExchangeRate() - Emit a
exchange_rate_updateevent
- 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