8000 refactor: add `rpcName` to `LEDGER_ENTRY` macro by mvadari · Pull Request #5202 · XRPLF/rippled · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: add rpcName to LEDGER_ENTRY macro #5202

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

Merged
merged 11 commits into from
Jan 2, 2025

Conversation

mvadari
Copy link
Collaborator
@mvadari mvadari commented Nov 22, 2024

High Level Overview of Change

The new LEDGER_ENTRY macro now takes one additional parameter, rpcName. This makes it easier to avoid missing including the new field in jss.h and to the list of account_objects/ledger_data filters.

Context of Change

Prevent easy bugs.

Type of Change

  • Refactor (non-breaking change that only restructures code)

API Impact

No change to the user.

Test Plan

All tests still pass.

Copy link
codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.8%. Comparing base (49e0d54) to head (a1a203d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5202     +/-   ##
=========================================
- Coverage     77.9%   77.8%   -0.1%     
=========================================
  Files          783     783             
  Lines        66707   66707             
  Branches      8140    8139      -1     
=========================================
- Hits         51964   51929     -35     
- Misses       14743   14778     +35     
Files with missing lines Coverage Δ
include/xrpl/protocol/detail/ledger_entries.macro 100.0% <100.0%> (ø)
src/libxrpl/protocol/LedgerFormats.cpp 100.0% <ø> (ø)
src/xrpld/rpc/detail/RPCHelpers.cpp 82.8% <ø> (ø)

... and 10 files with indirect coverage changes

Impacted file tree graph

@mvadari
Copy link
Collaborator Author
mvadari commented Dec 2, 2024

Looks like Windows tests are failing. I'm not sure how to resolve that.

Comment on lines 701 to 717
#pragma push_macro("LEDGER_ENTRY")
#pragma push_macro("LEDGER_ENTRY_DUPLICATE")
#undef LEDGER_ENTRY
#undef LEDGER_ENTRY_DUPLICATE

#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
JSS(name); \
JSS(rpcName);

#define LEDGER_ENTRY_DUPLICATE(tag, value, name, rpcName, fields) JSS(rpcName);

#include <xrpl/protocol/detail/ledger_entries.macro>

#undef LEDGER_ENTRY
#undef LEDGER_ENTRY_DUPLICATE
#pragma pop_macro("LEDGER_ENTRY")
#pragma pop_macro("LEDGER_ENTRY_DUPLICATE")
Copy link
Contributor

Choose a reason for hiding this comment

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

The pattern we're going with is this:

#pragma push_macro
#undef
#pragma push_macro
#undef

#define
#define

#include

#undef
#pragma pop_macro
#undef
#pragma pop_macro

@Bronek feels more strongly about this pattern, but I agree it should be consistent everywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in c7709ff

@thejohnfreeman
Copy link
Contributor

The Windows error is this bug. Below is the fix, to go in ledger_entries.macro:

#ifndef LEDGER_ENTRY_DUPLICATE
#define EXPAND(x) x
#define LEDGER_ENTRY_DUPLICATE(...) EXPAND(LEDGER_ENTRY(__VA_ARGS__))
#endif

...

#undef EXPAND
#undef LEDGER_ENTRY_DUPLICATE

@mvadari mvadari requested a review from godexsoft December 5, 2024 18:49
@mvadari
Copy link
Collaborator Author
mvadari commented Jan 2, 2025

@bthomee this PR is ready to merge

@bthomee bthomee self-requested a review January 2, 2025 16:34
@mvadari mvadari added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Jan 2, 2025
@bthomee bthomee merged commit 679e35f into XRPLF:develop Jan 2, 2025
19 checks passed
ximinez pushed a commit to ximinez/rippled that referenced this pull request Jan 13, 2025
The LEDGER_ENTRY macro now takes an additional parameter, which makes it easier to avoid missing including the new field in jss.h and to the list of account_objects/ledger_data filters.
@mvadari mvadari mentioned this pull request Feb 7, 2025
2 tasks
q73zhao pushed a commit that referenced this pull request Feb 24, 2025
The LEDGER_ENTRY macro now takes an additional parameter, which makes it easier to avoid missing including the new field in jss.h and to the list of account_objects/ledger_data filters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0