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

fix: metoken medians #2346

Merged
merged 5 commits into from
Dec 1, 2023
Merged

fix: metoken medians #2346

merged 5 commits into from
Dec 1, 2023

Conversation

adamewozniak
Copy link
Collaborator

@adamewozniak adamewozniak commented Dec 1, 2023

Description

Fixes an issue where metokens weren't included in historic oracle data since they are not voted on by validators.
This moves the historic price stamps / medians out of the block that is looping through ballots and into a new block that loops through all active exchange rates.


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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features

    • Enhanced the price calculation process to include all exchange rates during historic data analysis.
  • Bug Fixes

    • Resolved an issue to ensure metokens are now correctly factored into historic data calculations.
  • Refactor

    • Improved the logic for determining historic median prices and deviations to be more comprehensive and accurate.

Copy link
Contributor

coderabbitai bot commented Dec 1, 2023

Walkthrough

The CalcPrices function within the x/oracle/abci.go file has been enhanced to better handle historic data. It now iterates through exchange rates, adding historic prices for each rate and recalculating the historic median and median deviation accordingly. These changes ensure more comprehensive and accurate historic data without altering any external interfaces or expected behaviors.

Changes

File Path Change Summary
x/oracle/abci.go Updated CalcPrices to iterate through exchange rates for adding historic prices and calculating median/median deviation.
CHANGELOG.md Documented the fix for metokens not being included in historic data.

Poem

🐇
In the realm of code, where data streams flow,
A rabbit hopped in, making historic prices grow.
Through rates it danced, with a median in sight,
Fixing the past, with each commit so bright.
🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

x/oracle/abci.go Outdated Show resolved Hide resolved
@adamewozniak adamewozniak marked this pull request as ready for review December 1, 2023 21:19
@adamewozniak adamewozniak requested a review from a team as a code owner December 1, 2023 21:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7a8cdfa and b6b195d.
Files selected for processing (1)
  • x/oracle/abci.go (1 hunks)
Additional comments: 1
x/oracle/abci.go (1)
  • 82-99: The changes made to the CalcPrices function align with the PR objective and the generated summary. The code now ensures that historical price data is captured for all active exchange rates, including those without validator votes. The logic for calculating and setting historic median/median deviation has been updated accordingly. No issues with function signatures, global data structures, or global variables have been introduced, and there is no impact on interfaces, return values, or thrown exceptions. The changes are confined to the internal logic of the CalcPrices function.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Merging #2346 (b1bc163) into main (7f05ad4) will decrease coverage by 5.21%.
Report is 309 commits behind head on main.
The diff coverage is 66.08%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2346      +/-   ##
==========================================
- Coverage   75.38%   70.18%   -5.21%     
==========================================
  Files         100      170      +70     
  Lines        8025    12657    +4632     
==========================================
+ Hits         6050     8883    +2833     
- Misses       1589     3169    +1580     
- Partials      386      605     +219     
Files Coverage Δ
ante/ante.go 66.66% <100.00%> (+18.45%) ⬆️
ante/fee.go 80.00% <100.00%> (+1.64%) ⬆️
ante/spam_prevention.go 75.92% <ø> (ø)
app/inflation/inflation.go 100.00% <100.00%> (ø)
app/upgradev3/migrations.go 84.21% <ø> (+5.94%) ⬆️
util/coin/utoken.go 100.00% <100.00%> (ø)
util/ibc/ibc.go 58.82% <ø> (ø)
util/sdkutil/events.go 0.00% <ø> (ø)
util/store/store.go 52.06% <ø> (+10.65%) ⬆️
util/store/unmarshal.go 42.85% <ø> (ø)
... and 40 more

... and 103 files with indirect coverage changes

Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. Please add a changelog entry (under v6.2)

x/oracle/abci.go Outdated Show resolved Hide resolved
x/oracle/abci.go Outdated Show resolved Hide resolved
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b6b195d and 9fc1017.
Files selected for processing (1)
  • x/oracle/abci.go (1 hunks)

x/oracle/abci.go Outdated Show resolved Hide resolved
x/oracle/abci.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9fc1017 and e901963.
Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • x/oracle/abci.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/oracle/abci.go
Additional comments: 1
CHANGELOG.md (1)
  • 53-54: The changelog entry for PR 2346 correctly documents the fix for the issue where metokens were not included in historic data.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e901963 and b1bc163.
Files selected for processing (1)
  • x/oracle/abci.go (1 hunks)
Additional comments: 1
x/oracle/abci.go (1)
  • 77-98: The changes made to the CalcPrices function align with the PR objective and the provided summary. The logic for recording historical price stamps and medians has been successfully separated from the ballot processing loop and is now iterating through all active exchange rates, ensuring that metokens are included in the historical data. This refactoring should improve the accuracy and reliability of the historical oracle data in the Umee blockchain.

@adamewozniak adamewozniak added this pull request to the merge queue Dec 1, 2023
Merged via the queue into main with commit fba6dec Dec 1, 2023
26 of 28 checks passed
@adamewozniak adamewozniak deleted the woz/fix-no-metoken-medians branch December 1, 2023 22:42
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.

2 participants