Skip to content
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

Merged
merged 5 commits into from
Jan 19, 2023
Merged

Conversation

zarazan
Copy link
Contributor

@zarazan 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

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@@ -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

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
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

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@@ -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

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}
}
}
k.PruneAllPrices(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2023

Codecov Report

Merging #1724 (2ec415a) into main (13c2a19) will decrease coverage by 0.11%.
The diff coverage is 35.71%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
x/oracle/genesis.go 4.71% <0.00%> (+0.65%) ⬆️
x/oracle/keeper/end_blocker.go 0.00% <0.00%> (ø)
x/oracle/types/price.go 0.00% <0.00%> (ø)
x/oracle/keeper/genesis.go 80.88% <66.66%> (-6.36%) ⬇️
x/oracle/abci.go 81.05% <80.00%> (-1.97%) ⬇️
x/oracle/keeper/grpc_query.go 91.75% <100.00%> (-0.18%) ⬇️

@zarazan zarazan marked this pull request as ready for review January 19, 2023 15:29
@zarazan zarazan requested a review from a team as a code owner January 19, 2023 15:29
Copy link
Contributor

@rbajollari rbajollari left a 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!🔥

@zarazan zarazan merged commit 38c2d04 into main Jan 19, 2023
@zarazan zarazan deleted the zarazan/abci-test branch January 19, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants