-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/mpt v1 -testingcoderabbit #4
base: develop
Are you sure you want to change the base?
Conversation
New Transactions: - MPTokenIssuanceCreate - MPTokenIssuanceDestory - MPTokenIssuanceSet - MPTokenAuthorize Modified Transactions: - Payment - Clawback New Objects: - MPTokenIssuance - MPTokenAuthorize API updates: - ledger_entry - account_objects - ledger_data Read full spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033d-multi-purpose-tokens --------- Co-authored-by: Shawn Xie <shawnxie920@gmail.com> Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com>
* add issuance not found code * add issuance check to start of func * uses `exists()`
* fix maximum amt * add if check to return tecMPT_ISSUANCE_NOT_FOUND
Note Currently processing new changes in this PR. This may take a few minutes, please wait... Files ignored due to path filters (77)
Files selected for processing (48)
WalkthroughThe changes introduce a comprehensive update to the XRPL protocol, enhancing its capabilities with the addition of multi-party tokens (MPT). Key modifications include new classes for handling MPT amounts and issuances, updates to existing classes to support flexible amount representations, and the introduction of new transaction types and flags related to MPT functionalities. Configuration files have also been updated to streamline code reviews and automated checks, ensuring better code quality and communication within development teams. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant CI/CD
participant CodeReviewTool
participant ProjectManagementTool
Developer->>CodeReviewTool: Submit code changes
CodeReviewTool->>CI/CD: Trigger automated checks
CI/CD->>CodeReviewTool: Run linting and analysis tools
CodeReviewTool->>ProjectManagementTool: Update issue tracking
ProjectManagementTool->>Developer: Notify review status
Tip You can generate walkthrough in a markdown collapsible section to save space.Enable the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@coderabbitai configuration |
CodeRabbit configurationlanguage: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
auto_title_placeholder: '@coderabbitai'
review_status: true
poem: true
collapse_walkthrough: false
sequence_diagrams: true
labeling_instructions: []
path_filters: []
path_instructions: []
abort_on_close: true
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
tools:
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_only: false
level: default
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
rubocop:
enabled: true
buf:
enabled: true
regal:
enabled: true
actionlint:
enabled: true
pmd:
enabled: true
cppcheck:
enabled: true
chat:
auto_reply: true
knowledge_base:
opt_out: false
learnings:
scope: auto
issues:
scope: auto
jira:
project_keys: []
linear:
team_keys: []
pull_requests:
scope: auto
|
@coderabbitai full review |
Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Outside diff range and nitpick comments (5)
.coderabbit.yml (3)
1-2
: Consider providing tone instructions for better customization.Setting the language to
en-US
is a good practice for consistency. However, thetone_instructions
field is empty. Consider providing specific instructions to customize the AI's tone to better suit your project's needs.
5-29
: Review settings are mostly good, but consider a stricter review profile if needed.The enabled review features, such as high-level summaries, auto titles, review status, poems, and sequence diagrams, provide useful enhancements to the review process.
The path filters help focus the reviews on the most relevant files by excluding less important ones, which is a good practice.
Enabling auto-review with incremental reviews helps streamline the review process, which is beneficial.
However, the "chill" review profile indicates a more lenient review style. Depending on your project's needs, consider using a stricter profile to ensure thorough reviews.
76-89
: Chat and knowledge base settings are good, but complete the Jira and Linear integration.Enabling auto-reply for chat can help provide quick responses to common questions or issues, which is a useful feature.
Enabling the knowledge base with automatic scope for learnings, issues, and pull requests allows the AI to continuously learn and improve from the project's data, which is a great way to leverage the AI's capabilities.
Configuring integration with Jira and Linear is a good step towards better project management. However, the
project_keys
andteam_keys
fields are empty, indicating that the integration is not fully set up yet. To complete the integration, provide the necessary keys for your Jira and Linear projects.include/xrpl/basics/MPTAmount.h (1)
155-181
: LGTM, but consider adding a test case!The
mulRatio
function is well-implemented and handles the multiplication of anMPTAmount
by a ratio correctly. The use ofboost::multiprecision::int128_t
for intermediate calculations is a good choice to avoid overflow. The function also properly checks for division by zero and overflow, throwing exceptions in those cases.Consider adding a test case to verify the behavior of the overflow check, ensuring that an exception is thrown when the result exceeds the maximum value of
MPTAmount
.include/xrpl/protocol/STAmount.h (1)
450-452
: Nice addition of theoperator<<
overload for improved usability.The new
operator<<
overload forSTAmount
enhances the usability of the class by allowing output toostream
. This change improves the logging and debugging capabilities of the class, making it easier to inspectSTAmount
instances.Please provide more information on how the output is formatted in the
operator<<
implementation to ensure that it provides meaningful and readable information.Consider adding a code comment or documentation describing the expected output format of the
operator<<
overload for clarity.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (77)
Builds/levelization/results/loops.txt
is excluded by!**/*.txt
src/test/app/AMMExtended_test.cpp
is excluded by!src/test/**
src/test/app/Check_test.cpp
is excluded by!src/test/**
src/test/app/Clawback_test.cpp
is excluded by!src/test/**
src/test/app/Flow_test.cpp
is excluded by!src/test/**
src/test/app/MPToken_test.cpp
is excluded by!src/test/**
src/test/app/Offer_test.cpp
is excluded by!src/test/**
src/test/app/Path_test.cpp
is excluded by!src/test/**
src/test/app/PayChan_test.cpp
is excluded by!src/test/**
src/test/app/TheoreticalQuality_test.cpp
is excluded by!src/test/**
src/test/app/XChain_test.cpp
is excluded by!src/test/**
src/test/jtx.h
is excluded by!src/test/**
src/test/jtx/Env.h
is excluded by!src/test/**
src/test/jtx/amount.h
is excluded by!src/test/**
src/test/jtx/attester.h
is excluded by!src/test/**
src/test/jtx/delivermin.h
is excluded by!src/test/**
src/test/jtx/impl/AMMTest.cpp
is excluded by!src/test/**
src/test/jtx/impl/amount.cpp
is excluded by!src/test/**
src/test/jtx/impl/attester.cpp
is excluded by!src/test/**
src/test/jtx/impl/envconfig.cpp
is excluded by!src/test/**
src/test/jtx/impl/mpt.cpp
is excluded by!src/test/**
src/test/jtx/impl/offer.cpp
is excluded by!src/test/**
src/test/jtx/impl/paths.cpp
is excluded by!src/test/**
src/test/jtx/impl/trust.cpp
is excluded by!src/test/**
src/test/jtx/impl/xchain_bridge.cpp
is excluded by!src/test/**
src/test/jtx/mpt.h
is excluded by!src/test/**
src/test/jtx/offer.h
is excluded by!src/test/**
src/test/jtx/sendmax.h
is excluded by!src/test/**
src/test/jtx/trust.h
is excluded by!src/test/**
src/test/jtx/xchain_bridge.h
is excluded by!src/test/**
src/test/protocol/STAmount_test.cpp
is excluded by!src/test/**
src/test/protocol/STObject_test.cpp
is excluded by!src/test/**
src/test/protocol/STTx_test.cpp
is excluded by!src/test/**
src/test/rpc/AccountSet_test.cpp
is excluded by!src/test/**
src/xrpld/app/ledger/detail/LedgerToJson.cpp
is excluded by!src/xrpld/**
src/xrpld/app/misc/NetworkOPs.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/AMMCreate.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/AMMDeposit.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/AMMWithdraw.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/CashCheck.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/Clawback.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/Escrow.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/InvariantCheck.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/InvariantCheck.h
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenAuthorize.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenAuthorize.h
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/MPTokenIssuanceSet.h
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/NFTokenMint.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/NFTokenUtils.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/PayChan.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/Payment.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/SetTrust.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/Transactor.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/XChainBridge.cpp
is excluded by!src/xrpld/**
src/xrpld/app/tx/detail/applySteps.cpp
is excluded by!src/xrpld/**
src/xrpld/ledger/View.h
is excluded by!src/xrpld/**
src/xrpld/ledger/detail/View.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/DeliveredAmount.h
is excluded by!src/xrpld/**
src/xrpld/rpc/MPTokenIssuanceID.h
is excluded by!src/xrpld/**
src/xrpld/rpc/detail/DeliveredAmount.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/detail/MPTokenIssuanceID.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/detail/RPCHelpers.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/detail/TransactionSign.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/detail/Tuning.h
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/AccountObjects.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/AccountTx.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/Handlers.h
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/LedgerData.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/LedgerEntry.cpp
is excluded by!src/xrpld/**
src/xrpld/rpc/handlers/Tx.cpp
is excluded by!src/xrpld/**
Files selected for processing (48)
- .coderabbit.yml (1 hunks)
- include/xrpl/basics/MPTAmount.h (1 hunks)
- include/xrpl/basics/Number.h (4 hunks)
- include/xrpl/basics/base_uint.h (2 hunks)
- include/xrpl/protocol/Feature.h (2 hunks)
- include/xrpl/protocol/Indexes.h (2 hunks)
- include/xrpl/protocol/Issue.h (1 hunks)
- include/xrpl/protocol/LedgerFormats.h (2 hunks)
- include/xrpl/protocol/MPTIssue.h (1 hunks)
- include/xrpl/protocol/Protocol.h (1 hunks)
- include/xrpl/protocol/Rate.h (2 hunks)
- include/xrpl/protocol/SField.h (10 hunks)
- include/xrpl/protocol/SOTemplate.h (5 hunks)
- include/xrpl/protocol/STAmount.h (5 hunks)
- include/xrpl/protocol/STBitString.h (2 hunks)
- include/xrpl/protocol/STEitherAmount.h (1 hunks)
- include/xrpl/protocol/STMPTAmount.h (1 hunks)
- include/xrpl/protocol/STObject.h (26 hunks)
- include/xrpl/protocol/Serializer.h (2 hunks)
- include/xrpl/protocol/TER.h (3 hunks)
- include/xrpl/protocol/TxFlags.h (3 hunks)
- include/xrpl/protocol/TxFormats.h (1 hunks)
- include/xrpl/protocol/TxMeta.h (2 hunks)
- include/xrpl/protocol/UintTypes.h (2 hunks)
- include/xrpl/protocol/XChainAttestations.h (2 hunks)
- include/xrpl/protocol/jss.h (4 hunks)
- src/libxrpl/basics/MPTAmount.cpp (1 hunks)
- src/libxrpl/basics/Number.cpp (1 hunks)
- src/libxrpl/protocol/Feature.cpp (1 hunks)
- src/libxrpl/protocol/Indexes.cpp (3 hunks)
- src/libxrpl/protocol/Issue.cpp (1 hunks)
- src/libxrpl/protocol/LedgerFormats.cpp (1 hunks)
- src/libxrpl/protocol/MPTIssue.cpp (1 hunks)
- src/libxrpl/protocol/Rate2.cpp (1 hunks)
- src/libxrpl/protocol/SField.cpp (7 hunks)
- src/libxrpl/protocol/STAmount.cpp (9 hunks)
- src/libxrpl/protocol/STEitherAmount.cpp (1 hunks)
- src/libxrpl/protocol/STMPTAmount.cpp (1 hunks)
- src/libxrpl/protocol/STObject.cpp (3 hunks)
- src/libxrpl/protocol/STParsedJSON.cpp (2 hunks)
- src/libxrpl/protocol/STTx.cpp (2 hunks)
- src/libxrpl/protocol/STVar.cpp (2 hunks)
- src/libxrpl/protocol/Serializer.cpp (1 hunks)
- src/libxrpl/protocol/TER.cpp (3 hunks)
- src/libxrpl/protocol/TxFormats.cpp (3 hunks)
- src/libxrpl/protocol/TxMeta.cpp (1 hunks)
- src/libxrpl/protocol/UintTypes.cpp (2 hunks)
- src/libxrpl/protocol/XChainAttestations.cpp (11 hunks)
Additional comments not posted (193)
src/libxrpl/protocol/MPTIssue.cpp (5)
26-28
: LGTM!The
MPTIssue
class declaration and constructor look good. The class encapsulates anMPTID
and initializes it through the constructor.
30-41
: LGTM!The
getIssuer()
function correctly extracts the issuer's account ID from theMPTID
by copying the relevant data while skipping the sequence portion of the ID.
43-47
: LGTM!The
getMptID()
function correctly returns a constant reference to theMPTID
associated with the instance, ensuring that the caller cannot modify theMPTID
.
49-55
: LGTM!The
to_json()
function correctly converts anMPTIssue
object into a JSON representation by setting thempt_issuance_id
field with the string representation of theMPTID
.
24-57
: LGTM!The code is correctly wrapped within the
ripple
namespace to encapsulate theMPTIssue
class and related functions, helping to avoid naming conflicts with other code..coderabbit.yml (2)
3-4
: Access and tier settings look good!Disabling
early_access
ensures using stable AI features. Enablingenable_free_tier
allows using the AI without a paid subscription, which is suitable for many projects.
29-75
: Great selection of tools! Remember to keep them updated.Enabling a wide range of linting and analysis tools, such as ShellCheck, Ruff, MarkdownLint, ESLint, RuboCop, and others, helps ensure code quality and consistency across different languages and aspects of the project, which is a great practice.
Customizing settings for some tools, like the timeout for GitHub Checks and levels for LanguageTool and PHPStan, allows fine-tuning their behavior to suit the project's needs.
To make the most out of these tools, remember to regularly update them to use their latest versions and features.
include/xrpl/protocol/MPTIssue.h (3)
28-49
: LGTM!The
MPTIssue
class is well-defined and encapsulates the necessary components for representing an MPT issue. The private member variable, constructors, and public member functions are appropriately designed to handle the MPT issue data.
51-55
: LGTM!The equality operator is correctly implemented to compare two
MPTIssue
instances based on theirmptID_
member. The use ofconstexpr
is appropriate for this simple comparison function.
57-61
: LGTM!The inequality operator is correctly implemented to compare two
MPTIssue
instances based on theirmptID_
member. It leverages the equality operator and negates the result, which is a common and efficient approach.src/libxrpl/basics/MPTAmount.cpp (8)
24-29
: LGTM!The
operator+=
implementation is correct and follows the expected behavior of modifying the current object and returning a reference to allow chaining.
31-36
: LGTM!The
operator-=
implementation is correct and follows the expected behavior of modifying the current object and returning a reference to allow chaining.
38-42
: LGTM!The unary
operator-
implementation is correct and follows the expected behavior of returning a newMPTAmount
object with the negated value.
44-48
: LGTM!The
operator==
implementation is correct and follows the expected behavior of comparing the values of twoMPTAmount
objects and returning a boolean result.
50-54
: LGTM!The
operator==
overload for comparing anMPTAmount
object with a value of the underlying type is correct and follows the expected behavior of comparing the values and returning a boolean result.
56-60
: LGTM!The
operator<
implementation is correct and follows the expected behavior of comparing the values of twoMPTAmount
objects and returning a boolean result indicating whether the current object's value is less than the other object's value.
62-77
: LGTM!The
jsonClipped
function implementation is correct and follows the expected behavior of converting theMPTAmount
value to a JSON-compatible integer. It properly handles cases where the value is outside the range ofJson::Int
by clipping it to the minimum or maximum value. The static assertions ensure that the underlying type is a signed integral type, providing type safety.
79-83
: LGTM!The
minPositiveAmount
static function implementation is correct and follows the expected behavior of returning anMPTAmount
object with a value of 1, representing the minimum positive value.include/xrpl/protocol/Rate.h (2)
24-24
: LGTM!The inclusion of
STMPTAmount.h
is necessary for the newmultiply
function that takesSTMPTAmount
as an argument.
71-72
: Approve implementation, but usage and testing concernsThe implementation of the
multiply
function forSTMPTAmount
insrc/libxrpl/protocol/Rate2.cpp
appears correct and consistent with the declaration. However, there are some concerns:
- No usage of this new function was found in the codebase.
- No specific test files for
STMPTAmount
orRate
were found.Recommendations:
- Add unit tests for the new
multiply
function to ensure its correctness and maintain code quality.- Review the need for this function if it's not currently being used in the codebase.
- Consider adding documentation to explain the purpose and expected usage of this function.
Analysis chain
Verify the usage of the new
multiply
function in the codebase.The new
multiply
function overload forSTMPTAmount
is a crucial addition to support operations involving theSTMPTAmount
type. The function declaration is consistent with the existingmultiply
function forSTAmount
.Please run the following script to verify that the new
multiply
function is being used correctly in the codebase:
To gather more information about the implementation and usage of the new
multiply
function, let's run the following additional scripts:Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new `multiply` function for `STMPTAmount`. # Test 1: Search for the function declaration. # Expect: The function declaration should be found in this file. rg --type cpp -A 5 $'STMPTAmount\nmultiply\(STMPTAmount const& amount, Rate const& rate\);' # Test 2: Search for the function usage. # Expect: The function should be called with `STMPTAmount` and `Rate` arguments. rg --type cpp -A 5 $'multiply\(STMPTAmount'Length of output: 1287
Script:
#!/bin/bash # Description: Further verify the implementation and usage of the new `multiply` function for `STMPTAmount`. # Test 1: Check the implementation of the multiply function rg --type cpp -A 10 'multiply\(STMPTAmount const& amount, Rate const& rate\)' src/libxrpl/protocol/Rate2.cpp # Test 2: Search for potential usage of the function (indirect search) rg --type cpp -A 5 'STMPTAmount.*multiply' # Test 3: Check for test files related to STMPTAmount or Rate fd -e cpp -e h test.*STMPTAmount fd -e cpp -e h test.*RateLength of output: 487
include/xrpl/protocol/Issue.h (1)
49-50
: LGTM!The new
getIssuer
function follows best practices:
- It is marked as
const
since it does not modify the object's state.- It returns a
const&
to avoid unnecessary copying and to indicate that the returned reference cannot be used to modify theaccount
member.This is a straightforward addition of a getter function that improves the class's interface by providing access to the
account
member variable. There are no apparent issues or side effects.src/libxrpl/protocol/Rate2.cpp (1)
57-68
: LGTM!The new
multiply
function forSTMPTAmount
types is implemented correctly and enhances the functionality of the library. The function includes appropriate checks and optimizations, such as:
- Asserting that the
rate
is not zero to prevent division errors.- Returning the original
STMPTAmount
if therate
is equal toparityRate
.- Adjusting the
rate
by a factor of10^-9
during the multiplication.The function is well-documented, follows the coding conventions, and has no apparent issues or side effects.
src/libxrpl/protocol/Issue.cpp (1)
29-33
: LGTM!The
getIssuer()
function is implemented correctly as a simple getter that returns a constant reference to theaccount
member variable. Theconst
qualifier is used appropriately, and the function provides read-only access to theaccount
member variable, which aligns with the expected behavior of a getter function.include/xrpl/protocol/TxMeta.h (3)
135-135
: LGTM!The change in the
mDelivered
member variable type tostd::optional<STEitherAmount>
is consistent with the overall shift in representing delivered amounts within theTxMeta
class.
116-116
: Ensure safe usage ofgetDeliveredAmount
.The change in the
getDeliveredAmount
method return type toSTEitherAmount
is consistent with the overall shift in representing delivered amounts within theTxMeta
class.To avoid potential runtime errors, callers of
getDeliveredAmount
should first check the presence of a delivered amount using thehasDeliveredAmount
method. Please verify that all invocations ofgetDeliveredAmount
are preceded by a check onhasDeliveredAmount
. Run the following script to identify any unsafe usages:Verification successful
getDeliveredAmount()
usage is safe throughout the codebase.After a thorough examination of the relevant files, it's confirmed that all calls to
getDeliveredAmount()
are properly guarded:
- In
DeliveredAmount.cpp
, calls are preceded by eitherhasDeliveredAmount()
orcanHaveDeliveredAmount()
checks.- In
TxMeta.cpp
, the call is guarded by ahasDeliveredAmount()
check.These safety measures ensure that
getDeliveredAmount()
is only called when a delivered amount is available, addressing the concern raised in the original review comment.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all invocations of `getDeliveredAmount` are preceded by a check on `hasDeliveredAmount`. # Test: Search for the method usage. Expect: All occurrences to be preceded by a `hasDeliveredAmount` check. rg --type cpp -A 5 $'getDeliveredAmount\(\)'Length of output: 1111
Script:
#!/bin/bash # Description: Check for hasDeliveredAmount() usage and examine the context of getDeliveredAmount() calls # Check for hasDeliveredAmount() usage in DeliveredAmount.cpp echo "Checking DeliveredAmount.cpp:" rg --type cpp -C 10 'hasDeliveredAmount|getDeliveredAmount' src/xrpld/rpc/detail/DeliveredAmount.cpp echo -e "\nChecking TxMeta.cpp:" # Check for hasDeliveredAmount() usage in TxMeta.cpp rg --type cpp -C 10 'hasDeliveredAmount|getDeliveredAmount' src/libxrpl/protocol/TxMeta.cppLength of output: 4585
111-111
: VerifySTEitherAmount
usage across the codebase.The change in the
setDeliveredAmount
method signature to acceptSTEitherAmount
instead ofSTAmount
is consistent with the overall shift in representing delivered amounts within theTxMeta
class.Please ensure that all invocations of the
setDeliveredAmount
method have been updated to pass anSTEitherAmount
argument instead ofSTAmount
. Run the following script to verify the usage:src/libxrpl/protocol/UintTypes.cpp (1)
129-134
: LGTM!The
noMPT
function is a useful addition that provides a way to retrieve a default or "no" MPTID. The implementation is correct and does not alter any existing logic.include/xrpl/protocol/UintTypes.h (2)
61-66
: LGTM!The introduction of
MPTID
as a 192-bit hash is a valuable addition to the protocol. The accompanying comment provides clarity on the current uniqueness of MPTID and anticipates future changes by suggesting the use of a unique tag if more 192-bit fields are introduced. This comment ensures that the code is future-proofed and maintainable.
76-78
: LGTM!The introduction of the
noMPT()
function is a great addition. It provides a clear and consistent way to represent an empty MPTID throughout the codebase. Having a dedicated function for this purpose promotes code clarity, reduces the chances of errors, and improves maintainability.include/xrpl/protocol/STBitString.h (2)
87-87
: LGTM!The addition of the
STUInt192
type alias is consistent with the existing pattern and expands the range of supported data types.
140-145
: Verify the usage ofSTI_UINT192
identifier.The addition of the
getSType()
specialization forSTUInt192
is consistent with the existing pattern and ensures proper serialization and deserialization of the new type.Please ensure that the
STI_UINT192
identifier is defined and used consistently across the codebase. Run the following script to verify:Verification successful
STI_UINT192 identifier is correctly defined and used.
The verification process confirms that the
STI_UINT192
identifier is properly defined inSField.h
and consistently used across the codebase. Its usage inSTBitString.h
for theSTUInt192::getSType()
method is correct and aligns with the pattern used for other integer types. The identifier is also appropriately integrated into JSON parsing and variable handling processes.The original code change adding the
getSType()
specialization forSTUInt192
is approved and consistent with the overall implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `STI_UINT192` identifier. # Test 1: Search for the definition of `STI_UINT192`. Expect: Exactly one occurrence. rg --type c++ -c $'STI_UINT192' # Test 2: Search for the usage of `STI_UINT192`. Expect: At least one occurrence (in `STUInt192::getSType()`). rg --type c++ -c $'STI_UINT192'Length of output: 117
Script:
#!/bin/bash # Description: Verify the usage of `STI_UINT192` identifier using grep. # Search for STI_UINT192 in all files, showing file names and 2 lines of context before and after each match grep -rn -C 2 "STI_UINT192" . # Count the total occurrences of STI_UINT192 echo "Total occurrences of STI_UINT192:" grep -r "STI_UINT192" . | wc -lLength of output: 1844
include/xrpl/protocol/Protocol.h (2)
98-99
: LGTM!The constant
maxMPTokenMetadataLength
is declared with the appropriate data type and value. The comment clearly explains its purpose, which is to define the maximum length of MPTokenMetadata. This constant helps enforce a reasonable limit on the metadata size and prevents excessive resource consumption.
101-102
: LGTM!The constant
maxMPTokenAmount
is declared with the appropriate data type and value. The comment clearly explains its purpose, which is to define the maximum amount of MPTokenIssuance. This constant helps enforce a reasonable limit on the token issuance amount and prevents excessive issuance. The chosen value of0x7FFFFFFFFFFFFFFFull
allows for a wide range of issuance amounts while still imposing a reasonable limit.include/xrpl/protocol/STMPTAmount.h (2)
32-100
: LGTM!The
STMPTAmount
class provides a comprehensive and well-designed framework for managing monetary amounts associated with a specific issue (currency) in the context of the Ripple protocol. The class correctly handles arithmetic operations, comparisons, serialization, and deserialization, ensuring the integrity and consistency of the monetary values. The provided utility functions enhance the usability and flexibility of the class.The implementation follows best practices and includes appropriate error handling, such as throwing exceptions when attempting to perform operations on amounts with different issues. The class is well-documented, making it easy to understand and maintain.
Overall, the
STMPTAmount
class is a valuable addition to the Ripple protocol, providing a robust and reliable mechanism for handling multi-party token amounts.
102-191
: LGTM!The free functions provided in this file complement the
STMPTAmount
class and offer additional functionality for working with monetary amounts. The arithmetic operators (operator+
andoperator-
) and comparison operators (operator==
,operator<
,operator!=
,operator>
,operator<=
,operator>=
) are implemented correctly, ensuring that operations are only performed on amounts with the same issue (currency).The
amountFromString
function provides a convenient way to create anSTMPTAmount
object from a string representation, enhancing the usability of the class. Similarly, themultiply
function allows multiplying anSTMPTAmount
object by aRate
object, which is useful for various calculations involving exchange rates or conversions.The implementation of these free functions follows best practices, including appropriate error handling and throwing exceptions when necessary. The functions are well-documented, making them easy to understand and use.
Overall, the free functions are a valuable addition to the
STMPTAmount
class and provide a comprehensive set of tools for working with monetary amounts in the Ripple protocol.include/xrpl/protocol/SOTemplate.h (6)
25-25
: LGTM!The
#include
statement for theSField.h
header file is necessary and looks good.
43-44
: LGTM!The new enumeration
SOETxMPTAmount
is well-defined and provides a clear way to categorize the support for MPT in amount fields. The enumeration values cover the necessary cases and are named appropriately.
54-54
: LGTM!The new member variable
supportMpt_
of typeSOETxMPTAmount
is a suitable addition to theSOElement
class. It allows tracking the MPT support status for eachSOElement
instance.
Line range hint
56-69
: LGTM!The private member function
init
is a helpful addition to theSOElement
class. It ensures that thesField_
member variable is useful, which is a necessary condition for the class. The error handling is appropriate, throwing astd::runtime_error
with a descriptive message if the condition is not met. Marking the function as private indicates that it is an internal implementation detail.
70-90
: LGTM!The modifications to the constructors of the
SOElement
class are well-designed. They allow initializing thesupportMpt_
member variable based on the constructor arguments, providing flexibility in creating instances with different MPT support statuses. The default values forsupportMpt_
are set appropriately in each constructor. Calling theinit
function in each constructor ensures that thesField_
member variable is validated.
103-108
: LGTM!The new member function
supportMPT
is a straightforward and useful addition to theSOElement
class. It provides a way to retrieve the MPT support status of an instance by returning the value of thesupportMpt_
member variable. Marking the function asconst
correctly indicates that it does not modify the object's state.include/xrpl/basics/MPTAmount.h (8)
38-99
: LGTM!The
MPTAmount
class is well-designed and provides essential operations for handling integral amounts. The use ofstd::int64_t
as the underlying type is appropriate, and leveraging Boost library for operator overloading creates an intuitive API.
101-103
: LGTM!The constructor is properly implemented as a
constexpr
function, allowing it to be used in constant expressions. The explicit constructor prevents implicit conversions, which is a good practice to avoid unintended behavior.
105-109
: LGTM!The assignment operator is properly implemented as a
constexpr
function, allowing it to be used in constant expressions. The operator sets thevalue_
member to zero and returns*this
, following the convention for assignment operators.
112-115
: LGTM!The conversion operator is properly implemented as an
explicit
andconstexpr
function, preventing implicit conversions and allowing it to be used in constant expressions. The operator provides a convenient way to check if the amount is non-zero.
118-122
: LGTM!The
signum()
method is properly implemented as aconstexpr
function, allowing it to be used in constant expressions. The method efficiently determines the sign of the amount using a ternary operator.
134-139
: LGTM!The
operator>>
is properly implemented as a free function, allowing it to be used withstd::istream
objects. The operator reads thevalue_
member from the input stream and returns the stream, following the convention for input stream operators.
142-147
: LGTM!The
operator<<
is properly implemented as a free function template, allowing it to be used with anystd::basic_ostream
type. The operator writes thevalue()
of theMPTAmount
to the output stream and returns the stream, following the convention for output stream operators.
128-132
: LGTM, but use with caution!The
value()
method is properly implemented as aconstexpr
function, allowing it to be used in constant expressions. However, as indicated by the comment, this method is intended for internal use only and should be used with caution to avoid exposing the underlying type.To ensure that the
value()
method is not used externally, you can run the following script:Verification successful
Verified: Internal usage as intended, exercise caution when modifying
The
value()
method ofMPTAmount
is indeed used internally within the XRPL codebase, primarily in ledger operations and basicMPTAmount
manipulations. There's no evidence of external usage, which aligns with the intention for it to be an internal method. However, due to its use in core functionality, any modifications should be approached with caution to avoid unintended side effects.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `value()` method is not used externally. # Test: Search for usage of the `value()` method outside the `MPTAmount` class. # Expect: No occurrences found. rg --type cpp $'MPTAmount::value\(\)' | rg -v $'MPTAmount\.'Length of output: 60
Script:
#!/bin/bash # 1. Confirm the existence and location of the MPTAmount class echo "Locating MPTAmount class:" fd -e h -e cpp MPTAmount # 2. Search for usages of MPTAmount in the codebase echo -e "\nUsages of MPTAmount:" rg --type cpp "MPTAmount" # 3. Look for potential aliases or typedefs of MPTAmount echo -e "\nPotential aliases or typedefs of MPTAmount:" rg --type cpp "typedef.*MPTAmount|using.*=.*MPTAmount" # 4. Search for value() method calls that might be related to MPTAmount echo -e "\nPotential value() method calls:" rg --type cpp "\w+\.value\(\)" -C 2Length of output: 80438
src/libxrpl/protocol/STMPTAmount.cpp (14)
29-40
: LGTM!The constructor correctly deserializes an
STMPTAmount
object from aSerialIter
. It performs the necessary checks and throws an exception if the serialized data does not represent an MPT amount. The deserialization logic is straightforward and efficient.
42-45
: LGTM!The constructor correctly initializes an
STMPTAmount
object with the providedMPTIssue
andvalue
. The implementation is straightforward and free of issues.
47-58
: LGTM!The constructor properly initializes an
STMPTAmount
object with the providedMPTIssue
,value
, andnegative
flag. It performs a necessary check to ensure thevalue
is within the valid range for MPT amounts and throws an exception if not. The handling of negative amounts is correct, and the overall logic is clear and concise.
60-62
: LGTM!The constructor correctly initializes an
STMPTAmount
object with the providedvalue
. The implementation is straightforward and free of issues.
64-68
: LGTM!The
getSType
method correctly returns the serialized type ID of theSTMPTAmount
class. The implementation is straightforward and free of issues.
70-78
: LGTM!The
getFullText
method correctly returns a string representation of theSTMPTAmount
object by concatenating the result ofgetText()
with the string representation of the MPT ID. The use ofreserve
is a good optimization to avoid unnecessary string reallocations. The implementation is straightforward and free of issues.
80-84
: LGTM!The
getText
method correctly returns a string representation of thevalue_
member variable usingstd::to_string
. The implementation is straightforward and free of issues.
86-91
: LGTM!The
getJson
method correctly returns a JSON representation of theSTMPTAmount
object. It creates aJson::Value
object and callssetJson
to populate it with the necessary fields. The use of a separatesetJson
method promotes code reuse and maintainability. The implementation is straightforward and free of issues.
93-98
: LGTM!The
setJson
method correctly populates aJson::Value
object with the JSON representation of theSTMPTAmount
object. It sets thempt_issuance_id
andvalue
fields using string literals for improved readability. The implementation is straightforward and free of issues.
100-109
: LGTM!The
add
method correctly serializes theSTMPTAmount
object into aSerializer
object. It sets the appropriate flags based on thevalue_
sign using bitwise operations and serializes the absolute value ofvalue_
to avoid redundancy. The serialization order and format are consistent with the deserialization logic in the constructor. The implementation is straightforward and free of issues.
111-115
: LGTM!The
isDefault
method correctly checks if theSTMPTAmount
object represents the default amount by comparing thevalue_
to 0 and theissue_
to the result ofnoMPT()
. The use ofnoMPT()
ensures a consistent representation of the default MPT issue. The implementation is straightforward and free of issues.
117-121
: LGTM!The
getIssuer
method correctly returns the issuer account ID associated with theSTMPTAmount
object by calling thegetIssuer()
method of theissue_
member variable. The implementation is straightforward and free of issues.
123-127
: LGTM!The
getCurrency
method correctly returns the MPT ID associated with theSTMPTAmount
object by calling thegetMptID()
method of theissue_
member variable. The implementation is straightforward and free of issues.
129-133
: LGTM!The
issue
method correctly returns a constant reference to theissue_
member variable. Returning a constant reference is efficient and prevents unnecessary copying. The implementation is straightforward and free of issues.src/libxrpl/protocol/TxMeta.cpp (1)
147-147
: LGTM! The change improves the flexibility of amount handling.The update from
STAmount
toSTEitherAmount
in the dynamic cast suggests that thegetAffectedAccounts
function now expects and handles a broader or different set of amount representations. This change enhances the robustness of the amount handling logic, allowing the function to process affected accounts with amounts of different types correctly.The assertion following the cast remains unchanged, ensuring that the cast is valid and
STEitherAmount
is a derived class of the type offield
.Overall, this modification improves the flexibility and reliability of the
getAffectedAccounts
function in handling diverse amount types.src/libxrpl/protocol/STVar.cpp (4)
144-146
: Approve the addition ofSTUInt192
support.The change introduces support for a new unsigned integer type,
STUInt192
, enhancing the flexibility of theSTVar
class in handling various data types. This expansion of supported types may benefit existing code that relies onSTVar
.
203-203
: Approve the change fromSTAmount
toSTEitherAmount
.This change is consistent with the modification made in the other constructor at line 136. It aligns with the evolution in how amounts are represented and processed within the system.
See the previous comment for more details on the impact of this change.
211-213
: Approve the addition ofSTUInt192
support.This change is consistent with the addition made in the other constructor at lines 144-146. It ensures consistency in handling
STUInt192
across both constructors ofSTVar
.See the previous comment for more details on the benefits of supporting
STUInt192
.
136-136
: Approve the change fromSTAmount
toSTEitherAmount
.The change indicates an evolution in how amounts are represented and processed within the system. It suggests a broader capability or different handling mechanism for amounts.
Verify the impact of this change on the codebase:
Verification successful
Approve the change from STAmount to STEitherAmount in STVar.cpp
This change is part of a planned transition to support more flexible amount representations in the XRPL protocol. STEitherAmount is a new type that can hold either an STAmount or an STMPTAmount, allowing for backwards compatibility with existing STAmount usage while introducing support for new amount types.
The modification in STVar.cpp updates the deserialization process to use the more flexible STEitherAmount, which is consistent with the overall transition strategy. This change enables the protocol to handle both traditional amounts and potentially new types of amounts (like MPT) in a unified way.
Developers should be aware that:
- Some fields (like sfFee) will continue to always return STAmount for backwards compatibility.
- Other fields (like sfAmount) will now return STEitherAmount, requiring explicit type checking or conversion when accessing the amount value.
This transition is being implemented gradually across the codebase, maintaining compatibility while introducing new capabilities.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `STAmount` and `STEitherAmount` in the codebase. # Test 1: Search for the usage of `STAmount`. Expect: Occurrences in code that may need to be updated. rg --type cpp $'STAmount' # Test 2: Search for the usage of `STEitherAmount`. Expect: Occurrences in code that handle the new amount type. rg --type cpp $'STEitherAmount'Length of output: 217634
Script:
#!/bin/bash # Search for remaining uses of STAmount echo "Remaining uses of STAmount:" rg --type cpp "STAmount" -c echo "\nUses of STEitherAmount:" rg --type cpp "STEitherAmount" -c echo "\nFiles where both STAmount and STEitherAmount are used:" rg --type cpp -l "STAmount" | xargs rg --type cpp -l "STEitherAmount" | sort | uniq echo "\nChecking if all STAmount constructors have been updated:" rg --type cpp "STAmount\(sit,\s*name\)"Length of output: 8462
Script:
#!/bin/bash # Examine STEitherAmount definition echo "STEitherAmount definition:" rg --type cpp -A 20 "class STEitherAmount" include/xrpl/protocol/STEitherAmount.h echo "\nExamples of STAmount and STEitherAmount usage in the same file:" rg --type cpp -C 5 "STAmount|STEitherAmount" src/libxrpl/protocol/STObject.cpp echo "\nChecking for comments about STAmount to STEitherAmount transition:" rg --type cpp -C 3 "STAmount.*STEitherAmount|STEitherAmount.*STAmount"Length of output: 6923
include/xrpl/protocol/STEitherAmount.h (12)
36-126
: LGTM!The
STEitherAmount
class is well-designed and implemented. It follows the Single Responsibility Principle by focusing on representing an amount that can be eitherSTAmount
orSTMPTAmount
. The use ofstd::variant
is appropriate for storing the two possible types. The class provides a comprehensive set of constructors, assignment operators, and methods to access and manipulate the stored amount. Theget
method is a nice touch, allowing type-safe access to the stored amount based on the provided type parameter. The class also properly overrides necessary virtual functions from the base classSTBase
to provide custom behavior.
128-135
: LGTM!The
get
function is correctly implemented usingstd::holds_alternative
andstd::get
to check and retrieve the stored amount of typeT
. The use of theValidAmountType
concept ensures that the function can only be called with valid amount types (STAmount
orSTMPTAmount
). Throwing astd::logic_error
is appropriate when the stored amount does not match the requested type.
137-144
: LGTM!The non-const version of the
get
function is correctly implemented usingstd::holds_alternative
andstd::get
to check and retrieve the stored amount of typeT
. The use of theValidAmountType
concept ensures that the function can only be called with valid amount types (STAmount
orSTMPTAmount
). Throwing astd::logic_error
is appropriate when the stored amount does not match the requested type.
146-177
: LGTM!The standalone
get
function is a well-designed and implemented utility function. It usesif constexpr
to handle different input types at compile-time, providing a convenient way to retrieve the stored amount of typeT
from various input objects. The function correctly handlesSTEitherAmount
,std::optional<STEitherAmount>
, and types convertible toSTEitherAmount
. It also handles both lvalue and rvalue references correctly. Thestatic_assert
at the end ensures that the function is only instantiated with valid input types, providing a good compile-time check.
179-180
: Skipped reviewing the function implementation.The
amountFromJson
function is only declared in this header file, so its implementation cannot be reviewed here. The function signature is correct and follows the naming convention. The purpose of the function is clear from its name and parameter types.
182-183
: Skipped reviewing the function implementation.The
amountFromJson
function is only declared in this header file, so its implementation cannot be reviewed here. The function signature is correct and follows the naming convention. The purpose of the function is clear from its name and parameter types.
185-186
: Skipped reviewing the function implementation.The
amountFromJsonNoThrow
function is only declared in this header file, so its implementation cannot be reviewed here. The function signature is correct and follows the naming convention. The purpose of the function is clear from its name and parameter types.
188-189
: Skipped reviewing the function implementation.The
amountFromJsonNoThrow
function is only declared in this header file, so its implementation cannot be reviewed here. The function signature is correct and follows the naming convention. The purpose of the function is clear from its name and parameter types.
191-203
: LGTM!The
operator==
function is correctly implemented usingstd::visit
to handle the comparison of the stored amounts. The use ofif constexpr
allows the function to compare the stored amounts only if they have the same type, avoiding any runtime errors. Returningfalse
when the stored amounts have different types is the correct behavior.
205-209
: LGTM!The
operator!=
function is correctly implemented by negating the result ofoperator==
. This is a common idiom for implementingoperator!=
in terms ofoperator==
.
211-219
: LGTM!The
isMPT
function is correctly implemented usingif constexpr
to determine the return value based on the type ofT
. The use of theValidAmountType
concept ensures that the function can only be called with valid amount types (STAmount
orSTMPTAmount
).
221-229
: LGTM!The
isMPT
function is correctly implemented usingif constexpr
to handle the different input types. ForSTEitherAmount
, it calls the memberisMPT
function to determine if the stored amount is anSTMPTAmount
. Forstd::optional<STEitherAmount>
, it first checks if the optional has a value, and if so, it calls the memberisMPT
function on the stored `STEitherAmountinclude/xrpl/protocol/TxFormats.h (3)
202-203
: LGTM!The addition of the new transaction type
ttMPTOKEN_ISSUANCE_CREATE
follows the existing pattern and naming convention. The comment provides a clear description of its purpose, and the assigned value is in sequence with the existing transaction types.
205-206
: LGTM!The addition of the new transaction type
ttMPTOKEN_ISSUANCE_DESTROY
follows the existing pattern and naming convention. The comment provides a clear description of its purpose, and the assigned value is in sequence with the existing transaction types.
211-212
: LGTM!The addition of the new transaction type
ttMPTOKEN_ISSUANCE_SET
follows the existing pattern and naming convention. The comment provides a clear description of its purpose, and the assigned value is in sequence with the existing transaction types.include/xrpl/protocol/Serializer.h (2)
347-349
: LGTM!The
peek8
function is a useful addition that allows non-destructive reading of the next byte. The implementation looks correct, and the comment clearly indicates the error-throwing behavior.
380-384
: Looks good!The
get192
function is a straightforward addition that extends theSerialIter
class to handle 192-bit values. The implementation is clean and reuses the existinggetBitString
template function, which is a good practice.include/xrpl/basics/Number.h (2)
56-56
: LGTM!The addition of the
Number(MPTAmount const& x)
constructor enhances the functionality of theNumber
class by allowing it to handleMPTAmount
values. This improves the usability of the class without breaking any existing code.
94-94
: LGTM!The addition of the
operator MPTAmount() const
conversion operator and the implementation of theNumber(MPTAmount const& x)
constructor complete the support forMPTAmount
in theNumber
class. This allows seamless conversion betweenNumber
andMPTAmount
objects, enhancing the interoperability between these types. The constructor implementation correctly initializes theNumber
object using the value from theMPTAmount
object, ensuring consistency with the conversion operator.Also applies to: 216-219
include/xrpl/protocol/Indexes.h (7)
290-291
: LGTM!The function correctly constructs a
Keylet
for an MPT issuance using anAccountID
and a sequence number.
293-294
: LGTM!The function correctly constructs a
Keylet
for an MPT issuance using anMPTID
.
296-300
: LGTM!The inline function correctly constructs a
Keylet
for an MPT issuance using auint256
key.
302-303
: LGTM!The function correctly constructs a
Keylet
for an MPToken using anMPTID
and anAccountID
.
305-309
: LGTM!The inline function correctly constructs a
Keylet
for an MPToken using auint256
key.
311-312
: LGTM!The function correctly constructs a
Keylet
for an MPToken using auint256
issuance key and anAccountID
.
354-355
: LGTM!The function declaration for
getMptID
is correct, taking anAccountID
and a sequence number and returning anMPTID
.include/xrpl/protocol/TxFlags.h (5)
25-26
: LGTM!The inclusion of the
LedgerFormats.h
header file is necessary and follows the correct convention by placing it outside theripple
namespace.
135-143
: LGTM!The constants for MPTokenIssuanceCreate transaction flags are well-defined and follow the naming convention. The comment provides a clear explanation for the intentional omission of the flag value 0x01. The values assigned to the constants are consistent with the related ledger state flags.
145-146
: LGTM!The constant
tfMPTUnauthorize
for the MPTokenAuthorize transaction flag is well-defined and follows the naming convention. The assigned value is a valid flag value.
148-150
: LGTM!The constants
tfMPTLock
andtfMPTUnlock
for the MPTokenIssuanceSet transaction flags are well-defined and follow the naming convention. The assigned values are valid flag values.
207-218
: LGTM!The constants for flag masks related to MPToken transactions are well-defined and follow a consistent naming convention. The bitwise NOT operations are used correctly to exclude the specified flags and the
tfUniversal
flag from the valid combinations. ThetfMPTokenIssuanceCreateMask
constant includes all the relevanttfMPT*
flags, while the other mask constants include only the flags specific to their respective transaction types. This ensures that only valid flag combinations can be used for each MPToken transaction type.include/xrpl/protocol/LedgerFormats.h (4)
199-211
: LGTM! The new ledger entry types expand the ledger's capabilities to support MPTokens.The addition of
ltMPTOKEN_ISSUANCE
andltMPTOKEN
ledger entry types is a significant enhancement that enables the ledger to handle MPToken assets.ltMPTOKEN_ISSUANCE
allows defining MPToken asset types without tracking balances, whileltMPTOKEN
enables tracking individual MPToken balances.The assigned enum values are unique and follow the existing naming convention, and the comments provide clear descriptions of the purpose of each ledger entry type.
This is a non-breaking change that expands the ledger's capabilities.
324-332
: LGTM! The new flags enhance the control and management of MPToken issuances.The addition of flags such as
lsfMPTLocked
,lsfMPTCanLock
,lsfMPTRequireAuth
,lsfMPTCanEscrow
,lsfMPTCanTrade
,lsfMPTCanTransfer
, andlsfMPTCanClawback
to theLedgerSpecificFlags
enum provides granular control over the properties and permissions of MPToken issuances.These flags allow for fine-grained management of MPTokens within the ledger system, enabling flexibility in setting permissions and properties for each MPToken issuance. The assigned bit values are unique and follow the existing convention.
This enhancement improves the functionality and control over MPToken issuances.
334-335
: LGTM! The new flag enhances the management of MPToken balances.The addition of the
lsfMPTAuthorized
flag to theLedgerSpecificFlags
enum specifically for theltMPTOKEN
ledger entry type provides an additional property for managing MPToken balances.This flag likely indicates whether an individual MPToken balance is authorized or not, allowing for better control and tracking of the authorization status of MPToken balances within the ledger system.
The assigned bit value is unique and follows the existing convention.
326-326
: LGTM! Reusing thelsfMPTLocked
flag ensures consistency across MPToken-related ledger entries.The comment indicates that the
lsfMPTLocked
flag, originally defined for theltMPTOKEN_ISSUANCE
type, is also used in theltMPTOKEN
type. This reuse of the flag implies that the locked status is applicable to both MPToken issuances and individual MPToken balances.Reusing the same flag for both types ensures a consistent representation of the locked status across MPToken-related ledger entries, allowing for a unified approach to handling and interpreting the locked status of MPTokens.
This consistency enhances the overall management and understanding of MPToken-related data within the ledger system.
include/xrpl/protocol/Feature.h (2)
83-83
: LGTM!The change to increment
numFeatures
from 79 to 80 appears to be a valid update to reflect the addition of a new feature.Please ensure that the actual number of amendments registered in Feature.cpp matches this value to avoid the LogicError on startup, as mentioned in the code comments.
375-375
: LGTM!The addition of the new external variable
featureMPTokensV1
to declare a new feature appears to follow the guidelines mentioned in the code comments.As the next steps, please ensure to:
- Add a
uint256
definition forfeatureMPTokensV1
to the corresponding source file (Feature.cpp). UseregisterFeature
to create the feature with the feature's name,Supported::no
, andVoteBehavior::DefaultNo
.- Use
featureMPTokensV1
as the parameter toview.rules.enabled()
to control flow into the new code that this feature limits.src/libxrpl/protocol/Serializer.cpp (1)
361-368
: LGTM!The
peek8()
function is a useful addition to theSerialIter
class, providing a way to inspect the next byte without consuming it. The implementation is straightforward and includes appropriate error handling.include/xrpl/protocol/STAmount.h (4)
240-240
: Good use ofunique_ptr
for improved memory safety.Changing the return type of the
construct
method from a raw pointer tounique_ptr<STAmount>
improves memory safety and ownership semantics. It ensures that the caller ofconstruct
takes ownership of the dynamically allocatedSTAmount
object and is responsible for its deletion.This change aligns with modern C++ best practices of using smart pointers for resource management and helps prevent potential memory leaks.
45-45
: Clarify the reason for removing the base classesSTBase
andCountedObject<STAmount>
.Removing the inheritance from
STBase
andCountedObject<STAmount>
alters the base class structure ofSTAmount
, which could potentially affect the memory management and polymorphic behavior of the class.Please provide more context on why this change was made and assess the potential impact on the codebase.
To verify the impact of this change, run the following script:
Verification successful
Removal of base classes from STAmount appears to be safe
The verification process has been completed, and no issues were found related to the removal of
STBase
andCountedObject<STAmount>
as base classes forSTAmount
. Our analysis suggests that:
STAmount
is not being used polymorphically in the codebase.- There are no occurrences of
STAmount
being passed to functions expectingSTBase
orCountedObject<STAmount>
.Based on this analysis, the change appears to be safe and doesn't seem to have negatively impacted the existing codebase. However, it's still recommended to thoroughly test the changes to ensure no unexpected behavior arises.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if `STAmount` is still used polymorphically or if the removal of base classes has affected the codebase. # Test 1: Search for occurrences where `STAmount` is used as a base class pointer or reference. # Expect: No occurrences found. ast-grep --lang cpp --pattern $'dynamic_cast<STAmount*>($_)' ast-grep --lang cpp --pattern $'dynamic_cast<STAmount&>($_)' ast-grep --lang cpp --pattern $'static_cast<STAmount*>($_)' ast-grep --lang cpp --pattern $'static_cast<STAmount&>($_)' # Test 2: Search for occurrences where `STAmount` is passed to functions expecting `STBase` or `CountedObject<STAmount>`. # Expect: No occurrences found. rg --type cpp $'STBase \*' -A 5 rg --type cpp $'STBase &' -A 5 rg --type cpp $'CountedObject<STAmount> \*' -A 5 rg --type cpp $'CountedObject<STAmount> &' -A 5Length of output: 409
78-78
: Clarify the reason for removing theSField
parameter from the constructor.The constructor
STAmount(SerialIter& sit, SField const& name)
has been simplified toSTAmount(SerialIter& sit)
, removing theSField
parameter. This change indicates a shift towards a more streamlined instantiation process.Please provide more context on how the
name
parameter was being used previously and why it was removed. Also, clarify how the handling of fields is now being managed after this change.To verify the impact of this change, run the following script:
Verification successful
To gather more information about the implementation and usage of the
STAmount
constructor, let's run the following scripts:
Verified: The removal of the
SField
parameter from theSTAmount
constructor is consistent.The change to simplify the
STAmount
constructor by removing theSField
parameter appears to be intentional and consistently implemented. The constructor now focuses solely on processing the serialized data from theSerialIter
.No usage of
SField
was found within theSTAmount
class, suggesting that field-related functionality may have been moved elsewhere or is no longer needed.To improve code documentation:
- Consider adding a comment in the header file or the implementation file explaining the rationale for removing the
SField
parameter.- If the field handling has been moved elsewhere, it would be helpful to mention where this functionality now resides.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if the removal of the `SField` parameter has affected the instantiation of `STAmount` from `SerialIter`. # Test: Search for occurrences where `STAmount` is being constructed from `SerialIter`. # Expect: All occurrences should match the new constructor signature. rg --type cpp $'STAmount\(SerialIter'Length of output: 172
Script:
#!/bin/bash # View the implementation of the STAmount constructor echo "STAmount constructor implementation:" rg -A 10 "STAmount::STAmount\(SerialIter& sit\)" src/libxrpl/protocol/STAmount.cpp # Search for SField usage within the STAmount class echo -e "\nSField usage within STAmount class:" ast-grep --lang cpp --pattern 'class STAmount { $$$ $_($_ SField $_) { $$$ } $$$ }'Length of output: 965
217-231
: Clarify the reason for removing theoverride
specifiers and theisEquivalent
method.Several methods like
getSType
,getFullText
,getText
,getJson
, andadd
have been modified to remove theoverride
specifier, which may indicate a change in the intended inheritance structure or functionality. The removal ofoverride
could affect how these methods are resolved at runtime.Additionally, the
isEquivalent
method has been removed entirely, which could impact comparisons betweenSTAmount
instances.Please provide more context on why these changes were made and assess the potential impact on the codebase, especially regarding the behavior of
STAmount
.To verify the impact of these changes, run the following script:
Verification successful
Removal of
override
specifiers andisEquivalent
method does not significantly impact STAmount usage.After thorough investigation, we can confirm that the removal of
override
specifiers and theisEquivalent
method from STAmount does not have a significant impact on the codebase:
- STAmount is defined as a final class and does not inherit from any base class, so removing
override
specifiers doesn't affect inheritance or polymorphic behavior.- The
isEquivalent
method was not part of a polymorphic interface for STAmount.- While comparison operators (
==
and!=
) are not visible in the class definition, they are likely implemented elsewhere and their functionality is maintained.The changes appear to be a cleanup or refactoring of the STAmount class rather than a functional modification. The behavior of STAmount instances in the codebase should remain consistent with previous versions.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if the removal of `override` and `isEquivalent` has affected the behavior of `STAmount`. # Test 1: Search for occurrences where the modified methods are being called on `STAmount` instances. # Expect: Verify that the method calls are still valid and the expected behavior is maintained. rg --type cpp $'STAmount::getSType\(' rg --type cpp $'STAmount::getFullText\(' rg --type cpp $'STAmount::getText\(' rg --type cpp $'STAmount::getJson\(' rg --type cpp $'STAmount::add\(' # Test 2: Search for occurrences where `isEquivalent` is being called on `STAmount` instances. # Expect: No occurrences found. If found, verify that the comparisons are still valid after the removal of `isEquivalent`. rg --type cpp $'STAmount::isEquivalent\('Length of output: 570
Script:
#!/bin/bash # Description: Further verify the impact of removing `override` specifiers and `isEquivalent` method # Check for usage of methods on STAmount instances or through base class pointers/references rg --type cpp -e '\.getSType\(\)' -e '\.getFullText\(\)' -e '\.getText\(\)' -e '\.getJson\(' -e '\.add\(' # Find the base class of STAmount rg --type cpp 'class\s+STAmount\s*:\s*public' # Search for comparisons or equivalence checks on STAmount objects rg --type cpp -e 'STAmount.*==.*STAmount' -e 'STAmount.*!=.*STAmount' -e 'STAmount.*compare.*STAmount' # Check if isEquivalent is defined in a base class rg --type cpp 'virtual.*isEquivalent'Length of output: 54533
Script:
#!/bin/bash # Description: Further verify the impact of removing `override` specifiers and `isEquivalent` method from STAmount # Check if STAmount is part of any inheritance hierarchy rg --type cpp 'class\s+\w+\s*:\s*public\s+STAmount' rg --type cpp 'class\s+STAmount\s*:\s*public\s+\w+' # Check for any indirect uses of isEquivalent rg --type cpp 'isEquivalent' # Verify implementation of comparison operators for STAmount rg --type cpp 'STAmount::operator==' rg --type cpp 'STAmount::operator!='Length of output: 4118
Script:
#!/bin/bash # Description: Final verification of STAmount implementation and usage # Check for non-member operator implementations for STAmount rg --type cpp 'operator==\s*\(\s*const\s+STAmount\s*&' rg --type cpp 'operator!=\s*\(\s*const\s+STAmount\s*&' # Look for potential base classes of STAmount rg --type cpp 'class\s+STAmount\s*:' -A 5 # Check for polymorphic usage of STAmount rg --type cpp 'virtual.*STAmount' rg --type cpp 'std::unique_ptr<\s*STAmount>' rg --type cpp 'std::shared_ptr<\s*STAmount>' # Search for inline comparison operators in STAmount definition rg --type cpp 'class\s+STAmount' -A 50Length of output: 16013
src/libxrpl/protocol/STEitherAmount.cpp (5)
30-39
: LGTM!The constructor correctly deserializes an
STEitherAmount
from aSerialIter
by checking the first byte to determine the type of amount and constructing the appropriate type.
41-82
: LGTM!The constructors and assignment operators for
STEitherAmount
provide flexibility and convenience in creating and assigning values from different types of amounts (XRPAmount
,STAmount
, orSTMPTAmount
). The code is straightforward and does not contain any apparent issues.
84-210
: LGTM!The methods defined for
STEitherAmount
provide a consistent and well-structured interface for accessing and manipulating the amount, regardless of the underlying type (STAmount
orSTMPTAmount
). The use ofstd::visit
allows for clean and concise code, and the methods handle the differences betweenSTAmount
andSTMPTAmount
appropriately. The code follows a consistent pattern and does not contain any apparent issues.
212-423
: LGTM!The utility functions for creating
STEitherAmount
instances from JSON representations are well-structured and handle different JSON value types appropriately. TheamountFromJson
function correctly extracts the necessary information from the JSON value to create anSTEitherAmount
and performs necessary validations, throwing exceptions for invalid JSON representations or out-of-range values. TheamountFromJsonNoThrow
functions provide a convenient way to create anSTEitherAmount
orSTAmount
from JSON without explicit exception handling. The code is well-organized and does not contain any apparent issues.
425-425
: LGTM!The closing namespace brace for the
ripple
namespace is necessary and correctly placed.src/libxrpl/protocol/Indexes.cpp (5)
76-77
: LGTM!The addition of the new
MPTOKEN_ISSUANCE
andMPTOKEN
enumerations to theLedgerNameSpace
enum is a clear indication of the introduction of MPToken functionality. The assigned character values are consistent with the existing enumerations, and the changes are well-documented.
140-148
: LGTM!The
getMptID
function is a well-implemented utility for generating unique MPTIDs based on an account ID and a sequence number. The use of big-endian conversion for the sequence number ensures consistent ordering, and the concatenation with the account ID guarantees uniqueness.
466-470
: LGTM!The
mptIssuance
function provides a convenient way to create a keylet for MPTOKEN issuance using an account ID and a sequence number. By leveraging thegetMptID
function and delegating to another overload, it maintains a clean and readable implementation. Thenoexcept
specifier is also a good practice.
472-477
: LGTM!This overload of the
mptIssuance
function provides a straightforward way to create a keylet for MPTOKEN issuance directly from anMPTID
. The use of theindexHash
function with the appropriate namespace ensures that the generated keylet key is unique and consistent. Thenoexcept
specifier is also a good practice.
479-490
: LGTM!The two new overloads of the
mptoken
function provide flexible ways to create keylets for MPTokens. The first overload allows creating a keylet using anMPTID
and a holder'sAccountID
, while the second overload directly uses the issuance key and the holder'sAccountID
. The use of theindexHash
function with the appropriate namespace ensures that the generated keylet keys are unique and consistent. Thenoexcept
specifiers are also a good practice.include/xrpl/protocol/XChainAttestations.h (2)
146-146
: Approve the change fromSTAmount
toSTEitherAmount
forsendingAmount
.The modification to use
STEitherAmount
instead ofSTAmount
for thesendingAmount
parameter is a good change. It suggests that the function now supports a more flexible representation of amounts, potentially allowing for handling different types of amounts, such as native and issued currencies.This change enhances the functionality of the
message
function inAttestationClaim
to work with a broader range of amount types, making it more versatile.
229-230
: Approve the changes fromSTAmount
toSTEitherAmount
forsendingAmount
andrewardAmount
.The modifications to use
STEitherAmount
instead ofSTAmount
for both thesendingAmount
andrewardAmount
parameters in themessage
function ofAttestationCreateAccount
are consistent with the changes made inAttestationClaim
.These changes suggest a broader shift towards supporting more flexible amount representations across the attestation-related functions. By utilizing
STEitherAmount
, the function can now handle a wider range of amount types, such as native and issued currencies, enhancing its versatility and applicability in different scenarios.The consistency in adopting
STEitherAmount
across the attestation functions improves the overall coherence and extensibility of the codebase.src/libxrpl/protocol/LedgerFormats.cpp (2)
368-383
: LGTM!The addition of the
MPTokenIssuance
ledger entry type follows the existing pattern and includes the necessary fields for managing MP token issuances. The required and optional fields are appropriately marked, and the use ofsoeDEFAULT
for default values is consistent with other entry types.
385-396
: LGTM!The addition of the
MPToken
ledger entry type follows the existing pattern and includes the necessary fields for tracking and managing MP tokens owned by accounts. The required and optional fields are appropriately marked, and the use ofsoeDEFAULT
for default values is consistent with other entry types.src/libxrpl/protocol/TxFormats.cpp (5)
165-165
: LGTM!The change to associate the
sfAmount
field in thettPAYMENT
transaction type with multi-party transaction support is consistent with the provided summary and appears to be correct.[consistent_summary]
380-380
: LGTM!The change to associate the
sfAmount
field in thettCLAWBACK
transaction type with multi-party transaction support is consistent with the provided summary and appears to be correct.[consistent_summary]
381-381
: LGTM!The addition of the optional
sfMPTokenHolder
field to thettCLAWBACK
transaction type is consistent with the provided summary and appears to be correct. This change enhances the functionality of the clawback process by allowing the specification of the token holder.[consistent_summary]
518-526
: LGTM!The addition of the
MPTokenIssuanceCreate
transaction type with optional fieldssfAssetScale
,sfTransferFee
,sfMaximumAmount
, andsfMPTokenMetadata
is consistent with the provided summary and appears to be correct. This change enhances the protocol's capabilities for multi-party token management and provides flexibility in the token issuance process.[consistent_summary]
528-533
: LGTM!The addition of the
MPTokenIssuanceDestroy
,MPTokenAuthorize
, andMPTokenIssuanceSet
transaction types with their respective required and optional fields is consistent with the provided summary and appears to be correct. These changes further expand the protocol's capabilities for managing multi-party tokens, allowing for the destruction, authorization, and setting of token issuances and holders.[consistent_summary]
Also applies to: 535-541, 543-549
include/xrpl/basics/base_uint.h (2)
551-551
: LGTM!The new
uint192
type alias is a useful addition to thebase_uint
class, providing support for 192-bit unsigned integers. The change is consistent with the existing type aliases and expands the available options.
637-637
: Looks good!The static assertion for
uint192
is a helpful addition to ensure that the type has the expected size of 24 bytes without any padding. It maintains consistency with the existing static assertions for other bit-width types and helps catch any potential issues at compile-time.src/libxrpl/protocol/STTx.cpp (2)
547-570
: LGTM!The new
invalidMPTAmountInTx
function correctly checks for unsupported MPT amounts in transactions based on the transaction type. This is a valuable addition to the validation logic.
590-594
: LGTM!The modification to
passesLocalChecks
correctly incorporates the newinvalidMPTAmountInTx
check, preventing transactions with unsupported MPT amounts from passing local checks.src/libxrpl/basics/Number.cpp (1)
507-510
: LGTM!The addition of the
operator MPTAmount()
conversion operator to theNumber
class is a logical enhancement that enables seamless conversion fromNumber
instances toMPTAmount
. This change aligns with the broader goal of introducing multi-party token (MPT) functionality to the codebase.The implementation utilizes a static cast of the internal representation (
rep
) of theNumber
instance, which is consistent with the existingoperator XRPAmount()
conversion operator.This addition will facilitate operations and interactions involving
MPTAmount
within the codebase, promoting consistency and interoperability between different amount representations.include/xrpl/protocol/TER.h (2)
128-128
: Approve adding the newtemBAD_MPTOKEN_TRANSFER_FEE
error code.The new
temBAD_MPTOKEN_TRANSFER_FEE
error code in theTEMcodes
enum is a valuable addition for handling malformed fee scenarios specific to multi-party token transfers. This allows for more precise error reporting and suggests an expansion of the protocol's capabilities in managing multi-party token use cases.
344-348
: Approve adding the newtecMPTOKEN_*
andtecMPT_*
error codes.The addition of the new
tecMPTOKEN_EXISTS
,tecMPT_MAX_AMOUNT_EXCEEDED
,tecMPT_LOCKED
,tecMPT_NOT_SUPPORTED
, andtecMPT_ISSUANCE_NOT_FOUND
error codes to theTECcodes
enum is a significant enhancement for handling multi-party token transactions.These granular tec-class codes enable precise error reporting for various failure scenarios specific to multi-party tokens, such as pre-existing tokens, exceeded limits, locked tokens, unsupported operations, and missing issuances.
The expanded error code range demonstrates a substantial improvement in the protocol's capabilities to support and manage multi-party token use cases with well-defined error conditions. This enhances the overall robustness and clarity in communicating transaction failures to clients.
src/libxrpl/protocol/TER.cpp (4)
88-88
: LGTM!The new error code
tecMPT_NOT_SUPPORTED
is added correctly to handle scenarios where MPT functionality is not supported.
119-120
: LGTM!The new error codes
tecMPTOKEN_EXISTS
andtecMPT_MAX_AMOUNT_EXCEEDED
are added correctly to handle specific scenarios related to MPToken functionality.
121-122
: LGTM!The new error codes
tecMPT_LOCKED
andtecMPT_ISSUANCE_NOT_FOUND
are added correctly to handle specific scenarios related to MPToken functionality.
205-205
: LGTM!The new error code
temBAD_MPTOKEN_TRANSFER_FEE
is added correctly to handle scenarios where the provided MPToken transfer fee is malformed and outside the valid range of 1 to 5000, inclusive.src/libxrpl/protocol/STObject.cpp (4)
607-611
: LGTM!The new
getFieldH192
function looks good. It correctly retrieves a 192-bit hash value from the object using thegetFieldByValue
template and returns it as auint192
.
636-637
: Good use of a static empty object for missing fields.Returning a const reference to a static empty
STEitherAmount
when the field is not found is a good way to handle missing fields. It avoids null reference issues while minimizing object allocations.
640-645
: LGTM!The new
getFieldAmount
overload looks good. It allows retrieving anSTAmount
from anSTEitherAmount
field using theTypedVariantField
. This maintains backward compatibility for code that expects anSTAmount
.
759-761
: Verify all callers have been updated to pass an STEitherAmount.The function signature has been changed to take an
STEitherAmount
parameter instead ofSTAmount
. This is a breaking change.Run the following script to find all callers of
setFieldAmount
and ensure they have been updated to pass anSTEitherAmount
:Verification successful
To further verify the compatibility between
STAmount
andSTEitherAmount
, we need to examine the definition and implementation ofSTEitherAmount
. Let's search for its definition in the codebase.
Existing calls to setFieldAmount using STAmount are compatible with the new signature.
The change to
setFieldAmount
to acceptSTEitherAmount
is backward compatible.STEitherAmount
has an implicit constructor that takesSTAmount
, allowing existing code to work without modifications. This design ensures that calls passingSTAmount
orXRPAmount
remain valid.
- No changes are required for existing
setFieldAmount
calls in the codebase.- The new
STEitherAmount
type adds flexibility while maintaining compatibility withSTAmount
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find all callers of setFieldAmount and check if they pass an STEitherAmount. # Test: Search for calls to setFieldAmount. Expect: Only calls that pass an STEitherAmount. rg --type cpp $'setFieldAmount\(' -A 5Length of output: 20505
Script:
#!/bin/bash # Search for the definition of STEitherAmount rg --type cpp "class STEitherAmount" -A 10Length of output: 1372
src/libxrpl/protocol/Feature.cpp (1)
504-504
: LGTM!The registration of the
MPTokensV1
feature looks good. It enables the potential activation of multi-party tokens functionality in the XRPL protocol while ensuring it requires explicit validator approval.src/libxrpl/protocol/XChainAttestations.cpp (10)
110-110
: LGTM!Extracting
STAmount
fromSTEitherAmount
usingget<STAmount>
ensures the correct type is used for initializingsendingAmount
. This change aligns with the broader transition toSTEitherAmount
for amount handling.
135-135
: Looks good!Wrapping
sendingAmount
inSTEitherAmount
when adding it to theSTObject
ensures consistency with the new approach of usingSTEitherAmount
for amount serialization. This change aligns with the broader transition toSTEitherAmount
for amount handling.
469-469
: LGTM!Extracting
STAmount
fromSTEitherAmount
usingget<STAmount>
ensures the correct type is used for initializingamount
. This change aligns with the broader transition toSTEitherAmount
for amount handling.
506-506
: Looks good!Wrapping
amount
inSTEitherAmount
when adding it to theSTObject
ensures consistency with the new approach of usingSTEitherAmount
for amount serialization. This change aligns with the broader transition toSTEitherAmount
for amount handling.
566-566
: Skipping redundant change.Changing the parameter type from
STAmount
toSTAmount
foramount_
does not introduce any functional changes. This change can be skipped.
579-579
: LGTM!Extracting
STAmount
fromSTEitherAmount
usingget<STAmount>
ensures the correct type is used for initializingamount
. This change aligns with the broader transition toSTEitherAmount
for amount handling.
619-619
: Looks good!Wrapping
amount
inSTEitherAmount
with an explicitsfAmount
field when adding it to theSTObject
ensures consistency with the new approach of usingSTEitherAmount
for amount serialization. Specifying the field explicitly provides clarity about the type of amount being serialized. This change aligns with the broader transition toSTEitherAmount
for amount handling.
567-567
: Skipping redundant change.Changing the parameter type from
STAmount
toSTAmount
forrewardAmount_
does not introduce any functional changes. This change can be skipped.
219-219
: Verify the method signature change in the codebase.Updating the
sendingAmount
parameter type fromSTAmount
toSTEitherAmount
allows the method to handle different types of amounts, enhancing flexibility. This change aligns with the broader transition toSTEitherAmount
for amount handling.Run the following script to verify the method usage:
Verification successful
Method signature change verified and consistently applied
The
AttestationClaim::message
method signature change fromSTAmount
toSTEitherAmount
has been successfully verified across the codebase. All occurrences of the method, including its definition, overload, and usage in tests, consistently use the newSTEitherAmount
parameter type forsendingAmount
.
- src/libxrpl/protocol/XChainAttestations.cpp: Method definition and overload updated
- src/test/jtx/impl/attester.cpp: Test usage updated
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all calls to `AttestationClaim::message` match the new signature. # Test: Search for the method usage. Expect: Only occurrences of the new signature. rg --type cpp -A 5 $'AttestationClaim::message'Length of output: 1456
364-365
: Verify the method signature and implementation changes in the codebase.Updating the
sendingAmount
andrewardAmount
parameter types fromSTAmount
toSTEitherAmount
allows the method to handle different types of amounts, enhancing flexibility. This change aligns with the broader transition toSTEitherAmount
for amount handling.The implementation change of wrapping
sendingAmount
inSTEitherAmount
when adding it to theSTObject
ensures consistency with the new serialization approach.Run the following script to verify the method usage and implementation:
Also applies to: 374-374
Verification successful
To complete our verification, we need to check the types of
sendingAmount
andrewardAmount
in the test file. Let's run an additional script to inspect the relevant part of the test file.
Verification successful: Method signature and implementation changes are consistent across the codebase.
The changes to the
AttestationCreateAccount::message
method signature, updatingsendingAmount
andrewardAmount
fromSTAmount
toSTEitherAmount
, have been correctly implemented and are consistent throughout the codebase. This includes:
- The method definition in src/libxrpl/protocol/XChainAttestations.cpp
- The method usage within the same file
- The test implementation in src/test/jtx/impl/attester.cpp
The transition to
STEitherAmount
for amount handling has been applied consistently, enhancing flexibility while maintaining proper type usage across different parts of the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all calls to `AttestationCreateAccount::message` match the new signature and implementation. # Test: Search for the method usage. Expect: Only occurrences of the new signature and implementation. rg --type cpp -A 10 $'AttestationCreateAccount::message'Length of output: 2386
Script:
#!/bin/bash # Description: Inspect the types of sendingAmount and rewardAmount in the test file # Search for the relevant part of the test file rg --type cpp -A 20 -B 10 'AttestationCreateAccount::message' src/test/jtx/impl/attester.cppLength of output: 750
include/xrpl/protocol/SField.h (5)
45-45
: LGTM!The forward declaration of
STEitherAmount
is a valid addition to support the new multi-party token (MPT) functionality.
60-101
: LGTM!The
XMACRO
update to includeSTI_EITHER_AMOUNT
with the same serialization ID asSTI_AMOUNT
is a clever way to maintain backward compatibility while introducing the newSTEitherAmount
type. The comments provide clear reasoning for this design choice.
332-376
: LGTM!The introduction of
TypedVariantField
andOptionaledVariantField
provides a type-safe and expressive way to handle variant fields in the XRPL protocol. The template parameters allow specifying the variant type and its alternative type at compile time, enabling direct access to the desired type throughSTObject::operator[]()
.The code is well-structured, properly templated, and includes clear documentation with examples demonstrating its usage. The
operator~
overload for creating anOptionaledVariantField
is a nice touch for concise syntax.Overall, this is a solid addition to the codebase.
394-395
: LGTM!The updates to the
SF_AMOUNT
andSF_EITHER_AMOUNT
type aliases are consistent with the introduction ofTypedVariantField
andSTEitherAmount
.
SF_AMOUNT
now allows fields to represent either anSTAmount
or anSTEitherAmount
, which is useful for fields that don't support MPT. On the other hand,SF_EITHER_AMOUNT
represents fields that can hold any type ofSTEitherAmount
.These type aliases provide a clear distinction between MPT-supported fields and those limited to
STAmount
. The changes are well-aligned with the overall MPT implementation.
517-520
: NewSF_UINT64
fields for MPT functionality.The new extern variables
sfMaximumAmount
,sfOutstandingAmount
,sfLockedAmount
, andsfMPTAmount
seem to be related to the MPT functionality. Their names suggest they represent various amounts associated with MPTs.The naming follows the existing
sfXXX
convention, which is good for consistency. However, without more context about their specific usage and purpose, it's hard to determine if the names are fully appropriate.Could you please provide more information about the intended purpose and semantics of these new fields? This will help ensure that their names accurately reflect their usage within the MPT system.
src/libxrpl/protocol/SField.cpp (7)
48-55
: LGTM!The new constructor for
TypedVariantField
looks good. It provides a way to construct objects using a private access tag and variadic arguments, ensuring that only authorized code can create instances of this class. Forwarding the arguments to the base class constructor is a clean way to handle the initialization.
110-110
: New SField looks good!The new SField
sfAssetScale
is well-defined with a type ofUINT8
and a unique field value of 20. The naming and type choice seem appropriate for representing an asset scale value.
206-209
: New amount-related SFields look good!The new SFields
sfMaximumAmount
,sfOutstandingAmount
,sfLockedAmount
, andsfMPTAmount
are well-defined with a type ofUINT64
and unique, sequential field values. The naming and type choice seem appropriate for representing various amount-related values.
221-221
: New SField for multi-party token issuance ID looks good!The new SField
sfMPTokenIssuanceID
is well-defined with a type ofUINT192
and a unique field value of 1. The naming and type choice seem appropriate for representing a multi-party token issuance ID.
327-327
: New SField for multi-party token metadata looks good!The new SField
sfMPTokenMetadata
is well-defined with a type ofVL
and a unique field value of 30. The naming and type choice seem appropriate for representing metadata associated with a multi-party token.
340-340
: New SField for multi-party token holder account looks good!The new SField
sfMPTokenHolder
is well-defined with a type ofACCOUNT
and a unique field value of 11. The naming and type choice seem appropriate for representing the account of a multi-party token holder.
260-260
: Type change forsfAmount
looks good, but verify the impact.The type change from
AMOUNT
toEITHER_AMOUNT
for the SFieldsfAmount
seems reasonable, as it allows for more flexibility in representing amount values.However, this change could have implications on how the amount is serialized and deserialized. It's important to verify the impact of this change on the existing codebase and make any necessary updates to handle the new
EITHER_AMOUNT
type correctly.Run the following script to find all occurrences of
sfAmount
in the codebase and review how it's being used:Verification successful
sfAmount type change to EITHER_AMOUNT is correctly implemented and supported.
The modification of sfAmount from AMOUNT to EITHER_AMOUNT has been successfully implemented across the codebase. This change allows for greater flexibility in representing amount values, supporting both traditional AMOUNT and Multi-Purpose Token (MPT) types. Key observations:
- Transaction formats have been updated to use sfAmount with the soeMPTSupported flag where appropriate.
- Ledger formats and inner object formats continue to use sfAmount consistently.
- Many parts of the code already handle sfAmount as an STEitherAmount type, indicating proper implementation throughout the codebase.
- No obvious errors or incompatibilities were introduced by this change.
The codebase appears to have been thoroughly updated to support this modification, and the change is well-integrated across various components.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find all occurrences of `sfAmount` in the codebase. # Test: Search for `sfAmount` usage. Expect: Locations where `sfAmount` is used. rg --type cpp -A 5 $'sfAmount'Length of output: 77676
src/libxrpl/protocol/STParsedJSON.cpp (2)
457-479
: LGTM!The new
case
block for handlingSTI_UINT192
looks good. It follows the same pattern as the existing code for parsing other unsigned integer types from JSON strings. The error handling is consistent, and it correctly handles both valid hex strings and empty strings.
559-560
: Verify the impact of the return type change on the codebase.The return type of the
STI_AMOUNT
case has been changed fromSTAmount
toSTEitherAmount
. This change suggests thatSTEitherAmount
is a new type that provides a more flexible representation of amounts. However, it's important to verify that all the code consuming the parsed amount value is updated to handle the new return type correctly.Run the following script to find all occurrences of
amountFromJson
and ensure that the return value is handled correctly:Verification successful
The change to STEitherAmount is part of a broader refactoring and appears to be properly handled.
After analyzing the codebase, it's evident that the change from
STAmount
toSTEitherAmount
is part of a larger refactoring effort to support both types. TheamountFromJson
andamountFromJsonNoThrow
functions have been updated with overloads to handle bothSTAmount
andSTEitherAmount
. Most of the application code usesamountFromJsonNoThrow
, which has been adapted to work with the newSTEitherAmount
type.The change in
STParsedJSON.cpp
is consistent with these updates, and the rest of the codebase appears to have been modified to accommodate the newSTEitherAmount
type. This suggests that the impact of the change has been carefully considered and implemented across the project.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all occurrences of `amountFromJson` handle the new return type. # Test: Search for `amountFromJson` function calls. Expect: Only occurrences handling `STEitherAmount`. rg --type cpp -A 5 $'amountFromJson'Length of output: 13335
include/xrpl/protocol/STObject.h (12)
29-29
: Provide more context about theRules.h
header.Please explain the purpose of including the
Rules.h
header and how it impacts theSTObject
class. It would be helpful to understand the dependencies introduced by this change.
33-33
: Provide more context about theSTEitherAmount
type.Please explain what the
STEitherAmount
type represents and how it is used within theSTObject
class. Some examples of its usage would be helpful to understand the impact of this change.
58-60
: LGTM! The additional template parameter enhances flexibility.The introduction of the
H
template parameter with a default value ofT
allows theProxy
class to handle a different type thanT
when needed, while still maintaining the existing behavior by default. This change enhances the flexibility of theProxy
class without affecting existing code.
62-63
: LGTM! The additional template parameter enhances flexibility.The introduction of the
H
template parameter with a default value ofT
allows theOptionalProxy
class to handle a different type thanT
when needed, while still maintaining the existing behavior by default. This change enhances the flexibility of theOptionalProxy
class without affecting existing code.
230-231
: LGTM! The new function adds support for 192-bit hash fields.The addition of the
getFieldH192
function allows theSTObject
class to retrieve 192-bit hash values from fields, which is consistent with the existing support for other hash sizes. This change enhances the functionality of the class without introducing any apparent issues.
239-243
: LGTM! The changes support the newSTEitherAmount
type.The modification of the
getFieldAmount
function to return aSTEitherAmount
reference aligns with the introduction of theSTEitherAmount
type for representing amounts in theSTObject
class. The new overload ofgetFieldAmount
that takes aTypedVariantField<STEitherAmount, STAmount>
parameter provides a way to retrieve aSTAmount
reference from fields that can be eitherSTEitherAmount
orSTAmount
, enhancing the flexibility of the class.
264-268
: LGTM! The new overload enhances convenience.The introduction of the new
operator[]
overload that takes aTypedVariantField<T, H>
parameter allows accessing variant fields in a more convenient way. It eliminates the need to explicitly specify the underlying type when retrieving the value of a variant field, improving the usability of theSTObject
class.
282-286
: LGTM! The new overload enhances convenience.The introduction of the new
operator[]
overload that takes anOptionaledVariantField<T, H>
parameter allows accessing optional variant fields in a more convenient way. It returns anoptional<H::value_type>
, handling the case when the field is not present. This improves the usability of theSTObject
class when working with optional variant fields.
299-303
: LGTM! The new overload provides modifiable access to variant fields.The introduction of the new
operator[]
overload that takes aTypedVariantField<T, H>
parameter and returns aValueProxy<T, H>
allows accessing variant fields in a modifiable way. It provides a convenient way to retrieve a modifiable reference to the value of a variant field through theValueProxy
class, enhancing the flexibility of theSTObject
class.
318-322
: LGTM! The new overload provides modifiable access to optional variant fields.The introduction of the new
operator[]
overload that takes anOptionaledVariantField<T, H>
parameter and returns anOptionalProxy<T, H>
allows accessing optional variant fields in a modifiable way. It provides a convenient way to retrieve a modifiable reference to the value of an optional variant field through theOptionalProxy
class, handling the case when the field is not present. This enhances the flexibility of theSTObject
class when working with optional variant fields.
335-339
: LGTM! The new overload provides safe access to variant fields.The introduction of the new
at
overload that takes aTypedVariantField<T, H>
parameter and returns aH::value_type
allows accessing variant fields in a safe way. It retrieves the value of a variant field, throwing an exception if the field is not present. This ensures that the code explicitly handles the case when a required field is missing, improving the reliability of theSTObject
class.
353-357
: LGTM! The new overload provides safe access to optional variant fields.The introduction of the new
at
overload that takes anOptionaledVariantField<T, H>
parameter and returns anoptional<H::value_type>
allows accessing optional variant fields in a safe way. It retrieves the value of an optional variant field as anoptional
, returningnullopt
if the field is not present. This provides a clear and explicit way to handle the presence or absence of an optional field, improving the reliability and readability of the code.src/libxrpl/protocol/STAmount.cpp (6)
88-88
: LGTM!The removal of the
SField const& name
parameter simplifies the constructor and aligns with the other constructors. The deserialization logic remains intact.
181-181
: LGTM!The new private constructor allows creating an
STAmount
object without canonicalization, which can be useful for internal use cases where the input has already been validated. Theunchecked
tag clearly indicates the responsibility of the caller to ensure the validity of the input.
259-261
: LGTM!The modification of the
construct
method to remove theSField const& name
parameter aligns with the changes made to the constructor. The method now creates anSTAmount
object using the simplified constructor.
344-353
: LGTM!The modifications to the addition operator simplify the handling of the native currency case. By using
getSNValue
to retrieve the signed integer values and constructing the result using the modified constructor, the code becomes more concise and aligned with the recent changes.
1011-1011
: LGTM!The modifications to the multiplication operator simplify the handling of the native currency case. By performing the multiplication directly and constructing the result using the modified constructor, the code becomes more concise and aligned with the recent changes. The overflow checks ensure the safety of the operation.
1397-1402
: LGTM!The new operator overload for streaming
STAmount
objects to output streams is a useful addition. It provides a convenient way to output the full text representation ofSTAmount
objects using thegetFullText
method. The implementation is straightforward and follows the expected behavior for stream output operators.include/xrpl/protocol/jss.h (6)
44-45
: LGTM!The new JSON fields
AL_size
andAL_hit_rate
follow the existing naming convention and have clear comments indicating their usage in theGetCounts
output.
50-57
: Looks good!The new AMM-related JSON fields are named consistently, follow existing conventions, and have clear comments indicating their types (transaction or ledger).
60-67
: Approved.The new AMM-related JSON fields have clear naming, follow existing conventions, and include comments specifying their usage as input or output parameters.
99-105
: Looks good to me!The new JSON fields related to multi-party tokens (MPT) are clearly named with the "MPToken" prefix and have comments indicating their types (ledger or transaction). The addition of these fields supports the introduction of MPT functionality in the protocol.
246-250
: Approved.The new JSON fields related to MPT functionality have clear naming that associates them with MPTs and follows existing conventions. The comments specify their usage as input or output parameters, providing additional context.
378-379
: LGTM!The new JSON field
holders
is clearly named, follows existing conventions, and has a comment indicating its usage in theMPTHolders
output, which is related to MPT functionality.
inline bool | ||
isXRP(MPTID const&) | ||
{ | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a TODO comment to indicate that the function needs proper implementation.
The isXRP
function is currently hardcoded to always return false
, regardless of the input MPTID
. This seems to be a placeholder implementation and does not utilize the input parameter.
Consider adding a TODO comment to indicate that the function needs to be properly implemented in the future:
inline bool
isXRP(MPTID const&)
{
+ // TODO: Implement proper logic to determine if the MPTID represents XRP
return false;
}
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
inline bool | |
isXRP(MPTID const&) | |
{ | |
return false; | |
} | |
inline bool | |
isXRP(MPTID const&) | |
{ | |
// TODO: Implement proper logic to determine if the MPTID represents XRP | |
return false; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a valid overload. MPT is never XRP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregtatcam, thank you for the clarification. Understood that MPT is never XRP, so the function correctly returns false
.
🐰🤔
Learnings added
Learnt from: gregtatcam
PR: bachase/rippled#4
File: include/xrpl/protocol/MPTIssue.h:63-67
Timestamp: 2024-09-16T13:21:53.595Z
Learning: MPT is never XRP, so the function `isXRP(MPTID const&)` should always return `false`.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
inline bool | ||
isLegalNet(STMPTAmount const& value) | ||
{ | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding validation in the isLegalNet
function.
The isLegalNet
function currently always returns true
, indicating that all STMPTAmount
values are considered legal in the network. However, it may be beneficial to add some validation logic to ensure that the STMPTAmount
values meet certain criteria before considering them legal.
For example, you could check if the amount falls within a valid range, if the issue (currency) is supported, or if there are any other network-specific rules that need to be satisfied.
By adding appropriate validation, you can enhance the security and integrity of the network by preventing the use of invalid or malicious STMPTAmount
values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to isXRP
above. isLegalNet
checks for valid XRP. It's always true for MPT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregtatcam, thank you for the clarification. I understand that isLegalNet
is intended to always return true
for MPT amounts, similar to isXRP
. I appreciate the explanation.
(^・ω・^)Thinking bunny appreciates the new insight!
Learnings added
Learnt from: gregtatcam
PR: bachase/rippled#4
File: include/xrpl/protocol/STMPTAmount.h:181-185
Timestamp: 2024-09-16T13:23:22.234Z
Learning: In the context of `STMPTAmount`, the `isLegalNet` function is intended to always return `true`, mirroring the behavior of `isXRP` for XRP amounts.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
/** This transaction destroys an existing MPTokenIssuance object. */ | ||
ttMPTOKEN_AUTHORIZE = 56, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistency between the transaction type name and the comment.
The transaction type is named ttMPTOKEN_AUTHORIZE
, which suggests that it is used to authorize an MPTokenIssuance object. However, the comment mentions destroying an existing MPTokenIssuance object, which seems inconsistent with the name.
Please update the comment to accurately reflect the purpose of the ttMPTOKEN_AUTHORIZE
transaction type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregtatcam @shawnxie999 -- this one was an actual catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
STEitherAmount const& | ||
STObject::getFieldAmount(SField const& field) const | ||
{ | ||
static STAmount const empty{}; | ||
return getFieldByConstRef<STAmount>(field, empty); | ||
static STEitherAmount const empty{}; | ||
return getFieldByConstRef<STEitherAmount>(field, empty); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Based on the analysis of the search results, I can provide a final response regarding the change in the return type of getFieldAmount
from STAmount
to STEitherAmount
.
Potential compatibility issues detected with STAmount-specific method calls.
While there are no explicit casts to STAmount or direct comparisons with STAmount, the search results reveal usage of STAmount-specific methods (.native(), .issue(), and .getIssuer()) on the return value of getFieldAmount. This suggests that the existing code assumes an STAmount return type, which may lead to compatibility issues with the new STEitherAmount return type.
Affected files and operations:
- src/xrpld/app/tx/detail/CreateOffer.cpp: .native()
- src/test/jtx/PathSet.h: .issue()
- src/xrpld/app/tx/detail/InvariantCheck.cpp: .issue()
- src/xrpld/app/ledger/OrderBookDB.cpp: .issue()
- src/xrpld/rpc/detail/RPCHelpers.cpp: .getIssuer()
- src/xrpld/rpc/handlers/NoRippleCheck.cpp: .getIssuer()
- src/xrpld/rpc/handlers/AccountLines.cpp: .getIssuer()
- src/xrpld/ledger/detail/View.cpp: .getIssuer()
To ensure compatibility:
- Review the affected files and update the code to handle both STAmount and STEitherAmount return types.
- Consider introducing a compatibility layer or helper functions to safely handle the new return type while maintaining backward compatibility.
- Update unit tests to cover both STAmount and STEitherAmount scenarios.
Analysis chain
Verify all callers have been updated to handle the new return type.
The function signature has been changed to return a const reference to STEitherAmount
instead of STAmount
. This is a breaking change.
Run the following script to find all callers of getFieldAmount
and ensure they have been updated to handle the new return type:
To ensure that the change from STAmount
to STEitherAmount
in the return type of getFieldAmount
is not causing any issues, we need to search for any explicit casts or type-specific operations being performed on the return value. Let's run another search to check for such cases.
This script will search for any usage of getFieldAmount
followed by member access (.
), pointer dereference (->
), as
keyword, static_cast
, or explicit cast to STAmount
. These patterns would indicate type-specific operations that might be affected by the change in return type.
Let's try a series of simpler searches to look for potential type-specific usage of getFieldAmount
results. We'll split our search into multiple commands, each focusing on a specific pattern.
These searches will help us identify if there are any type-specific operations being performed on the results of getFieldAmount
that might be affected by the change from STAmount
to STEitherAmount
.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all callers of getFieldAmount and check if they handle STEitherAmount.
# Test: Search for calls to getFieldAmount. Expect: Only calls that handle STEitherAmount.
rg --type cpp $'getFieldAmount\(' -A 5
Length of output: 47820
Script:
#!/bin/bash
# Search for explicit casts or type-specific operations on getFieldAmount results
rg --type cpp 'getFieldAmount\([^)]+\)\s*(?:\.\w+|\-\>|as\s+\w+|static_cast|\(STAmount\))' -A 3
Length of output: 275
Script:
#!/bin/bash
# Search for type-specific operations on getFieldAmount results
echo "Searching for .native() calls on getFieldAmount results:"
rg --type cpp 'getFieldAmount\([^)]+\)\.native\(\)' -A 2
echo "\nSearching for .issue() calls on getFieldAmount results:"
rg --type cpp 'getFieldAmount\([^)]+\)\.issue\(\)' -A 2
echo "\nSearching for .getCurrency() calls on getFieldAmount results:"
rg --type cpp 'getFieldAmount\([^)]+\)\.getCurrency\(\)' -A 2
echo "\nSearching for .getIssuer() calls on getFieldAmount results:"
rg --type cpp 'getFieldAmount\([^)]+\)\.getIssuer\(\)' -A 2
echo "\nSearching for explicit casts to STAmount:"
rg --type cpp 'static_cast<STAmount>\(.*getFieldAmount\([^)]+\)\)' -A 2
echo "\nSearching for comparisons with STAmount:"
rg --type cpp 'getFieldAmount\([^)]+\)\s*[=!<>]=\s*STAmount' -A 2
Length of output: 4167
High Level Overview of Change
Context of Change
Type of Change
.gitignore
, formatting, dropping support for older tooling)API Impact
libxrpl
change (any change that may affectlibxrpl
or dependents oflibxrpl
)Summary by CodeRabbit
New Features
STEitherAmount
type.Bug Fixes
Documentation
Refactor
STObject
class to manage variant fields more effectively.