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

Expose all amendments known by libxrpl #5026

Merged
merged 6 commits into from
Jun 14, 2024

Conversation

godexsoft
Copy link
Collaborator

@godexsoft godexsoft commented May 22, 2024

High Level Overview of Change

There is no way for consumers like Clio to get all known amendments/features thru libxrpl.
This PR adds a public function to do just that as well as some tests for it.

Please note that this adds only what is needed for Clio and nothing more. If there is desire to expose the raw VoteBehavior it can be added. Let me know.

Context of Change

Clio needs the ability to get all known amendments in order to implement the feature API (non-admin part).

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)

API Impact

None.

enum class AmendmentSupport : int { Retired = -1, Supported = 0, Unsupported };

/** All amendments libxrpl knows about. */
std::unordered_map<std::string, AmendmentSupport> const&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that i used unordered_map here because for Clio's usecase the order is not important.
But i'm now thinking that perhaps there will be a usecase in the future where it could come in handy if the names came out sorted. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

From a cost/benefit perspective, it's hard for me to imagine that the perf degradation of using a sorted map would be significant for amendments. It's O(log n) versus O(1) and n is small, maybe < 100, and certainly < 1000. So yes, I think it would be nice for the names to come out sorted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. After sleeping on it I also think it's better to keep the API similar to what it was, so definitely changing this back to match.

@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.3%. Comparing base (ae7ea33) to head (9a56122).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #5026   +/-   ##
=======================================
  Coverage     71.3%   71.3%           
=======================================
  Files          796     796           
  Lines        66887   66900   +13     
  Branches     10867   10866    -1     
=======================================
+ Hits         47690   47705   +15     
+ Misses       19197   19195    -2     
Files Coverage Δ
src/ripple/protocol/Feature.h 100.0% <ø> (ø)
src/ripple/protocol/impl/Feature.cpp 94.6% <100.0%> (+0.7%) ⬆️

... and 1 file with indirect coverage changes

Impacted file tree graph

@godexsoft godexsoft marked this pull request as ready for review May 23, 2024 16:58
@godexsoft godexsoft requested a review from intelliot May 28, 2024 11:00
Copy link
Collaborator

@intelliot intelliot left a comment

Choose a reason for hiding this comment

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

Untested; LGTM

@seelabs seelabs self-requested a review June 14, 2024 15:25
@seelabs seelabs merged commit 20d0549 into XRPLF:develop Jun 14, 2024
19 checks passed
@seelabs seelabs mentioned this pull request Jun 20, 2024
1 task
ximinez added a commit to ximinez/rippled that referenced this pull request Jul 1, 2024
* upstream/develop: (32 commits)
  fixInnerObjTemplate2 amendment (XRPLF#5047)
  Set version to 2.3.0-b1
  Ignore restructuring commits (XRPLF#4997)
  Recompute loops (XRPLF#4997)
  Rewrite includes (XRPLF#4997)
  Rearrange sources (XRPLF#4997)
  Move CMake directory (XRPLF#4997)
  Add bin/physical.sh (XRPLF#4997)
  Prepare to rearrange sources: (XRPLF#4997)
  Change order of checks in amm_info: (XRPLF#4924)
  Add the fixEnforceNFTokenTrustline amendment: (XRPLF#4946)
  Replaces the usage of boost::string_view with std::string_view (XRPLF#4509)
  docs: explain how to find a clang-format patch generated by CI (XRPLF#4521)
  XLS-52d: NFTokenMintOffer (XRPLF#4845)
  chore: remove repeat words (XRPLF#5041)
  Expose all amendments known by libxrpl (XRPLF#5026)
  fixReducedOffersV2: prevent offers from blocking order books: (XRPLF#5032)
  Additional unit tests for testing deletion of trust lines (XRPLF#4886)
  Fix conan typo: (XRPLF#5044)
  Add new command line option to make replaying transactions easier: (XRPLF#5027)
  ...
vlntb pushed a commit to vlntb/rippled that referenced this pull request Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚢 Released in 2.2.0
Development

Successfully merging this pull request may close these issues.

4 participants