refactor: Update median tracking for historacle pricing#1632
refactor: Update median tracking for historacle pricing#1632rbajollari merged 32 commits intomainfrom
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.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
robert-zaremba
left a comment
There was a problem hiding this comment.
Need to fix IterateMedians
zarazan
left a comment
There was a problem hiding this comment.
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>
zarazan
left a comment
There was a problem hiding this comment.
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.
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>
| if isPeriodLastBlock(ctx, params.StampPeriod) && params.HistoricAcceptList.Contains(ballotDenom.Denom) { | ||
| if isPeriodLastBlock(ctx, params.HistoricStampPeriod) { | ||
| k.AddHistoricPrice(ctx, ballotDenom.Denom, exchangeRate) | ||
| } |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| // 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 { | ||
| return err |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
| if isPeriodLastBlock(ctx, params.MedianStampPeriod) { | ||
| if err = k.CalcAndSetHistoricMedian(ctx, ballotDenom.Denom); err != nil { | ||
| return err | ||
| } |
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
| k.DeleteHistoricMedianDeviation(ctx, v.SymbolDenom, uint64(ctx.BlockHeight())-pruneMedianPeriod) | ||
| } | ||
| } | ||
|
|
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
x/oracle/abci.go
Outdated
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
x/oracle/abci.go
Outdated
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
robert-zaremba
left a comment
There was a problem hiding this comment.
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.mdReviewers 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...