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 Oracle's token pair deterministic order #5021

Merged
merged 1 commit into from
May 20, 2024

Conversation

gregtatcam
Copy link
Collaborator

High Level Overview of Change

Price Oracle data-series logic uses unordered_map to update the Oracle object. This results in different servers disagreeing on the order of that hash table. Consequently, the generated ledgers will have different hashes. The fix uses map instead to guarantee the order of the token pairs in the data-series.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

Price Oracle data-series logic uses `unordered_map` to update the Oracle object.
This results in different servers disagreeing on the order of that hash table.
Consequently, the generated ledgers will have different hashes.
The fix uses `map` instead to guarantee the order of the token pairs
in the data-series.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.1%. Comparing base (d5e5c3c) to head (cecfdee).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #5021   +/-   ##
=======================================
  Coverage     71.1%   71.1%           
=======================================
  Files          796     796           
  Lines        66997   66997           
  Branches     10982   10979    -3     
=======================================
  Hits         47635   47635           
  Misses       19362   19362           
Files Coverage Δ
src/ripple/app/tx/impl/SetOracle.cpp 100.0% <100.0%> (ø)

... and 3 files with indirect coverage changes

Impacted file tree graph

Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

Fix looks good to me. The fix builds, passes unit tests, syncs, and stops for me on macOS. 👍

@seelabs seelabs merged commit f2d37da into XRPLF:develop May 20, 2024
17 checks passed
@seelabs seelabs mentioned this pull request May 20, 2024
1 task
sophiax851 pushed a commit to sophiax851/rippled that referenced this pull request Jun 12, 2024
Price Oracle data-series logic uses `unordered_map` to update the Oracle object.
This results in different servers disagreeing on the order of that hash table.
Consequently, the generated ledgers will have different hashes.
The fix uses `map` instead to guarantee the order of the token pairs
in the data-series.
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.

4 participants