-
Notifications
You must be signed in to change notification settings - Fork 170
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
chore(tests): Add checks to oracle ABCI test #1724
Conversation
zarazan
commented
Jan 18, 2023
- Update oracle ABCI test to check for the correct amount of pruning prices
- Update oracle ABCI test to check for correct median deviations
// EndBlocker is called at the end of every block | ||
func EndBlocker(ctx sdk.Context, k keeper.Keeper) error { | ||
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) | ||
|
||
params := k.GetParams(ctx) | ||
if isPeriodLastBlock(ctx, params.VotePeriod) { | ||
if k.IsPeriodLastBlock(ctx, params.VotePeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
@@ -59,12 +54,12 @@ | |||
return err | |||
} | |||
|
|||
if isPeriodLastBlock(ctx, params.HistoricStampPeriod) { | |||
if k.IsPeriodLastBlock(ctx, params.HistoricStampPeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
k.AddHistoricPrice(ctx, denom, exchangeRate) | ||
} | ||
|
||
// Calculate and stamp median/median deviation if median stamp period has passed | ||
if isPeriodLastBlock(ctx, params.MedianStampPeriod) { | ||
if k.IsPeriodLastBlock(ctx, params.MedianStampPeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
@@ -100,26 +95,11 @@ | |||
|
|||
// 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 k.IsPeriodLastBlock(ctx, params.SlashWindow) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
} | ||
} | ||
} | ||
k.PruneAllPrices(ctx) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
Codecov Report
@@ Coverage Diff @@
## main #1724 +/- ##
==========================================
- Coverage 57.65% 57.55% -0.11%
==========================================
Files 74 75 +1
Lines 7912 7925 +13
==========================================
- Hits 4562 4561 -1
- Misses 3000 3014 +14
Partials 350 350
|
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.
Endblocker looks much cleaner now!🔥