XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.48k stars 1.44k forks source link

Fix Oracle's token pair deterministic order #5021

Closed gregtatcam closed 1 month ago

gregtatcam commented 1 month ago

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

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/XRPLF/rippled/pull/5021/graphs/tree.svg?width=650&height=150&src=pr&token=i2RPGI5xGF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)](https://app.codecov.io/gh/XRPLF/rippled/pull/5021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) ```diff @@ 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](https://app.codecov.io/gh/XRPLF/rippled/pull/5021?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) | Coverage Δ | | |---|---|---| | [src/ripple/app/tx/impl/SetOracle.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5021?src=pr&el=tree&filepath=src%2Fripple%2Fapp%2Ftx%2Fimpl%2FSetOracle.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL3JpcHBsZS9hcHAvdHgvaW1wbC9TZXRPcmFjbGUuY3Bw) | `100.0% <100.0%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/XRPLF/rippled/pull/5021/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) [![Impacted file tree graph](https://app.codecov.io/gh/XRPLF/rippled/pull/5021/graphs/tree.svg?width=650&height=150&src=pr&token=i2RPGI5xGF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)](https://app.codecov.io/gh/XRPLF/rippled/pull/5021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)