-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: general oracle improvements and ABCI determinism #1391
Conversation
@@ -20,25 +20,21 @@ | |||
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) | |||
|
|||
params := k.GetParams(ctx) | |||
if IsPeriodLastBlock(ctx, params.VotePeriod) { | |||
if isPeriodLastBlock(ctx, params.VotePeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
// Organize votes to ballot by denom | ||
// NOTE: **Filter out inactive or jailed validators** | ||
voteMap := k.OrganizeBallotByDenom(ctx, validatorClaimMap) | ||
k.ClearExchangeRates(ctx) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
|
||
ballotDenomSlice := types.BallotMapToSlice(voteMap) | ||
// NOTE: it filters out inactive or jailed validators | ||
ballotDenomSlice := k.OrganizeBallotByDenom(ctx, validatorClaimMap) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
@@ -106,14 +95,14 @@ | |||
|
|||
// Slash oracle providers who missed voting over the threshold and | |||
// reset miss counters of all validators at the last block of slash window | |||
if IsPeriodLastBlock(ctx, params.SlashWindow) { | |||
if isPeriodLastBlock(ctx, params.SlashWindow) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
looking at this tomorrow morning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm except for 1 comment, pre-approving
validatorClaimMap[valAddr.String()] = types.NewClaim(validator.GetConsensusPower(powerReduction), 0, 0, valAddr) | ||
i++ | ||
} | ||
for _, v := range k.StakingKeeper.GetBondedValidatorsByPower(ctx) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
i++ | ||
} | ||
for _, v := range k.StakingKeeper.GetBondedValidatorsByPower(ctx) { | ||
addr := v.GetOperator() |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
} | ||
for _, v := range k.StakingKeeper.GetBondedValidatorsByPower(ctx) { | ||
addr := v.GetOperator() | ||
validatorClaimMap[addr.String()] = types.NewClaim(v.GetConsensusPower(powerReduction), 0, 0, addr) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
} | ||
for _, v := range k.StakingKeeper.GetBondedValidatorsByPower(ctx) { | ||
addr := v.GetOperator() | ||
validatorClaimMap[addr.String()] = types.NewClaim(v.GetConsensusPower(powerReduction), 0, 0, addr) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
Codecov Report
@@ Coverage Diff @@
## main #1391 +/- ##
==========================================
+ Coverage 52.44% 52.52% +0.08%
==========================================
Files 71 70 -1
Lines 6802 6692 -110
==========================================
- Hits 3567 3515 -52
+ Misses 2966 2909 -57
+ Partials 269 268 -1
|
Description
Few improvements while going through the oracle code.
Notable hardening the
OrganizeBallotByDenom
function to use deterministic list, rather than map. This could cause potential chain halt.Closes: #1046
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...