-
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
refactor: Update median tracking for historacle pricing #1632
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1632 +/- ##
==========================================
- Coverage 54.22% 54.18% -0.05%
==========================================
Files 72 73 +1
Lines 7454 7547 +93
==========================================
+ Hits 4042 4089 +47
- Misses 3100 3143 +43
- Partials 312 315 +3
|
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.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Need to fix IterateMedians
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.
Great job getting this together! It needed a ton of changes since last time. I think we're almost there, a couple tiny comments from me and some consensus on the iteration method and I think its good.
Co-authored-by: Kyle <zarazan@users.noreply.github.com>
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.
I think @robert-zaremba's concerns are resolved but idk if he wants to take a look before merging.
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.
thanks for fixing the denom prefix for iterations.
- Please verify if these change are in line with the updated: 3909192
@robert-zaremba @zarazan @adamewozniak Updated the keeper methods in the historacle design doc to match the actual implementation in this PR (some of the stuff agreed upon in #1631 wasn't put into the doc). Lmk if anything looks wrong in there. |
this is due to e2e tests failing with a change in the oracle parameters query
note that this PR makes the most updated version of the price feeder incompatible & we'll need to test PF against the release that includes this PR |
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
@@ -63,14 +58,15 @@ | |||
} | |||
|
|||
if experimental { | |||
// Stamp rate every stamp period if asset is set to have historic stats tracked | |||
if isPeriodLastBlock(ctx, params.StampPeriod) && params.HistoricAcceptList.Contains(ballotDenom.Denom) { | |||
if isPeriodLastBlock(ctx, params.HistoricStampPeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
if isPeriodLastBlock(ctx, params.MedianPeriod) && params.HistoricAcceptList.Contains(ballotDenom.Denom) { | ||
k.CalcAndSetMedian(ctx, ballotDenom.Denom) | ||
// Calculate and stamp median/median deviation if median stamp period has passed | ||
if isPeriodLastBlock(ctx, params.MedianStampPeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
k.CalcAndSetMedian(ctx, ballotDenom.Denom) | ||
// Calculate and stamp median/median deviation if median stamp period has passed | ||
if isPeriodLastBlock(ctx, params.MedianStampPeriod) { | ||
if err = k.CalcAndSetHistoricMedian(ctx, ballotDenom.Denom); err != nil { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
k.DeleteHistoricPrice(ctx, v.String(), pruneBlock) | ||
// Prune historic prices and medians outside pruning period determined by | ||
// the stamp period multiplied by the max stamps. | ||
if experimental && isPeriodLastBlock(ctx, params.HistoricStampPeriod) { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
pruneHistoricPeriod := params.HistoricStampPeriod*(params.MaximumPriceStamps) - params.VotePeriod | ||
pruneMedianPeriod := params.MedianStampPeriod*(params.MaximumMedianStamps) - params.VotePeriod | ||
for _, v := range params.AcceptList { | ||
k.DeleteHistoricPrice(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneHistoricPeriod) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
pruneMedianPeriod := params.MedianStampPeriod*(params.MaximumMedianStamps) - params.VotePeriod | ||
for _, v := range params.AcceptList { | ||
k.DeleteHistoricPrice(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneHistoricPeriod) | ||
k.DeleteHistoricMedian(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneMedianPeriod) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
for _, v := range params.AcceptList { | ||
k.DeleteHistoricPrice(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneHistoricPeriod) | ||
k.DeleteHistoricMedian(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneMedianPeriod) | ||
k.DeleteHistoricMedianDeviation(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneMedianPeriod) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
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.
utACK. Thanks for keeping improving the PR.
Note: be sure to run In this case, there's a little whitespace that gets changed by |
Description
closes: #1621
Things that still need to be done after this PR:
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...