Sponsored Content
Skip to content

refactor: Fix sfGeneric and sfInvalid field names - #7300

Merged
bthomee merged 2 commits into
developfrom
mvadari/fix-sfs
May 20, 2026
Merged

refactor: Fix sfGeneric and sfInvalid field names#7300
bthomee merged 2 commits into
developfrom
mvadari/fix-sfs

Conversation

@mvadari

@mvadari mvadari commented May 20, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR re-renames the kSfGeneric and kSfInvalid fields back to sfGeneric and sfInvalid.

Context of Change

#7120 renamed them

API Impact

N/A

@mvadari
mvadari requested review from Copilot and godexsoft May 20, 2026 17:02
@mvadari mvadari added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label May 20, 2026

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues.

Review by Claude Opus 4.6 · Prompt: V15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR reverts the special SField globals kSfGeneric/kSfInvalid back to their historical names sfGeneric/sfInvalid, updating all internal call sites accordingly.

Changes:

  • Rename all usages of kSfGenericsfGeneric and kSfInvalidsfInvalid across core code and tests.
  • Update SField definitions and SField::getField(...) fallbacks to return sfInvalid.
  • Update public header declarations (and STBlob default parameter) to use sfGeneric/sfInvalid.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/xrpld/rpc/handlers/transaction/Simulate.cpp Uses sfGeneric when deserializing tx blob into an STObject.
src/tests/libxrpl/protocol_autogen/TestHelpers.h Updates autogen test helper to construct STObject{sfGeneric}.
src/test/rpc/Simulate_test.cpp Updates simulate RPC tests to deserialize with sfGeneric.
src/test/protocol/STTx_test.cpp Updates test-created STObject to use sfGeneric.
src/test/protocol/STObject_test.cpp Updates tests to reference sfGeneric/sfInvalid.
src/test/protocol/STAmount_test.cpp Updates STAmount deserialization to use sfGeneric.
src/test/protocol/Hooks_test.cpp Updates dummy STObject creation to use sfGeneric.
src/test/overlay/compression_test.cpp Updates STObject creation to use sfGeneric.
src/test/jtx/TrustedPublisherServer.h Updates manifest-ish object construction to use sfGeneric.
src/test/jtx/impl/TestHelpers.cpp Updates amountFromJson calls to use sfGeneric.
src/test/app/ValidatorList_test.cpp Updates validator list object construction to use sfGeneric.
src/test/app/Path_test.cpp Updates amountFromJson calls to use sfGeneric.
src/test/app/Manifest_test.cpp Updates manifest-related object construction to use sfGeneric.
src/libxrpl/server/Manifest.cpp Uses sfGeneric for manifest deserialization and hashing/verification helpers.
src/libxrpl/protocol/XChainAttestations.cpp Uses sfGeneric for attestation message STObject construction.
src/libxrpl/protocol/STParsedJSON.cpp Updates comparisons/entrypoints to use sfGeneric/sfInvalid.
src/libxrpl/protocol/STBase.cpp Sets default STBase field name pointer to sfGeneric.
src/libxrpl/protocol/STAmount.cpp Updates amountFromJsonNoThrow to call amountFromJson(sfGeneric, ...).
src/libxrpl/protocol/SField.cpp Renames the special global SField instances and updates invalid-field fallbacks.
include/xrpl/protocol/STBlob.h Changes default SerialIter ctor param from kSfGeneric to sfGeneric.
include/xrpl/protocol/SField.h Exports sfInvalid/sfGeneric instead of kSfInvalid/kSfGeneric.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to +57
SField const sfInvalid(access, -1, "");
SField const sfGeneric(access, 0, "Generic");
Comment on lines 366 to +369
#define TYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SF_##stiSuffix const sfName;

extern SField const kSfInvalid;
extern SField const kSfGeneric;
extern SField const sfInvalid; // NOLINT(readability-identifier-naming)
extern SField const sfGeneric; // NOLINT(readability-identifier-naming)

@godexsoft godexsoft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for changing them back. We should maybe change them all to what clang-tidy dictates in the future. I did not do it because of python scripts using them iirc.. but we can make it all work later on 👍

@mvadari

mvadari commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for changing them back. We should maybe change them all to what clang-tidy dictates in the future. I did not do it because of python scripts using them iirc.. but we can make it all work later on 👍

I mostly care about consistency across all sfields, we should change them all of we want to change them.

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.1%. Comparing base (93ac1aa) to head (73b2aab).

Files with missing lines Patch % Lines
src/libxrpl/server/Manifest.cpp 80.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #7300     +/-   ##
=========================================
- Coverage     82.1%   82.1%   -0.0%     
=========================================
  Files         1010    1010             
  Lines        76167   76167             
  Branches      7423    7413     -10     
=========================================
- Hits         62514   62506      -8     
- Misses       13653   13661      +8     
Files with missing lines Coverage Δ
include/xrpl/protocol/SField.h 100.0% <ø> (ø)
include/xrpl/protocol/STBlob.h 100.0% <ø> (ø)
src/libxrpl/protocol/SField.cpp 83.0% <100.0%> (ø)
src/libxrpl/protocol/STAmount.cpp 88.7% <100.0%> (ø)
src/libxrpl/protocol/STBase.cpp 91.5% <100.0%> (ø)
src/libxrpl/protocol/STParsedJSON.cpp 89.9% <100.0%> (ø)
src/libxrpl/protocol/XChainAttestations.cpp 47.0% <100.0%> (ø)
src/xrpld/rpc/handlers/transaction/Simulate.cpp 100.0% <100.0%> (ø)
src/libxrpl/server/Manifest.cpp 85.7% <80.0%> (ø)

... and 6 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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 May 20, 2026
@bthomee
bthomee added this pull request to the merge queue May 20, 2026
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
Merged via the queue into develop with commit 242ce3e May 20, 2026
3 checks passed
@bthomee
bthomee deleted the mvadari/fix-sfs branch May 20, 2026 20:51
Kassaking7 pushed a commit to Kassaking7/rippled that referenced this pull request Jun 2, 2026
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. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants