-
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.ai. take2 #5
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
WalkthroughThe changes introduce a comprehensive update to the XRPL protocol, adding new functionalities related to multi-party tokens (MPTokens). Key modifications include the introduction of new classes, methods, and enumerations for handling MPTokens, enhancing the protocol's ability to manage token issuance, transfer, and associated metadata. Additionally, several existing classes have been updated to support these new features, allowing for more flexible handling of amounts and improving the overall structure of the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Protocol
participant TokenManager
User->>Protocol: Initiate Token Issuance
Protocol->>TokenManager: Create MPToken
TokenManager-->>Protocol: Return MPToken ID
Protocol-->>User: Confirm MPToken Issuance
sequenceDiagram
participant User
participant Protocol
participant TokenManager
User->>Protocol: Request Token Transfer
Protocol->>TokenManager: Validate Transfer
TokenManager-->>Protocol: Confirm Transfer Validity
Protocol-->>User: Confirm Token Transfer
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
|
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: 7
Outside diff range and nitpick comments (6)
include/xrpl/protocol/MPTIssue.h (1)
1-18
: Verify the accuracy of the copyright year.The copyright notice mentions the year 2024. As an AI language model, my knowledge is based on data up to September 2021, so I cannot determine if this is an accurate future date or a placeholder. Please ensure that the copyright year is correct and update it if necessary.
include/xrpl/basics/MPTAmount.h (4)
38-99
: Consider renaming thejsonClipped
method.The
MPTAmount
class design looks good overall. The constructors, operators, and methods provide a complete interface for working with the amount type.However, the name
jsonClipped
is unclear. Consider renaming it to something more descriptive, such astoJson
ortoJsonValue
, to better convey its purpose.
101-132
: Consider simplifying thesignum
method implementation.The method implementations look good and the use of
constexpr
is appropriate.For the
signum
method, consider using a ternary operator to make the implementation more concise:constexpr int signum() const noexcept { return value_ < 0 ? -1 : (value_ > 0 ? 1 : 0); }
134-153
: Consider usingfmt::format
in theto_string
function.The I/O operators and
to_string
function are implemented correctly.To improve the efficiency of the
to_string
function, consider usingfmt::format
instead ofstd::to_string
:inline std::string to_string(MPTAmount const& amount) { return fmt::format("{}", amount.value()); }This assumes that the
fmt
library is available and included in the project.
155-181
: Consider usingstatic_cast
instead ofconvert_to
.The
mulRatio
function is implemented correctly and handles division by zero and overflow appropriately.To improve the efficiency of the function, consider using
static_cast
instead ofconvert_to
for the final conversion:return MPTAmount(static_cast<MPTAmount::value_type>(r));Since the overflow check ensures that the result fits within the range of
MPTAmount::value_type
, astatic_cast
is safe to use here.src/libxrpl/protocol/STVar.cpp (1)
144-146
: LGTM! Consider adding tests forSTUInt192
.The addition of the
STI_UINT192
case and the correspondingSTUInt192
type enhances the functionality of theSTVar
class by supporting a broader set of data types, which is a valuable expansion.To ensure the robustness of this new functionality, consider adding unit tests that cover the construction, serialization, and deserialization of
STUInt192
objects. This will help catch any potential issues and serve as documentation for the expected behavior.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (51)
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/app/ledger/**
src/xrpld/app/misc/NetworkOPs.cpp
is excluded by!src/xrpld/app/misc/**
src/xrpld/ledger/View.h
is excluded by!src/xrpld/ledger/**
src/xrpld/ledger/detail/View.cpp
is excluded by!src/xrpld/ledger/**
src/xrpld/rpc/DeliveredAmount.h
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/MPTokenIssuanceID.h
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/detail/DeliveredAmount.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/detail/MPTokenIssuanceID.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/detail/RPCHelpers.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/detail/TransactionSign.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/detail/Tuning.h
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/AccountObjects.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/AccountTx.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/Handlers.h
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/LedgerData.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/LedgerEntry.cpp
is excluded by!src/xrpld/rpc/**
src/xrpld/rpc/handlers/Tx.cpp
is excluded by!src/xrpld/rpc/**
Files selected for processing (74)
- .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)
- src/xrpld/app/tx/detail/AMMCreate.cpp (3 hunks)
- src/xrpld/app/tx/detail/AMMDeposit.cpp (3 hunks)
- src/xrpld/app/tx/detail/AMMWithdraw.cpp (3 hunks)
- src/xrpld/app/tx/detail/CashCheck.cpp (4 hunks)
- src/xrpld/app/tx/detail/Clawback.cpp (6 hunks)
- src/xrpld/app/tx/detail/Escrow.cpp (6 hunks)
- src/xrpld/app/tx/detail/InvariantCheck.cpp (7 hunks)
- src/xrpld/app/tx/detail/InvariantCheck.h (2 hunks)
- src/xrpld/app/tx/detail/MPTokenAuthorize.cpp (1 hunks)
- src/xrpld/app/tx/detail/MPTokenAuthorize.h (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp (1 hunks)
- src/xrpld/app/tx/detail/MPTokenIssuanceSet.h (1 hunks)
- src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp (8 hunks)
- src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp (3 hunks)
- src/xrpld/app/tx/detail/NFTokenMint.cpp (3 hunks)
- src/xrpld/app/tx/detail/NFTokenUtils.cpp (1 hunks)
- src/xrpld/app/tx/detail/PayChan.cpp (13 hunks)
- src/xrpld/app/tx/detail/Payment.cpp (16 hunks)
- src/xrpld/app/tx/detail/SetTrust.cpp (1 hunks)
- src/xrpld/app/tx/detail/Transactor.cpp (1 hunks)
- src/xrpld/app/tx/detail/XChainBridge.cpp (11 hunks)
- src/xrpld/app/tx/detail/applySteps.cpp (2 hunks)
Files skipped from review due to trivial changes (2)
- src/xrpld/app/tx/detail/Transactor.cpp
- src/xrpld/app/tx/detail/XChainBridge.cpp
Additional context used
cppcheck
src/xrpld/app/tx/detail/Clawback.cpp
[error] 265-265: Syntax Error
(internalAstError)
src/xrpld/app/tx/detail/Payment.cpp
[error] 713-713: Syntax Error
(internalAstError)
Additional comments not posted (275)
src/xrpld/app/tx/detail/MPTokenIssuanceSet.h (1)
27-44
: LGTM! The class structure follows the standard XRPL transaction processing pattern.The
MPTokenIssuanceSet
class is well-structured and follows the standard XRPL transaction processing pattern withpreflight
,preclaim
, anddoApply
methods. This provides a solid foundation for managing MPToken issuance in the XRPL.Recommendations for the method implementations:
- In the
preflight
method, ensure that all necessary preliminary checks are performed on the transaction context to validate the MPToken issuance request.- In the
preclaim
method, thoroughly validate the transaction before applying it to prevent any invalid or malicious MPToken issuance attempts.- In the
doApply
method, implement the core logic for applying the MPToken issuance transaction efficiently and securely. Ensure proper error handling and consider potential edge cases.- Write comprehensive unit tests to cover all possible scenarios and ensure the correctness of the MPToken issuance process.
src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h (1)
1-48
: LGTM!The
MPTokenIssuanceDestroy
class is well-structured and follows best practices:
- It has a single responsibility of handling the destruction of MP token issuances.
- It uses inheritance appropriately by extending the
Transactor
class.- It declares the necessary methods for handling the transaction lifecycle.
- It uses the
override
,static
,explicit
,const
,constexpr
,public
,namespace
, and header guards appropriately.The class is ready to be integrated into the codebase.
src/libxrpl/protocol/MPTIssue.cpp (4)
26-47
: LGTM!The
MPTIssue
class is well-structured and follows the single responsibility principle by focusing on MPT issuance functionality. The constructor and public methods are properly implemented, providing access to essential information for managing MPT issuances.
30-41
: LGTM!The
getIssuer()
method correctly extracts the issuer's account ID from theMPTID
by skipping the sequence part and copying the relevant portion to anAccountID
object. The use ofmemcpy
is appropriate, and the function returns the expectedAccountID
object.
43-47
: LGTM!The
getMptID()
method correctly returns a constant reference to themptID_
member variable, preventing unnecessary copying and ensuring that the returnedMPTID
cannot be modified.
49-55
: LGTM!The
to_json
function correctly converts anMPTIssue
object into a JSON representation by creating a JSON value and adding the MPT issuance ID as a string using theto_string
function. The JSON keyjss::mpt_issuance_id
is used appropriately, and the function returns the expected JSON value.src/xrpld/app/tx/detail/MPTokenAuthorize.h (2)
27-34
: LGTM!The
MPTAuthorizeArgs
struct is well-designed and encapsulates the necessary parameters for the authorization process. The field names are descriptive, and their types are appropriate. Using a struct to pass multiple related parameters enhances code clarity and maintainability.
36-59
: LGTM!The
MPTokenAuthorize
class is well-designed and follows the SOLID principles by having a single responsibility of handling MP token authorization. The constructor properly initializes the base class, and the static methods are appropriately named and take the necessary parameters for their respective tasks.The
authorize
method encapsulates the core authorization logic and takes anMPTAuthorizeArgs
struct, which enhances code clarity and maintainability. Overriding thedoApply
method allows for custom application logic.Overall, the class is structured effectively and contributes to the broader capabilities of the XRPL framework.
.coderabbit.yml (5)
1-4
: LGTM!The general configuration settings look good:
- The language is set to American English, which is appropriate for the target audience.
- The
early_access
flag is set tofalse
, indicating that the project is not in an early access phase.- The
enable_free_tier
flag is set totrue
, enabling the free tier functionality for the project.
5-32
: LGTM!The code review configuration settings look good:
- The "chill" profile setting suggests a more relaxed code review approach, which can help foster a positive review culture.
- Various code review features are enabled, such as high-level summaries, auto-titling, review status, poem generation, and sequence diagrams, which can enhance the review process and improve communication.
- The path filters help exclude irrelevant files and directories from the code reviews, improving efficiency and focus.
- The auto-review settings enable automated incremental reviews and support for draft PRs, which can streamline the review process.
33-78
: LGTM!The automated tools configuration settings look good:
- A wide range of linting and analysis tools are enabled, covering various languages and aspects of the codebase, such as shell scripts, Python, Markdown, JavaScript, YAML, Git, Kotlin, Ruby, Protocol Buffers, and more.
- Enabling these tools helps maintain code quality, consistency, and security across the project.
- The additional configuration options, such as timeout and level settings, allow for fine-tuning the behavior of certain tools to suit the project's needs.
79-80
: LGTM!The chat configuration settings look good:
- The
auto_reply
flag is set totrue
, which enables the AI to automatically reply to chat messages.- Enabling auto-reply can help provide quick responses and improve user engagement.
81-92
: LGTM!The knowledge base configuration settings look good:
- The
opt_out
flag is set tofalse
, which enables the knowledge base functionality.- The
auto
scope settings forlearnings
,issues
, andpull_requests
allow the AI to automatically learn from these sources, which can help improve its performance and accuracy over time.- The
jira
andlinear
integrations are configured with empty project and team keys, indicating that these integrations are not currently set up. If needed, these keys can be added later to enable integration with these project management tools.src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h (2)
27-37
: LGTM!The
MPTCreateArgs
struct is well-structured and follows the single responsibility principle. The use ofstd::optional
for the optional fields is a good practice.
39-56
: LGTM!The
MPTokenIssuanceCreate
class follows the SOLID principles and has a clear separation of concerns. The class provides a well-defined framework for handling the application logic associated with token issuance.include/xrpl/protocol/MPTIssue.h (4)
28-49
: LGTM!The
MPTIssue
class is well-defined with appropriate constructors, member functions, and comparison operators. The class encapsulates the concept of an MPT issue and provides a clean interface for accessing theMPTID
and issuer's account ID.
51-61
: LGTM!The comparison operators
operator==
andoperator!=
are correctly implemented. They compare themptID_
member variables of the twoMPTIssue
objects and return the appropriate boolean result. Declaring them asconstexpr
is a good optimization.
69-70
: LGTM!The
to_json()
function declaration is correct. It takes anMPTIssue
object as an argument and returns aJson::Value
, which is appropriate for JSON serialization.
23-24
: Verify the inclusion of the header files.The inclusion of the
<xrpl/protocol/AccountID.h>
and<xrpl/protocol/UintTypes.h>
header files seems appropriate. However, it's important to ensure that these header files are available and contain the necessary type definitions forAccountID
andMPTID
.Run the following script to verify the header file inclusion:
Verification successful
To further verify the correctness of the header file inclusions, we should examine the contents of both AccountID.h and UintTypes.h to ensure they contain the necessary type definitions. Let's run another script to inspect these files.
This script will search for the
AccountID
class definition in AccountID.h and theMPTID
type in UintTypes.h, providing us with more information about the contents of these header files.
To complete our verification, we need to investigate the actual definition of AccountID in the AccountID.h file. Let's run another script to search for this definition and also double-check the MPTID usage in MPTIssue.h.
This script will provide us with more context about the AccountID definition and confirm the usage of MPTID in MPTIssue.h.
Header file inclusions are correct and types are properly defined.
The verification process has confirmed that the inclusion of
<xrpl/protocol/AccountID.h>
and<xrpl/protocol/UintTypes.h>
in MPTIssue.h is appropriate and necessary:
AccountID is correctly defined in AccountID.h as a 160-bit unsigned integer type:
using AccountID = base_uint<160, detail::AccountIDTag>;MPTID is properly defined in UintTypes.h as a 192-bit unsigned integer type:
using MPTID = base_uint<192>;Both AccountID and MPTID are used correctly in MPTIssue.h:
- AccountID is likely used in the
getIssuer()
function (not shown in the provided snippet).- MPTID is used as a member variable, in a constructor, and as a return type.
The inclusion of these header files provides the necessary type definitions for MPTIssue.h to function correctly.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the inclusion of the required header files. # Test: Check if the AccountID.h header file exists. Expect: The file should exist. if [ -f "include/xrpl/protocol/AccountID.h" ]; then echo "AccountID.h header file exists." else echo "AccountID.h header file is missing." fi # Test: Check if the UintTypes.h header file exists. Expect: The file should exist. if [ -f "include/xrpl/protocol/UintTypes.h" ]; then echo "UintTypes.h header file exists." else echo "UintTypes.h header file is missing." fiLength of output: 239
Script:
#!/bin/bash # Description: Inspect the contents of AccountID.h and UintTypes.h for required type definitions. echo "Checking AccountID.h for AccountID type definition:" grep -n "class AccountID" include/xrpl/protocol/AccountID.h echo -e "\nChecking UintTypes.h for MPTID type definition:" grep -n "MPTID" include/xrpl/protocol/UintTypes.hLength of output: 601
Script:
#!/bin/bash # Description: Further investigate AccountID definition and MPTID usage echo "Searching for AccountID definition in AccountID.h:" grep -n -A 5 "AccountID" include/xrpl/protocol/AccountID.h echo -e "\nChecking MPTID usage in MPTIssue.h:" grep -n "MPTID" include/xrpl/protocol/MPTIssue.h echo -e "\nChecking for any type aliases or using declarations for AccountID:" grep -n "using AccountID" include/xrpl/protocol/AccountID.hLength of output: 3221
src/libxrpl/basics/MPTAmount.cpp (8)
24-29
: LGTM!The
operator+=
implementation is correct and follows the expected behavior of adding the underlying values of twoMPTAmount
instances.
31-36
: LGTM!The
operator-=
implementation is correct and follows the expected behavior of subtracting the underlying values of twoMPTAmount
instances.
38-42
: LGTM!The unary
operator-
implementation is correct and follows the expected behavior of returning a newMPTAmount
instance with the negated value.
44-48
: LGTM!The
operator==
implementation is correct and follows the expected behavior of comparing the underlying values of twoMPTAmount
instances for equality.
50-54
: LGTM!The
operator==
implementation is correct and follows the expected behavior of comparing the underlying value of anMPTAmount
instance with avalue_type
for equality.
56-60
: LGTM!The
operator<
implementation is correct and follows the expected behavior of comparing the underlying values of twoMPTAmount
instances for less than inequality.
62-77
: LGTM!The
jsonClipped
implementation is correct and follows the expected behavior of converting theMPTAmount
to a JSON-compatible integer value, clipping it to the range ofJson::Int
. The use ofstatic_assert
ensures that the underlyingvalue_type
is a signed integral type, providing type safety.
79-83
: LGTM!The
minPositiveAmount
implementation is correct and follows the expected behavior of returning the minimum positiveMPTAmount
value.include/xrpl/protocol/Rate.h (2)
24-24
: LGTM!The inclusion of the
STMPTAmount.h
header is necessary for the subsequent code changes related to theSTMPTAmount
type.
71-72
: LGTM!The new overload of the
multiply
function forSTMPTAmount
is a valuable addition that extends the functionality of the module to support multi-party token amounts. It is implemented correctly and does not modify the behavior of the existing overload forSTAmount
.src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp (3)
28-42
: LGTM!The
preflight
function correctly performs the necessary checks for destroying an MP token issuance:
- Checks if the
featureMPTokensV1
feature is enabled.- Calls
preflight1
for initial flag validation.- Ensures no invalid flags are set using the
tfMPTokenIssuanceDestroyMask
.- Calls
preflight2
for further validation if all checks pass.The logic is sound and follows the expected flow.
44-62
: LGTM!The
preclaim
function performs the necessary validation before destroying an MP token issuance:
- Ensures the issuance exists by reading it from the ledger using the
sfMPTokenIssuanceID
field.- Verifies that the issuer of the issuance matches the transaction submitter.
- Checks that the issuance has no outstanding balances by verifying the
sfOutstandingAmount
field.The function returns appropriate error codes if any of the conditions are not met, and returns
tesSUCCESS
if all checks pass. The logic is correct and follows the expected validation steps.
64-80
: LGTM!The
doApply
function correctly executes the destruction of an MP token issuance:
- Retrieves the MP token issuance object using the
sfMPTokenIssuanceID
field from the transaction.- Removes the issuance's directory entry from the issuer's owner directory using
dirRemove
.- Erases the issuance object from the ledger using
erase
.- Adjusts the issuer's owner count by calling
adjustOwnerCount
with a value of -1.The function returns
tefBAD_LEDGER
if the directory removal fails, and returnstesSUCCESS
if all operations succeed. The logic is sound and follows the expected steps for destroying an MP token issuance.include/xrpl/protocol/Issue.h (1)
49-50
: LGTM!The
getIssuer
function is a well-designed getter method that provides read-only access to theaccount
member variable of theIssue
class. It follows the naming convention, is marked asconst
, and adheres to the Single Responsibility Principle.The addition of this function improves data encapsulation and provides a convenient way to retrieve the issuer associated with an
Issue
object, which is likely crucial for operations involving asset management or transaction processing within the XRPL framework.The function does not introduce any breaking changes or compatibility issues, as it is a new addition to the
Issue
class.src/libxrpl/protocol/Rate2.cpp (1)
57-68
: LGTM!The new
multiply
function forSTMPTAmount
is well-implemented and follows best practices:
- The assertion at the beginning prevents division by zero errors.
- The check for
parityRate
optimizes performance by avoiding unnecessary calculations.- The multiplication logic is correct, and the adjustment factor maintains precision.
- The function is well-structured and follows the existing coding style and conventions.
Overall, this addition enhances the functionality of the module by allowing it to handle
STMPTAmount
types consistently with other amount types, without any apparent side effects or impact on other parts of the codebase.src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp (3)
49-49
: LGTM!The explicit type casting of
ctx.tx[sfAmount]
toSTAmount
improves type safety and ensures that the field is of the expected type. This change enhances the robustness of the code without affecting the functionality.
82-82
: LGTM!The explicit type casting of
ctx.tx[sfAmount]
toSTAmount
improves type safety and ensures that the field is of the expected type. This change enhances the robustness of the code without affecting the functionality.
98-98
: LGTM!The explicit type casting of
ctx_.tx[sfAmount]
toSTAmount
improves type safety and ensures that the field is of the expected type. This change enhances the robustness of the code without affecting the functionality.src/libxrpl/protocol/Issue.cpp (1)
29-33
: LGTM!The new
getIssuer()
function is a straightforward getter that returns a constant reference to theaccount
member variable. The implementation is correct and follows best practices:
- The function is marked as
const
, which is appropriate since it does not modify the object's state.- Returning a constant reference is efficient and avoids unnecessary copying.
- The function name is clear and follows the naming convention for getter functions.
Overall, this is a clean and useful addition to the
Issue
class.include/xrpl/protocol/TxMeta.h (3)
111-111
: LGTM!The change in the
setDeliveredAmount
method signature to acceptSTEitherAmount
is consistent with the overall theme of the PR to support more flexible handling of amounts.Please ensure that all the callers of this method within the
TxMeta
class have been updated to passSTEitherAmount
instead ofSTAmount
.
135-135
: LGTM!The change in the
mDelivered
member variable type fromstd::optional<STAmount>
tostd::optional<STEitherAmount>
is consistent with the overall theme of the PR to support more flexible handling of amounts.Please ensure that all the code that accesses this member variable directly within the
TxMeta
class has been updated to handle the new type.
116-116
: Verify the method return type change in the codebase.The change in the
getDeliveredAmount
method return type fromSTAmount
toSTEitherAmount
is consistent with the overall theme of the PR to support more flexible handling of amounts.Please ensure that all the callers of this method have been updated to handle the new return type.
Run the following script to verify the method usage:
Verification successful
To further verify the correct usage of the updated
getDeliveredAmount
method, we need to inspect how its return value is being used. Let's run an additional script to gather this information.
Changes to
getDeliveredAmount
have been correctly implemented in the observed file.The
getDeliveredAmount
method's return type has been successfully updated tostd::optional<STEitherAmount>
in src/xrpld/rpc/detail/DeliveredAmount.cpp. The usage of this method is consistent with the new return type, and the calling code appears to be prepared to handle the updated type.However, while we've verified the usage in this specific file, there might be other files in the codebase that use
getDeliveredAmount
. It's recommended to manually check other potential usages to ensure full compatibility across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all callers of the `getDeliveredAmount` method have been updated to handle the new return type. # Test: Search for the method usage. Expect: Only occurrences with the new return type. rg --type cpp -A 5 $'getDeliveredAmount'Length of output: 4498
Script:
#!/bin/bash # Description: Inspect usage of getDeliveredAmount return value # Search for assignments or direct usage of getDeliveredAmount rg --type cpp -A 5 -B 2 'getDeliveredAmount\(\)|\bgetDeliveredAmount\b.*=' src/xrpld/rpc/detail/DeliveredAmount.cpp # Search for any STEitherAmount usage in the same file rg --type cpp -A 3 -B 1 'STEitherAmount' src/xrpld/rpc/detail/DeliveredAmount.cppLength of output: 911
src/libxrpl/protocol/UintTypes.cpp (1)
129-134
: LGTM!The addition of the
noMPT
function is a useful enhancement that provides a way to retrieve a default or "no"MPTID
value, similar to the existingnoCurrency
function. The implementation is straightforward and unlikely to introduce any issues.include/xrpl/protocol/UintTypes.h (2)
61-66
: LGTM!The introduction of the
MPTID
type definition is a good addition. The comments provide clear context about the current and future usage of MPTID.
76-78
: LGTM!The introduction of the
noMPT()
function declaration is a good addition. The comment provides clear context about the usage ofnoMPT()
.src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp (3)
28-52
: LGTM!The
preflight
function performs necessary checks to ensure the validity of the transaction. It checks for the following:
- If the MPTokens feature is enabled.
- If any invalid flags are set.
- If both
tfMPTLock
andtfMPTUnlock
flags are set.- If the account initiating the transaction is the same as the token holder.
It returns appropriate error codes if any of these checks fail, preventing invalid transactions from being processed.
54-84
: LGTM!The
preclaim
function ensures that the transaction is authorized and the referenced objects exist in the ledger. It performs the following checks:
- If the issuance exists by reading the
mptIssuance
record from the ledger.- If locking is permitted for the issuance by checking the
lsfMPTCanLock
flag.- If the issuer of the issuance matches the account submitting the transaction.
- If a token holder is specified, it checks if the holder account exists.
- If the corresponding token exists for the specified issuance and holder.
It returns appropriate error codes if any of these checks fail, preventing unauthorized modifications to the issuance and ensuring the integrity of the ledger state.
86-116
: LGTM!The
doApply
function applies the requested changes to the issuance or token record in the ledger. It performs the following steps:
- Retrieves the issuance ID and transaction flags from the transaction context.
- Retrieves the issuance or token record from the ledger based on the presence of a token holder in the transaction.
- Updates the flags in the record based on the transaction flags (
tfMPTLock
andtfMPTUnlock
).- Writes the updated record back to the ledger if the flags have changed.
It ensures that the changes are properly reflected in the ledger state.
include/xrpl/protocol/STBitString.h (2)
87-87
: LGTM!The new
STUInt192
alias forSTBitString<192>
is a logical addition that expands the functionality to handle 192-bit unsigned integers. It follows the existing naming convention and integrates well with the available types.
140-145
: LGTM!The
getSType()
specialization forSTUInt192
correctly returns theSTI_UINT192
serialized type identifier. It follows the existing pattern for otherSTUInt
types and is necessary for proper serialization and deserialization of the new type.src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp (3)
28-68
: LGTM!The preflight checks for creating MP Token issuances are comprehensive and cover all the necessary validations, including:
- Checking if the
featureMPTokensV1
is enabled.- Validating transaction flags.
- Ensuring the transfer fee is within the allowed range.
- Checking if the
tfMPTCanTransfer
flag is set when a non-zero transfer fee is specified.- Validating the metadata length.
- Ensuring the maximum amount is non-zero and within the allowed range.
The function returns appropriate error codes for each validation failure.
70-123
: LGTM!The
create
function handles the creation of MP Token issuances correctly:
- It checks if the account exists and returns an appropriate error code if not.
- It verifies if the prior balance meets the reserve requirements and returns an error if insufficient.
- It creates a new MP Token issuance record with the necessary fields, including flags, issuer account, outstanding amount, sequence number, and optional fields like maximum amount, asset scale, transfer fee, and metadata.
- It inserts the new issuance record into the ledger and updates the owner count.
The function is well-structured and follows the necessary steps for creating an MP Token issuance.
125-140
: LGTM!The
doApply
function orchestrates the application of the MP Token issuance creation transaction correctly:
- It extracts the necessary parameters from the transaction context, including the prior balance, account, sequence number, flags, maximum amount, asset scale, transfer fee, and metadata.
- It passes these parameters to the
create
function to handle the actual creation of the MP Token issuance.The function is concise and delegates the creation logic to the appropriate function.
include/xrpl/protocol/Protocol.h (2)
98-99
: LGTM!The constant
maxMPTokenMetadataLength
is declared correctly with an appropriate value.
101-102
: LGTM!The constant
maxMPTokenAmount
is declared correctly with the maximum value for a 64-bit unsigned integer.include/xrpl/protocol/STMPTAmount.h (12)
32-100
: Class structure and design look good!The
STMPTAmount
class is well-structured and follows the SOLID principles. The private memberissue_
encapsulates the associatedMPTIssue
, and the public methods provide a clear and consistent interface for interacting withSTMPTAmount
objects.
41-41
: Skipped reviewing constructor implementation.The constructor
STMPTAmount(SerialIter& sit)
is declared but not defined in this header file. Assuming the implementation correctly deserializes theSTMPTAmount
object from the providedSerialIter
.
42-45
: Constructor declaration looks good!The constructor
STMPTAmount(MPTIssue const& issue, std::uint64_t value, bool negative = false)
takes the appropriate parameters to initialize anSTMPTAmount
object with a specific issue, value, and sign. The use of const references and default value for thenegative
flag is appreciated.
46-46
: Constructor declaration looks good!The constructor
STMPTAmount(MPTIssue const& issue, std::int64_t value = 0)
takes the appropriate parameters to initialize anSTMPTAmount
object with a specific issue and value. The use of const reference and default value for thevalue
parameter is appreciated.
47-47
: Constructor declaration looks good!The constructor
explicit STMPTAmount(value_type value = 0)
is marked asexplicit
to prevent implicit conversions, which is a good practice. The default value for thevalue
parameter is sensible.
49-50
: Method declaration looks good!The method
SerializedTypeID getSType() const
is declared as a const member function, which is appropriate since it does not modify the object's state. Returning theSerializedTypeID
is useful for serialization and deserialization purposes.
52-53
: Method declaration looks good!The method
std::string getFullText() const
is declared as a const member function, which is appropriate since it does not modify the object's state. Returning the full text representation is useful for debugging and logging purposes.
55-56
: Method declaration looks good!The method
std::string getText() const
is declared as a const member function, which is appropriate since it does not modify the object's state. Returning a string representation is useful for displaying theSTMPTAmount
object.
58-58
: Method declaration looks good!The method
Json::Value getJson(JsonOptions) const
is declared as a const member function, which is appropriate since it does not modify the object's state. Returning aJson::Value
representation is useful for JSON serialization of theSTMPTAmount
object. TheJsonOptions
parameter allows customizing the JSON serialization behavior.
60-61
: Method declaration looks good!The method
void add(Serializer& s) const
is declared as a const member function, which is appropriate since it does not modify the object's state. It takes aSerializer
reference as a parameter, suggesting that it is used for serializing theSTMPTAmount
object into the providedSerializer
.
63-64
: Method declaration looks good!The method
void setJson(Json::Value& elem) const
is declared as a const member function, which is appropriate since it does not modify the object's state. It takes aJson::Value
reference as a parameter, suggesting that it is used for setting theSTMPTAmount
object's JSON representation into the providedJson::Value
reference.
66-67
: Method declaration looks good!The method
bool isDefault() const
is declared as a const member function, which is appropriate since it does not modify the object's state. Returning a boolean value indicating whether theSTMPTAmount
object is in its default state is useful for validation and comparison purposes.include/xrpl/protocol/SOTemplate.h (3)
43-44
: LGTM!The new
SOETxMPTAmount
enum provides a clear and concise way to categorize the support for MPT in amount fields. The enum values are well-named and self-explanatory.
54-54
: LGTM!The addition of the
supportMpt_
member variable and the corresponding constructor changes allow theSOElement
class to effectively track and manage the MPT support status for each instance. The constructors provide the necessary flexibility to initializesupportMpt_
based on different scenarios, and the default value ofsoeMPTNotSupported
in the third constructor aligns with the expected behavior.Also applies to: 56-90
103-108
: LGTM!The new
supportMPT()
method provides a clean and straightforward way to retrieve the value of thesupportMpt_
member variable for an instance ofSOElement
. Theconst
declaration ensures that the method does not modify the object's state, which is appropriate for a getter method.include/xrpl/basics/MPTAmount.h (1)
1-37
: LGTM!The license header and includes are appropriate for the file.
src/libxrpl/protocol/STMPTAmount.cpp (14)
29-40
: LGTM!The constructor correctly deserializes an
STMPTAmount
object from the providedSerialIter
. It checks for thecMPToken
flag, reads the amount value and issue identifier, and negates the amount if necessary based on thecPositive
flag.
42-45
: LGTM!The constructor correctly initializes an
STMPTAmount
object with the providedMPTIssue
and value. It delegates the initialization of thevalue_
member to the base class constructor.
47-58
: LGTM!The constructor correctly initializes an
STMPTAmount
object with the providedMPTIssue
, unsigned 64-bit integer value, and boolean indicating whether the value is negative. It checks if the value is within the valid range, casts it to a signed 64-bit integer, and negates it if necessary.
60-62
: LGTM!The constructor correctly initializes an
STMPTAmount
object with the provided value by delegating the initialization to the base class constructor.
64-68
: LGTM!The function correctly returns the serialized type ID for
STMPTAmount
objects.
70-78
: LGTM!The function correctly generates the full text representation of the
STMPTAmount
object by concatenating the amount value and MPT ID.
80-84
: LGTM!The function correctly returns the string representation of the amount value.
86-91
: LGTM!The function correctly generates the JSON representation of the
STMPTAmount
object by creating aJson::Value
object, populating it using thesetJson
function, and returning the populated object.
93-98
: LGTM!The function correctly sets the JSON representation of the
STMPTAmount
object in the providedJson::Value
object by setting the"mpt_issuance_id"
and"value"
fields.
100-109
: LGTM!The function correctly serializes the
STMPTAmount
object and adds it to the providedSerializer
object. It sets the appropriate flags in theu8
byte, adds theu8
byte, the absolute value ofvalue_
, and the MPT ID to the serializer.
111-115
: LGTM!The function correctly checks if the
STMPTAmount
object represents the default value by comparing thevalue_
member to 0 and theissue_
member tonoMPT()
.
117-121
: LGTM!The function correctly returns the issuer of the MPT amount by calling
issue_.getIssuer()
.
123-127
: LGTM!The function correctly returns the MPT ID of the MPT amount by calling
issue_.getMptID()
.
129-133
: LGTM!The function correctly returns the
MPTIssue
object associated with the MPT amount.src/libxrpl/protocol/TxMeta.cpp (1)
147-147
: Verify the usage ofSTEitherAmount
across the codebase.The change from
STAmount
toSTEitherAmount
suggests that thefield
object is expected to be of a different type. This change is likely intended to handle a broader set of amount representations.To ensure this change does not introduce any unintended side effects, please verify that:
STEitherAmount
is used consistently across the codebase for handling amounts.- The rest of the logic in
getAffectedAccounts
and other related methods is compatible with theSTEitherAmount
type.You can use the following script to search for
STEitherAmount
usage:Verification successful
Approve the change from
STAmount
toSTEitherAmount
The change from
STAmount
toSTEitherAmount
is part of a larger update to support Multi-Purpose Tokens (MPT) as per XLS-33d. This modification allows for more flexible handling of different token types in the XRPL.The
STEitherAmount
type is designed to work alongsideSTAmount
, providing compatibility with existing code while extending functionality for new token types. This change in thegetAffectedAccounts
method ensures that the code can handle both traditional amounts and the new MPT amounts.Developers working with this code should be aware of the following:
STEitherAmount
is now used in place ofSTAmount
in some scenarios, particularly in transaction processing.- Existing
STAmount
usage remains valid in many parts of the codebase.- When working with amounts, check whether
STEitherAmount
orSTAmount
is more appropriate based on the context and whether MPT support is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify `STEitherAmount` usage across the codebase. # Test 1: Search for `STEitherAmount` usage in `.cpp` and `.h` files. # Expect: Multiple occurrences across the codebase. rg --type cpp --type hpp $'STEitherAmount' # Test 2: Search for `getAffectedAccounts` method usage. # Expect: Occurrences in `.cpp` files where the return value is used. rg --type cpp -A 5 $'getAffectedAccounts'Length of output: 1538
Script:
#!/bin/bash # Description: Further investigation of STEitherAmount and related types # Search for STEitherAmount in all C++ source and header files rg --type cpp --type-add 'cpp:*.hpp' 'STEitherAmount' # Search for STAmount to see if it's the correct type rg --type cpp --type-add 'cpp:*.hpp' 'STAmount' # Look for any recent changes involving STEitherAmount or similar types git log -S 'STEitherAmount' --since="1 month ago" git log -S 'STAmount' --since="1 month ago" # Search for any definitions or declarations of classes starting with ST rg --type cpp --type-add 'cpp:*.hpp' 'class ST[A-Z]\w+'Length of output: 223593
src/libxrpl/protocol/STVar.cpp (3)
203-203
: Consistent with the previous change toSTI_AMOUNT
.This modification aligns with the earlier change to the
STI_AMOUNT
case, promoting the use ofSTEitherAmount
for representing amounts.Please refer to the previous comment about verifying the compatibility of
STEitherAmount
with the existing codebase to ensure a smooth transition.
211-213
: Consistent with the previous addition ofSTI_UINT192
.This modification aligns with the earlier addition of the
STI_UINT192
case, enhancing the functionality of theSTVar
class by supporting a broader set of data types.Please refer to the previous comment about considering the addition of unit tests for the new
STUInt192
type to ensure its robustness and document its expected behavior.
136-136
: EnsureSTEitherAmount
is compatible with existing code.The change from
STAmount
toSTEitherAmount
for theSTI_AMOUNT
case allows for more flexible handling of amounts, which is a good improvement.However, it's crucial to verify that all code relying on the
STI_AMOUNT
case is compatible with the newSTEitherAmount
type to avoid any unexpected behavior or compile errors.Run the following script to find all occurrences of
STI_AMOUNT
in the codebase and review how the constructed object is used:Verification successful
Change to
STEitherAmount
is consistently implemented and maintains compatibility.The review of the codebase shows that the change from
STAmount
toSTEitherAmount
for theSTI_AMOUNT
case has been consistently applied across relevant files. The newSTEitherAmount
type appears to be designed for compatibility with existing code:
- It's used consistently in constructors and parsers.
- It maintains the
STI_AMOUNT
type identifier for backward compatibility.- It supports both regular amounts and MPT (Multi-Protocol Token) amounts.
The coexistence of
STI_AMOUNT
andSTI_EITHER_AMOUNT
in SField.h further supports backward compatibility while introducing the more flexibleSTEitherAmount
type.Based on this analysis, the change appears to be well-implemented and should not cause compatibility issues with existing code.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find all occurrences of `STI_AMOUNT` and review usage. rg --type cpp $'STI_AMOUNT' -A 5Length of output: 3021
include/xrpl/protocol/STEitherAmount.h (5)
28-34
: LGTM!The concepts
ValidAmountType
andEitherAmountType
are well-defined and serve a clear purpose in constraining template parameters for type safety.
36-126
: LGTM!The
STEitherAmount
class is well-designed and follows the SOLID principles:
- It has a clear single responsibility of holding either
STAmount
orSTMPTAmount
.- It is open for extension but closed for modification by inheriting from
STBase
.- It uses the Liskov substitution principle by properly overriding virtual methods from the base class.
- It has a clear and concise interface for accessing the stored value.
- It uses C++17 features such as
std::variant
to efficiently store the amount.
128-177
: LGTM!The
get
function template is well-designed and uses modern C++17 features:
- It uses
if constexpr
to handle different cases based on the type of the input parameter at compile-time.- It provides a convenient way to retrieve the stored amount of a specific type.
- It throws an exception if the requested type does not match the stored type, ensuring type safety.
- It handles both
STEitherAmount
andstd::optional<STEitherAmount>
types, providing flexibility.
179-189
: LGTM!The utility functions for converting JSON values to
STEitherAmount
andSTAmount
are well-designed:
- They provide a convenient way to convert JSON values to
STEitherAmount
andSTAmount
types.- They take an
SField
parameter to specify the field name, providing context for the conversion.- The "NoThrow" versions of the functions allow for error handling without using exceptions.
Please ensure that the implementations of these functions are correct and handle all possible cases. Consider adding unit tests to verify their behavior.
191-264
: LGTM!The code segment is well-designed and provides useful utility functions:
- The comparison operators for
STEitherAmount
usestd::visit
to compare the stored amounts based on their types.- The
isMPT
andisIssue
function templates provide a convenient way to check the type of an amount.- The
isXRP
function checks if anSTEitherAmount
represents XRP by checking if it holds anSTAmount
and callingisXRP
on it.- The specialization of the
Json::getOrThrow
function template forSTAmount
allows for convenient retrieval ofSTAmount
from a JSON value.include/xrpl/protocol/TxFormats.h (3)
202-203
: Verify the impact of adding the new transaction typettMPTOKEN_ISSUANCE_CREATE
.The addition of a new transaction type is a significant change that could impact the protocol and the codebase. Please ensure that:
- The chosen value of 54 does not conflict with any existing or reserved transaction types.
- The creation of MPTokenIssuance objects is properly implemented.
- All relevant code paths are updated to handle this new transaction type.
Run the following script to verify the handling of the new transaction type:
Verification successful
To gather more information about the implementation of MPTokenIssuance, let's run additional scripts:
The new transaction type
ttMPTOKEN_ISSUANCE_CREATE
is properly implemented and integrated.The codebase analysis confirms that:
- The new transaction type is well-defined and used consistently.
- Related transaction types (
ttMPTOKEN_ISSUANCE_DESTROY
,ttMPTOKEN_AUTHORIZE
,ttMPTOKEN_ISSUANCE_SET
) are also implemented.- Appropriate flags, validations, and error handling are in place.
- The
MPTokenIssuance
class and related functions are implemented across multiple files.- Test cases are included to verify the correct behavior of MPToken-related transactions.
The impact of adding this new transaction type appears to be properly managed throughout the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of the new transaction type `ttMPTOKEN_ISSUANCE_CREATE`. # Test 1: Search for the enum value usage. Expect: Relevant code paths handling the transaction type. rg --type cpp -A 5 $'ttMPTOKEN_ISSUANCE_CREATE' # Test 2: Search for the creation of MPTokenIssuance objects. Expect: Proper implementation. ast-grep --lang cpp --pattern $'MPTokenIssuance::create($$$)'Length of output: 2527
Script:
#!/bin/bash # Description: Verify the implementation of MPTokenIssuance # Search for MPTokenIssuance class definition and methods ast-grep --lang cpp --pattern 'class MPTokenIssuance { $$$ }' # Search for functions or methods related to MPTokenIssuance creation rg --type cpp -A 5 'MPTokenIssuance::' # Search for any usage of MPTokenIssuance rg --type cpp -A 5 'MPTokenIssuance'Length of output: 40336
205-206
: Verify the impact of adding the new transaction typettMPTOKEN_ISSUANCE_DESTROY
.The addition of a new transaction type is a significant change that could impact the protocol and the codebase. Please ensure that:
- The chosen value of 55 does not conflict with any existing or reserved transaction types.
- The destruction of MPTokenIssuance objects is properly implemented.
- All relevant code paths are updated to handle this new transaction type.
Run the following script to verify the handling of the new transaction type:
Verification successful
The new transaction type
ttMPTOKEN_ISSUANCE_DESTROY
is properly implemented and integrated.The verification process has confirmed that:
- The
MPTokenIssuanceDestroy
class is implemented in dedicated files with appropriate methods (preflight, preclaim, doApply).- The new transaction type is correctly handled in the transaction application process and invariant checks.
- The chosen enum value (55) doesn't conflict with other transaction types.
- The implementation includes necessary checks, such as feature flag verification and existence of the MPTokenIssuance object.
While no explicit documentation about valid transaction type ranges was found, the implementation follows the pattern of other transaction types in the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of the new transaction type `ttMPTOKEN_ISSUANCE_DESTROY`. # Test 1: Search for the enum value usage. Expect: Relevant code paths handling the transaction type. rg --type cpp -A 5 $'ttMPTOKEN_ISSUANCE_DESTROY' # Test 2: Search for the destruction of MPTokenIssuance objects. Expect: Proper implementation. ast-grep --lang cpp --pattern $'MPTokenIssuance::destroy($$$)'Length of output: 1967
Script:
#!/bin/bash # Description: Further verify the implementation of MPTokenIssuanceDestroy and check for conflicts with enum value 55 # Test 1: Search for the MPTokenIssuanceDestroy implementation ast-grep --lang cpp --pattern 'struct MPTokenIssuanceDestroy { $$$ }' # Test 2: Check for any other usage of the value 55 in enum definitions rg --type cpp -A 1 -B 1 '\b55\b' | grep -E '(enum|=)' # Test 3: Look for any documentation or comments about reserved transaction type values rg --type cpp "reserved.*transaction.*type|transaction.*type.*reserved"Length of output: 6410
Script:
#!/bin/bash # Description: Locate MPTokenIssuanceDestroy implementation and check for transaction type value documentation # Test 1: Search for any struct or class that might implement MPTokenIssuanceDestroy rg --type cpp -A 5 'struct.*MPTokenIssuanceDestroy|class.*MPTokenIssuanceDestroy' # Test 2: Search for functions that might handle MPTokenIssuanceDestroy rg --type cpp -A 5 'void.*MPTokenIssuanceDestroy|MPTokenIssuanceDestroy::' # Test 3: Look for any documentation or comments about transaction type values or ranges rg --type cpp "transaction.*type.*range|valid.*transaction.*type" # Test 4: Check for usage of ttMPTOKEN_ISSUANCE_DESTROY rg --type cpp -A 3 'ttMPTOKEN_ISSUANCE_DESTROY'Length of output: 3507
211-212
: Verify the impact of adding the new transaction typettMPTOKEN_ISSUANCE_SET
.The addition of a new transaction type is a significant change that could impact the protocol and the codebase. Please ensure that:
- The chosen value of 57 does not conflict with any existing or reserved transaction types.
- The setting of MPTokenIssuance and MPToken objects is properly implemented.
- All relevant code paths are updated to handle this new transaction type.
Run the following script to verify the handling of the new transaction type:
Verification successful
Verification of the new transaction type
ttMPTOKEN_ISSUANCE_SET
implementation is complete.The new transaction type
ttMPTOKEN_ISSUANCE_SET
has been properly implemented and integrated into the XRPL codebase. Key findings include:
- The
MPTokenIssuanceSet
class is defined insrc/xrpld/app/tx/detail/MPTokenIssuanceSet.h
and implemented inMPTokenIssuanceSet.cpp
.- It follows the expected structure for XRPL transaction types, inheriting from
Transactor
and implementing necessary methods (preflight, preclaim, doApply).- The transaction type is correctly integrated into the transaction processing framework in
applySteps.cpp
.- Specific flags (tfMPTLock, tfMPTUnlock) are defined for this transaction type.
- The transaction type is added to the TxFormats in
TxFormats.cpp
.- Test files exist, indicating that the feature has been tested.
The implementation appears to be complete and consistent with the XRPL's transaction handling patterns. No immediate issues or inconsistencies were identified.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of the new transaction type `ttMPTOKEN_ISSUANCE_SET`. # Test 1: Search for the enum value usage. Expect: Relevant code paths handling the transaction type. rg --type cpp -A 5 $'ttMPTOKEN_ISSUANCE_SET' # Test 2: Search for the setting of MPTokenIssuance objects. Expect: Proper implementation. ast-grep --lang cpp --pattern $'MPTokenIssuance::set($$$)' # Test 3: Search for the setting of MPToken objects. Expect: Proper implementation. ast-grep --lang cpp --pattern $'MPToken::set($$$)'Length of output: 1883
Script:
#!/bin/bash # Description: Search for the implementation of MPTokenIssuanceSet and related functions # Search for MPTokenIssuanceSet class or struct definition ast-grep --lang cpp --pattern 'class MPTokenIssuanceSet { $$$ }' ast-grep --lang cpp --pattern 'struct MPTokenIssuanceSet { $$$ }' # Search for functions or methods related to setting MPTokenIssuance or MPToken rg --type cpp -A 5 'MPTokenIssuance.*set' rg --type cpp -A 5 'MPToken.*set' # Search for any functions with 'MPToken' and 'set' in their name ast-grep --lang cpp --pattern 'function $_($$) { $$$ }' | rg 'MPToken.*set'Length of output: 1402
Script:
#!/bin/bash # Description: Further investigation of MPTokenIssuanceSet and related implementations # Search for any mentions of MPTokenIssuanceSet rg --type cpp -A 5 'MPTokenIssuanceSet' # Search for files that might contain the implementation based on the usage in applySteps.cpp fd -e cpp -e h | xargs rg -l 'MPTokenIssuanceSet' # Search for functions or methods related to modifying MPTokens or MPTokenIssuances ast-grep --lang cpp --pattern 'function $_($$$) { $$$ }' | rg -i 'mptoken|mptokenissuance' # Search for any mentions of MPToken or MPTokenIssuance modification rg --type cpp -A 5 -i 'mptoken.*modify|mptokenissuance.*modify'Length of output: 8387
include/xrpl/protocol/Serializer.h (2)
347-349
: LGTM!The
peek8
function is a useful addition that allows inspecting the next byte without modifying the iterator state. The error handling for the case when there are no bytes left is also a good safety check.
380-384
: LGTM!The
get192
function is a good addition that extends the capabilities of theSerialIter
class to handle 192-bit values. The implementation is consistent with the existinggetBitString
method, ensuring uniformity in how bit strings are processed.src/xrpld/app/tx/detail/Clawback.cpp (6)
Line range hint
37-60
: LGTM!The preflight checks for
STAmount
clawback transactions are comprehensive and handle all the necessary validations, including:
- Checking for the availability of the clawback feature
- Validating transaction flags and fields
- Ensuring the issuer and holder are different
- Verifying the clawback amount is not XRP and is positive
The logic flow is clear and the error cases are handled appropriately.
63-93
: LGTM!The preflight checks for
STMPTAmount
clawback transactions are comprehensive and handle all the necessary validations, including:
- Checking for the availability of the clawback and MPTokensV1 features
- Validating transaction flags and fields
- Ensuring the MPT holder field is present
- Verifying the issuer and MPT holder are different
- Checking the clawback amount is within the valid range for MPT amounts
The logic flow is clear and the error cases are handled appropriately.
Line range hint
99-157
: LGTM!The preclaim checks for
STAmount
clawback transactions are comprehensive and handle all the necessary validations, including:
- Checking the existence of issuer and holder accounts
- Validating issuer flags and permissions
- Verifying the existence of the trustline between the holder and issuer
- Checking the permission based on the trustline balance and relative addresses of the issuer and holder
- Ensuring the available balance is positive using
accountHolds
The logic flow is clear and the error cases are handled appropriately.
159-199
: LGTM!The preclaim checks for
STMPTAmount
clawback transactions are comprehensive and handle all the necessary validations, including:
- Checking the existence of issuer and holder accounts
- Verifying the existence and permissions of the issuance object
- Ensuring the issuer of the issuance object matches the transaction issuer
- Checking the existence of the MPToken object for the holder and issuance
- Validating the available balance using
accountHolds
The logic flow is clear and the error cases are handled appropriately.
Line range hint
205-234
: LGTM!The apply logic for
STAmount
clawback transactions is implemented correctly:
- It replaces the issuer field in the clawback amount with the actual issuer account.
- It checks for the invalid case where the holder and issuer are the same.
- It retrieves the spendable balance using
accountHolds
with the appropriate parameters.- It calculates the actual clawback amount by taking the minimum of the spendable balance and the requested amount.
- It calls
rippleCredit
to perform the balance transfer from the holder to the issuer.The logic flow is clear and handles the necessary steps for executing the clawback operation.
Tools
cppcheck
[error] 265-265: Syntax Error
(internalAstError)
236-259
: LGTM!The apply logic for
STMPTAmount
clawback transactions is implemented correctly:
- It retrieves the spendable balance using
accountHolds
with the appropriate parameters for MPT amounts.- It calculates the actual clawback amount by taking the minimum of the spendable balance and the requested amount.
- It calls
rippleCredit
to perform the balance transfer from the holder to the issuer.The logic flow is clear and handles the necessary steps for executing the clawback operation for MPT amounts.
src/xrpld/app/tx/detail/MPTokenAuthorize.cpp (4)
28-44
: LGTM!The
preflight
function correctly performs the necessary checks for MPTokenAuthorize transactions, including:
- Checking if the MPT feature is enabled.
- Validating transaction flags.
- Ensuring account and holder IDs are different.
The error handling is appropriate, returning the correct error codes for various invalid conditions.
46-126
: LGTM!The
preclaim
function correctly performs the necessary validations for MPTokenAuthorize transactions, including:
- Verifying the existence of the holder account.
- Distinguishing between actions taken by the holder and the issuer.
- Enforcing permissions based on account roles (holder vs. issuer).
- Checking conditions for unauthorizing (zero obligations) and creating (MPToken doesn't already exist) MPTokens.
- Validating the existence of necessary objects (MPToken issuance, MPToken).
The error handling is appropriate, returning the correct error codes for various invalid conditions.
128-235
: LGTM!The
authorize
function correctly handles the authorization logic for MPTokenAuthorize transactions, including:
- Distinguishing between actions taken by the holder and the issuer.
- Handling unauthorization requests by removing the MPToken from the owner directory, adjusting the owner count, and erasing the MPToken object.
- Handling authorization requests by checking reserve requirements, inserting a new entry in the owner directory, creating a new MPToken object, and adjusting the owner count.
- Enforcing issuer permissions when modifying MPToken flags.
- Ensuring the necessary objects (account, MPToken issuance, MPToken) exist and returning appropriate error codes when they are missing.
The function correctly updates the ledger state based on the transaction type and maintains consistency in the owner directory and owner count.
237-249
: LGTM!The
doApply
function serves as a simple entry point for applying MPTokenAuthorize transactions. It correctly extracts the necessary fields from the transaction and passes them to theauthorize
function.The function relies on the
authorize
function to perform the actual authorization logic and returns the result of that function, which is appropriate.include/xrpl/basics/Number.h (2)
56-56
: LGTM!The new constructor enhances the flexibility of the
Number
class by allowing it to be initialized from anMPTAmount
object, similar to the existing support forXRPAmount
. This expands the usability of the class without altering its core logic.
94-94
: LGTM!The new explicit conversion operator
operator MPTAmount() const
complements the new constructorNumber(MPTAmount const& x)
and ensures that the integration withMPTAmount
is complete and consistent. The rounding behavior is consistent with the existingXRPAmount
conversion, and the constructor implementation is straightforward and maintains the existing functionality of theNumber
class.Also applies to: 216-219
include/xrpl/protocol/Indexes.h (6)
290-291
: LGTM!The function correctly constructs a
Keylet
for an MPT issuance using the providedAccountID
and sequence number. Thenoexcept
specifier is appropriate since this function does not throw exceptions.
293-294
: LGTM!This overload of
mptIssuance
correctly constructs aKeylet
for an MPT issuance directly from the providedMPTID
. Thenoexcept
specifier is appropriate since this function does not throw exceptions.
296-300
: LGTM!This inline function correctly constructs a
Keylet
for an MPT issuance directly from the provideduint256
issuance identifier. Theinline
specifier is appropriate for this small function to optimize the function call.
302-303
: LGTM!The function correctly constructs a
Keylet
for an MPToken using the providedMPTID
andAccountID
. Thenoexcept
specifier is appropriate since this function does not throw exceptions.
311-312
: LGTM!This overload of
mptoken
correctly constructs aKeylet
for an MPToken using the provideduint256
issuance key andAccountID
. Thenoexcept
specifier is appropriate since this function does not throw exceptions.
354-355
: LGTM!The function declaration for
getMptID
is correct, taking anAccountID
and astd::uint32_t
sequence number and returning anMPTID
. The naming and parameters suggest that this function generates anMPTID
based on the provided account and sequence number.include/xrpl/protocol/TxFlags.h (5)
25-26
: LGTM!The inclusion of the
LedgerFormats.h
header file is necessary for the code in this file to compile and function correctly.
135-143
: LGTM!The constants define the valid flags that can be set on an MPTokenIssuanceCreate transaction, controlling the properties and permissions of the issued MPToken. The use of the
lsfMPT*
constants ensures consistency with the values defined inLedgerFormats.h
, and the comment clarifies the intentional absence of thelsfMPTLocked
flag.
145-146
: LGTM!The constant
tfMPTUnauthorize
defines a flag that can be set on an MPTokenAuthorize transaction to indicate the unauthorized operation. The value0x00000001
is a valid bit flag that can be combined with other flags using bitwise operations.
148-150
: LGTM!The constants
tfMPTLock
andtfMPTUnlock
define flags that can be set on an MPTokenIssuanceSet transaction to indicate the locking or unlocking operation. The values0x00000001
and0x00000002
are valid bit flags that can be combined with other flags using bitwise operations, allowing the transaction to modify the locking state of an issued MPToken.
207-218
: LGTM!The flag masks defined in this code segment are used to validate and extract the relevant flags from the transaction's flags field for MPToken-related transactions. The masks are defined using bitwise NOT operations on the respective transaction flags, ensuring that only the relevant flags are considered when applying the masks. This helps maintain the integrity of the transaction processing logic.
include/xrpl/protocol/LedgerFormats.h (2)
199-211
: LGTM!The new ledger entry types for MPToken issuance and balance are well-defined and consistent with the existing code. The comments provide clear explanations of their purpose.
324-335
: Looks good!The new specific flags for MPToken types provide a comprehensive set of controls for managing the properties and functionalities of MPToken assets. The flag names are clear and consistent with the existing code.
include/xrpl/protocol/Feature.h (1)
375-375
: Verify the usage and impact offeatureMPTokensV1
.The addition of
featureMPTokensV1
suggests that a new feature for multi-party tokens has been introduced. Please ensure that:
- The feature is properly registered in
Feature.cpp
with the correct name,Supported
status, andVoteBehavior
.- The feature is used consistently throughout the codebase to enable or control the behavior related to multi-party tokens.
- The impact of this feature on the XRPL protocol and its functionality has been thoroughly tested and documented.
Run the following script to verify the registration and usage of
featureMPTokensV1
:Verification successful
Verification of
featureMPTokensV1
implementation completed.The
featureMPTokensV1
feature is properly registered and implemented in the codebase. Key findings:
- Registered in
src/libxrpl/protocol/Feature.cpp
withSupported::yes
andVoteBehavior::DefaultNo
.- Consistently used in transaction processing (e.g., Clawback, MPTokenAuthorize, MPTokenIssuanceCreate).
- Extensive test coverage, including scenarios with the feature enabled and disabled.
The feature is correctly implemented and its usage aligns with best practices for feature flags in the XRPL codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the registration and usage of `featureMPTokensV1`. # Test 1: Check if `featureMPTokensV1` is registered in `Feature.cpp` with the correct parameters. # Expect: The feature should be registered with the name "MPTokensV1", `Supported::no`, and `VoteBehavior::DefaultNo`. rg --type cpp --pcre2 --context 2 $'featureMPTokensV1 = registerFeature\("MPTokensV1", Supported::no, VoteBehavior::DefaultNo\);' src/xrpl/protocol/Feature.cpp # Test 2: Search for the usage of `featureMPTokensV1` in the codebase. # Expect: The feature should be used to control the behavior related to multi-party tokens. rg --type cpp --context 2 $'featureMPTokensV1' | rg --invert-match $'xrpl/protocol/Feature\.h'Length of output: 6374
Script:
#!/bin/bash # Description: Locate the feature registration file and verify the registration of `featureMPTokensV1`. # Find the file containing the feature registration echo "Searching for the file containing feature registrations:" fd --type f --exec grep -l "registerFeature" {} + # Once we find the file, verify the registration of `featureMPTokensV1` echo -e "\nVerifying the registration of featureMPTokensV1:" fd --type f --exec grep -H "featureMPTokensV1.*registerFeature" {} +Length of output: 110049
Script:
#!/bin/bash # Description: Search for the registration of featureMPTokensV1 in the Feature.cpp file echo "Searching for featureMPTokensV1 registration in Feature.cpp:" grep -n "featureMPTokensV1.*registerFeature" ./src/libxrpl/protocol/Feature.cpp echo -e "\nShowing context around the registration (if found):" grep -n -C 3 "featureMPTokensV1.*registerFeature" ./src/libxrpl/protocol/Feature.cpp echo -e "\nChecking for any usage of featureMPTokensV1 in Feature.cpp:" grep -n "featureMPTokensV1" ./src/libxrpl/protocol/Feature.cppLength of output: 616
Script:
#!/bin/bash # Description: Search for featureMPTokensV1 and related terms across the src directory echo "Searching for exact 'featureMPTokensV1' in src directory:" grep -r -n "featureMPTokensV1" ./src echo -e "\nSearching for 'MPTokens' (case-insensitive) in src directory:" grep -r -n -i "MPTokens" ./src echo -e "\nSearching for 'TokensV1' (case-insensitive) in src directory:" grep -r -n -i "TokensV1" ./src echo -e "\nSearching for commented out 'featureMPTokensV1' in src directory:" grep -r -n "//.*featureMPTokensV1" ./src echo -e "\nSearching for 'registerFeature' calls in src directory:" grep -r -n "registerFeature" ./srcLength of output: 17910
src/libxrpl/protocol/Serializer.cpp (1)
361-368
: LGTM!The new
peek8
function is a useful addition to theSerialIter
class. It correctly checks if there is enough data remaining before attempting to peek at the next byte, and throws an appropriate exception if there is insufficient data. The function returns the next byte without advancing the internal pointer, which aligns with the expected behavior of a peek operation.This enhancement provides a way to inspect the next byte without consuming it, which can be beneficial in scenarios where the next byte's value needs to be evaluated before deciding to read it. The existing
get8
function remains unchanged, ensuring that the new functionality does not interfere with the current behavior of retrieving a byte and advancing the pointer.Overall, this is a valuable addition to the
SerialIter
class.include/xrpl/protocol/STAmount.h (5)
45-45
: Clarify the reasoning behind removing inheritance fromSTBase
andCountedObject<STAmount>
.The
STAmount
class no longer inherits fromSTBase
andCountedObject<STAmount>
. This change could impact polymorphic behavior and memory management.Please provide more context on the motivation behind this change and address any potential compatibility issues with existing code that relies on the previous inheritance structure.
78-78
: Clarify the reasoning behind 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 could affect how instances ofSTAmount
are initialized and serialized/deserialized.Please provide more context on the motivation behind this change and address any potential compatibility issues with existing code that relies on the
SField
parameter for initialization and serialization/deserialization processes.
217-217
: Clarify the reasoning behind removing theoverride
specifiers from several methods.Several methods that previously had
override
specifiers have been modified to remove them:
getSType()
getFullText()
getText()
getJson()
add()
isDefault()
This change could indicate a modification in the class's inheritance structure or the removal of virtual functions, potentially impacting polymorphic behavior.
Please provide more context on the motivation behind removing the
override
specifiers and address any potential impact on howSTAmount
instances are treated in polymorphic contexts.Also applies to: 220-220, 223-223, 225-225, 228-228, 231-231
240-240
: Provide a holistic explanation of the new initialization and serialization/deserialization approach.The static method
construct(SerialIter&, SField const& name)
has been modified toconstruct(SerialIter&)
, removing theSField
parameter. This change is consistent with the modification made to the constructor at line 78.Please provide a comprehensive explanation of the new approach for initializing and serializing/deserializing
STAmount
instances, considering the removal of theSField
parameter from both the constructor and theconstruct
method. Address how this change affects the overall design and compatibility with existing code.
450-452
: LGTM!The addition of the
operator<<
overload forstd::ostream&
andSTAmount
is a welcome improvement to the usability of theSTAmount
class. It enables easy output ofSTAmount
instances to streams, enhancing the class's functionality without introducing any compatibility issues.src/libxrpl/protocol/STEitherAmount.cpp (12)
30-39
: LGTM!The constructor correctly initializes an
STEitherAmount
object from aSerialIter
and anSField
. It checks the first byte of theSerialIter
to determine whether the amount is anSTAmount
or anSTMPTAmount
and constructs the appropriate object accordingly.
41-43
: LGTM!The constructor correctly initializes an
STEitherAmount
object from anXRPAmount
by directly initializing theamount_
member variable with the providedXRPAmount
.
45-47
: LGTM!The constructor correctly initializes an
STEitherAmount
object from anSTAmount
by directly initializing theamount_
member variable with the providedSTAmount
.
49-52
: LGTM!The constructor correctly initializes an
STEitherAmount
object from anSField
and anSTAmount
. It initializes theSTBase
base class with the providedSField
and theamount_
member variable with the providedSTAmount
.
54-57
: LGTM!The constructor correctly initializes an
STEitherAmount
object from anSField
and anSTMPTAmount
. It initializes theSTBase
base class with the providedSField
and theamount_
member variable with the providedSTMPTAmount
.
59-61
: LGTM!The constructor correctly initializes an
STEitherAmount
object from anSTMPTAmount
by directly initializing theamount_
member variable with the providedSTMPTAmount
.
90-94
: LGTM!The
getFullText()
function correctly returns the full text representation of theSTEitherAmount
object. It usesstd::visit
to call thegetFullText()
member function of the underlyingSTAmount
orSTMPTAmount
object stored in theamount_
member variable.
96-100
: LGTM!The
getText()
function correctly returns the text representation of theSTEitherAmount
object. It usesstd::visit
to call thegetText()
member function of the underlyingSTAmount
orSTMPTAmount
object stored in theamount_
member variable.
102-106
: LGTM!The
getJson(JsonOptions)
function correctly returns the JSON representation of theSTEitherAmount
object. It usesstd::visit
to call thegetJson(JsonOptions::none)
member function of the underlyingSTAmount
orSTMPTAmount
object stored in theamount_
member variable.
108-112
: LGTM!The
setJson(Json::Value& jv)
function correctly sets the JSON representation of theSTEitherAmount
object in the providedJson::Value
reference. It usesstd::visit
to call thesetJson(jv)
member function of the underlyingSTAmount
orSTMPTAmount
object stored in theamount_
member variable.
114-118
: LGTM!The
add(Serializer& s)
function correctly adds the serialized representation of theSTEitherAmount
object to the providedSerializer
reference. It usesstd::visit
to call theadd(s)
member function of the underlyingSTAmount
orSTMPTAmount
object stored in theamount_
member variable.
120-125
: LGTM!The
isEquivalent(const STBase& t)
function correctly checks if theSTEitherAmount
object is equivalent to anotherSTBase
object. It dynamically casts the providedSTBase
reference to anSTEitherAmount
pointer and compares the twoSTEitherAmount
objects for equality if the dynamic cast succeeds.src/xrpld/app/tx/detail/AMMCreate.cpp (1)
50-50
: LGTM!The change improves type safety by explicitly casting the retrieved
amount
value toSTAmount
type. This ensures that theamount
variable is correctly interpreted, which is crucial for subsequent operations.src/xrpld/app/tx/detail/InvariantCheck.h (2)
436-436
: LGTM!The addition of
mptokensChanged
to track changes to MPT tokens is a valid enhancement to theValidClawback
class.
454-460
: LGTM!The addition of the
ValidMPTIssuance
class with member variables to track the creation and deletion of MPT issuances and tokens is a valid enhancement to the invariant checks.src/xrpld/app/tx/detail/NFTokenMint.cpp (3)
108-108
: LGTM!The change to use
get<STAmount>(ctx.tx[sfAmount])
instead of directly accessingctx.tx[sfAmount]
is a good improvement. It ensures that thesfAmount
field is correctly interpreted as anSTAmount
type, enhancing type safety and preventing potential issues related to type mismatches.
198-198
: LGTM!Similar to the change in the
preflight
method, usingget<STAmount>(ctx.tx[sfAmount])
instead of directly accessingctx.tx[sfAmount]
is a good improvement. It ensures that thesfAmount
field is correctly interpreted as anSTAmount
type, enhancing type safety and preventing potential issues related to type mismatches.
326-326
: LGTM!The change to use
get<STAmount>(ctx.tx[sfAmount])
instead of directly accessingctx.tx[sfAmount]
is consistent with the improvements made in thepreflight
andpreclaim
methods. It ensures that thesfAmount
field is correctly interpreted as anSTAmount
type, enhancing type safety and preventing potential issues related to type mismatches.src/libxrpl/protocol/Indexes.cpp (5)
140-148
: LGTM!The
getMptID
function correctly generates a unique identifier for MPToken issuances by combining the account ID and sequence number. Using big-endian byte order for the sequence ensures a consistent ordering of the bytes across different platforms.
466-470
: LGTM!The
mptIssuance
function (overload 1) correctly creates a keylet for an MPToken issuance by generating theMPTID
from the issuer account ID and sequence number and then calling the other overload with theMPTID
.
472-477
: LGTM!The
mptIssuance
function (overload 2) correctly creates a keylet for an MPToken issuance by using theindexHash
function with theMPTOKEN_ISSUANCE
namespace and the providedMPTID
.
479-483
: LGTM!The
mptoken
function (overload 1) correctly creates a keylet for an MPToken by getting the issuance keylet's key from the issuance ID and then calling the other overload with the issuance key and the holder account ID.
485-490
: LGTM!The
mptoken
function (overload 2) correctly creates a keylet for an MPToken by using theindexHash
function with theMPTOKEN
namespace, the provided issuance key, and the holder account ID.include/xrpl/protocol/XChainAttestations.h (2)
146-146
: LGTM!The change in the
sendingAmount
parameter type fromSTAmount
toSTEitherAmount
aligns with the overall objective of enhancing the protocol's ability to handle multi-party tokens (MPTokens). The new type likely supports a broader range of amount representations.
229-230
: LGTM!The change in the
sendingAmount
andrewardAmount
parameter types fromSTAmount
toSTEitherAmount
is consistent with the modifications made to theAttestationClaim
struct and aligns with the overall objective of enhancing the protocol's ability to handle multi-party tokens (MPTokens).src/libxrpl/protocol/LedgerFormats.cpp (2)
368-383
: LGTM!The
MPTokenIssuance
format is a valid addition to theLedgerFormats
class. The included fields and their requirements are appropriate for capturing the necessary details of a token issuance.
385-396
: LGTM!The
MPToken
format is a valid addition to theLedgerFormats
class. The included fields and their requirements are appropriate for capturing the necessary details of an individual MP token.src/xrpld/app/tx/detail/applySteps.cpp (1)
175-182
: LGTM!The changes are adding support for new MPToken-related transaction types in a consistent manner with the existing code. The switch cases are correctly mapped to the appropriate functions for each transaction type.
src/libxrpl/protocol/TxFormats.cpp (4)
165-165
: LGTM! The change enables MPT support for thesfAmount
field in Payment transactions.The modification aligns with the overall goal of introducing multi-party token support in the protocol. This change allows
ttPAYMENT
transactions to handle amounts representing MPTs.
380-380
: LGTM! The change enables MPT support for thesfAmount
field in Clawback transactions.This modification allows
ttCLAWBACK
transactions to handle amounts representing MPTs, which is in line with the goal of introducing multi-party token support in the protocol.
381-381
: LGTM! The newsfMPTokenHolder
field enhances MPT management in Clawback transactions.The addition of this optional field allows for more flexible handling of multi-party tokens during clawback operations, which aligns with the goal of improving the protocol's token management capabilities.
518-549
: LGTM! The new transaction types significantly enhance MPT management and issuance capabilities.The introduction of the
MPTokenIssuanceCreate
,MPTokenIssuanceDestroy
,MPTokenAuthorize
, andMPTokenIssuanceSet
transaction types, along with their associated fields, greatly expands the protocol's support for complex multi-party token interactions.These changes enable the creation, destruction, authorization, and setting of MPT issuances and holders, which aligns with the overall goal of improving the protocol's token management capabilities, particularly in the context of multi-party transactions.
include/xrpl/basics/base_uint.h (2)
551-551
: LGTM!The new
uint192
type alias extends thebase_uint
class template to support 192-bit unsigned integers, enhancing the flexibility of the codebase without affecting existing code.
637-637
: LGTM!The static assertion ensures that the
uint192
type has the expected size of 192 bits with no padding bytes, maintaining a compact memory layout and preventing subtle bugs.src/libxrpl/protocol/STTx.cpp (2)
547-570
: LGTM!The
invalidMPTAmountInTx
function correctly checks for unsupported MPT amounts in transactions. It enhances the validation logic by ensuring that transactions with invalid MPT amounts are rejected.
590-594
: LGTM!The changes to
passesLocalChecks
correctly integrate theinvalidMPTAmountInTx
function to perform additional validation on transactions. If a transaction contains an unsupported MPT amount, it will fail the local checks and will not be processed further.src/libxrpl/basics/Number.cpp (1)
507-510
: LGTM!The new conversion operator
Number::operator MPTAmount() const
is implemented correctly and enhances the functionality of theNumber
class by allowing direct conversion toMPTAmount
. The change is additive and unlikely to introduce any issues.src/xrpld/app/tx/detail/SetTrust.cpp (1)
540-540
: LGTM!The change to use an
Issue
object instead of a constructor with separate currency and account identifier arguments is a good refactor. It enhances the clarity and correctness of the code by using a more structured representation of the currency-account relationship.src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp (6)
Line range hint
30-69
:
107-108
: Reviewed the usage ofget<STAmount>()
to retrieve amounts. Changes look good!The changes consistently replace direct access to amount fields with calls to
get<STAmount>()
across various conditional checks and calculations. This improves type safety and clarity by explicitly treating the retrieved values asSTAmount
objects.The control flow and core logic remain unchanged, and the changes are applied consistently. This enhances the robustness and maintainability of the code by promoting better type handling practices.
Also applies to: 119-119, 156-156, 159-159, 162-163, 196-196, 239-239, 285-285
Line range hint
308-336
:
Line range hint
338-386
:
392-393
: Reviewed the usage ofget<STAmount>()
to retrieve the offer amount. Change looks good!The change replaces direct access to the offer amount field with a call to
get<STAmount>()
. This improves type safety and clarity by explicitly treating the retrieved value as anSTAmount
object.The change is consistent with similar modifications made in other functions, and the control flow and core logic remain unchanged. This enhances the robustness and maintainability of the code by promoting better type handling practices.
454-454
: Reviewed the usage ofget<STAmount>()
to retrieve the buyer's payment amount. Change looks good!The change replaces direct access to the buyer's payment amount field with a call to
get<STAmount>()
. This improves type safety and clarity by explicitly treating the retrieved value as anSTAmount
object.The change is consistent with similar modifications made in other functions, and the control flow and core logic remain unchanged. This enhances the robustness and maintainability of the code by promoting better type handling practices.
include/xrpl/protocol/TER.h (2)
128-128
: LGTM!The new enum entry
temBAD_MPTOKEN_TRANSFER_FEE
is added correctly at the end of theTEMcodes
enum, ensuring the numeric values of existing entries remain stable.
343-348
: LGTM!The new enum entries are added correctly at the end of the
TECcodes
enum:
tecARRAY_TOO_LARGE
tecMPTOKEN_EXISTS
tecMPT_MAX_AMOUNT_EXCEEDED
tecMPT_LOCKED
tecMPT_NOT_SUPPORTED
tecMPT_ISSUANCE_NOT_FOUND
This ensures the numeric values of existing entries remain stable, which is crucial as the comment indicates these numbers appear in ledger metadata.
src/xrpld/app/tx/detail/Escrow.cpp (6)
96-96
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before accessing thexrp()
value.
111-111
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before comparing it to zero.
222-222
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before accessing thexrp()
value.
279-279
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before subtracting it from the owner's balance.
499-499
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before adding it to the destination's balance.
585-585
: LGTM!The change improves type safety by explicitly treating the amount as an
STAmount
object before adding it back to the owner's balance.src/xrpld/app/tx/detail/PayChan.cpp (6)
152-154
: LGTM!The changes introduce the usage of
get<STAmount>()
to retrieve the amount from the payment channel object, ensuring type safety. The assertion and balance calculation logic remain intact.
168-168
: LGTM!The change introduces the usage of
get<STAmount>()
to retrieve the amount from the transaction context, ensuring type safety. The logic remains intact.
180-181
: LGTM!The changes introduce the usage of
get<STAmount>()
to retrieve the amount from the transaction context, ensuring type safety. The logic to check if the amount is in XRP and greater than zero remains intact.
Line range hint
266-299
: LGTM!The changes introduce the usage of
get<STAmount>()
to retrieve the amount from the transaction context, ensuring type safety. The logic to set the payment channel balance to zero and deduct the amount from the owner's balance remains intact.
311-311
: LGTM!The change introduces the usage of
get<STAmount>()
to retrieve the amount from the transaction context, ensuring type safety. The logic remains intact.
Line range hint
491-557
: LGTM!The changes introduce the usage of
get<STAmount>()
to retrieve the amount from the payment channel object, ensuring type safety. The logic to retrieve the payment channel funds and check if the balance is equal to the amount remains intact.src/xrpld/app/tx/detail/CashCheck.cpp (3)
53-53
: LGTM!The change to use
get<STAmount>()
instead of directly accessingctx.tx[~sfAmount]
is a good improvement. It provides a more type-safe and error-checked way of retrieving theSTAmount
value.
139-139
: LGTM!The change to use
get<STAmount>()
instead of directly accessingtx[~sfAmount]
within the lambda function is a good improvement. It provides a more type-safe and error-checked way of retrieving theSTAmount
value.
310-310
: LGTM!The changes to use
get<STAmount>()
instead of directly accessingctx_.tx.getFieldAmount(sfAmount)
are good improvements. They provide a more type-safe and error-checked way of retrieving theSTAmount
values.Also applies to: 343-348
src/libxrpl/protocol/TER.cpp (6)
88-88
: LGTM!The new error code
tecMPT_NOT_SUPPORTED
is added correctly to handle scenarios where MPT is not supported.
119-119
: LGTM!The new error code
tecMPTOKEN_EXISTS
is added correctly to handle scenarios where an account already owns the MPToken object.
120-120
: LGTM!The new error code
tecMPT_MAX_AMOUNT_EXCEEDED
is added correctly to handle scenarios where the MPT's maximum amount is exceeded.
121-121
: LGTM!The new error code
tecMPT_LOCKED
is added correctly to handle scenarios where the MPT is locked by the issuer.
122-122
: LGTM!The new error code
tecMPT_ISSUANCE_NOT_FOUND
is added correctly to handle scenarios where the MPTokenIssuance object is not found.
205-205
: LGTM!The new error code
temBAD_MPTOKEN_TRANSFER_FEE
is added correctly to handle scenarios where the 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
method looks good. It expands theSTObject
class to handle 192-bit unsigned integers and follows the existing pattern of similar getter methods.
640-645
: LGTM!The new overloaded
getFieldAmount
method looks good. It provides a way to retrieve an amount field that can be eitherSTEitherAmount
orSTAmount
, complementing the changes made to the existing method.
759-761
: LGTM!The change to the
setFieldAmount
method looks good. It aligns the setter with the changes made to the getter method and allows setting an amount field with eitherSTEitherAmount
orSTAmount
type, consistent with the overall shift towards usingSTEitherAmount
for representing amounts.
633-638
: Verify method usages are updated to handle the new return type.The change to return
STEitherAmount const&
instead ofSTAmount const&
looks good. It allows for more flexibility in the type of amount returned.However, ensure that all usages of the
getFieldAmount
method are updated to handle the new return type to avoid compile errors.Run the following script to verify the method usages:
Verification successful
The change to
STEitherAmount const&
return type appears safe and consistent with usage patterns.The
getFieldAmount
method is widely used across the codebase for retrieving various types of amounts (balances, limits, fees, etc.) from different object types. Based on the observed usage patterns, the change fromSTAmount const&
toSTEitherAmount const&
doesn't seem to cause any immediate issues:
- Most code handles the returned value in a way that would be compatible with both
STAmount
andSTEitherAmount
.- No visible compile errors or type mismatches are apparent in the usage.
- The change appears to be part of a broader refactoring to support more flexible amount types.
While the change looks safe, due to the method's widespread usage, thorough testing is highly recommended to ensure no subtle issues arise from this type change.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of `getFieldAmount` are updated to handle the new return type. # Test: Search for the method usage. Expect: No compilation errors. rg --type cpp -A 5 $'getFieldAmount'Length of output: 47816
src/libxrpl/protocol/Feature.cpp (1)
504-504
: New feature registration for MPTokensV1.The new
MPTokensV1
feature is now registered and supported by this implementation. However, it has a default vote behavior ofVoteBehavior::DefaultNo
, meaning it will not be automatically enabled.This suggests that
MPTokensV1
is an opt-in feature. Could you please provide some additional context or documentation about the purpose and functionality of this feature? This will help reviewers better understand the implications of this change.src/libxrpl/protocol/XChainAttestations.cpp (8)
110-110
: LGTM!The change in initialization of
sendingAmount
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.
135-135
: LGTM!The change in adding
sendingAmount
to theSTObject
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.
219-219
: LGTM!The change in the
sendingAmount
parameter type fromSTAmount
toSTEitherAmount
correctly handles the transition to usingSTEitherAmount
for amounts.
364-365
: LGTM!The changes in the
sendingAmount
andrewardAmount
parameter types fromSTAmount
toSTEitherAmount
correctly handle the transition to usingSTEitherAmount
for amounts.
374-374
: LGTM!The change in adding
sendingAmount
to theSTObject
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.
469-469
: LGTM!The change in initialization of
amount
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.
506-506
: LGTM!The change in adding
amount
to theSTObject
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.
579-579
: LGTM!The change in initialization of
amount
correctly handles the transition fromSTAmount
toSTEitherAmount
for thesfAmount
field.include/xrpl/protocol/SField.h (10)
45-45
: LGTM!The forward declaration of the
STEitherAmount
class is valid.
60-101
: The changes to theXMACRO
definition look good.Adding
STI_EITHER_AMOUNT
with the same value asSTI_AMOUNT
is an unusual but intentional design choice to ensureSF_AMOUNT
andSF_EITHER_AMOUNT
map to the same serialization ID. The comments explain the reasoning behind this.
332-361
: The new template structsTypedVariantField
andOptionaledVariantField
look good.
TypedVariantField
provides a way to represent variant fields with compile-time type information.OptionaledVariantField
wrapsTypedVariantField
to indicate optional semantics.- The template parameters and their usage are well-documented.
- The comments provide clear examples of how these structs can be used with
STEitherAmount
,STAmount
, andSTMPTAmount
.
370-375
: Theoperator~
overload forTypedVariantField
looks good.
- It allows obtaining an
OptionaledVariantField
from aTypedVariantField
using the~
operator.- The overload provides a convenient syntax to indicate optional semantics for variant fields.
- It follows the same pattern as the existing
operator~
overload forTypedField
.
394-395
: The definitions ofSF_AMOUNT
andSF_EITHER_AMOUNT
look good.
SF_AMOUNT
is defined as aTypedVariantField<STEitherAmount, STAmount>
, indicating that it can hold either anSTEitherAmount
or anSTAmount
, but will return anSTAmount
when accessed viaSTObject::operator[]()
.SF_EITHER_AMOUNT
is defined as aTypedVariantField<STEitherAmount>
, indicating that it can hold anSTEitherAmount
and will return anSTEitherAmount
when accessed viaSTObject::operator[]()
.- The definitions align with the explanations provided in the comments for
TypedVariantField
.
517-520
: The new global variables related to MPT amounts look good.
sfMaximumAmount
,sfOutstandingAmount
,sfLockedAmount
, andsfMPTAmount
are declared asSF_UINT64
types.- The names suggest they represent different aspects of amounts in the context of multi-party tokens (MPT).
- The names are descriptive and follow the naming convention used for other global variables in the file.
532-533
: The new global variablesfMPTokenIssuanceID
looks good.
sfMPTokenIssuanceID
is declared as anSF_UINT192
type.- The name suggests it represents an issuance ID for multi-party tokens (MPT).
- The name is descriptive and follows the naming convention used for other global variables in the file.
570-570
: The change ofsfAmount
fromSF_AMOUNT
toSF_EITHER_AMOUNT
looks good.
sfAmount
is now of typeSF_EITHER_AMOUNT
, which is aTypedVariantField<STEitherAmount>
.- This change allows
sfAmount
to represent either anSTAmount
or anSTMPTAmount
(assumingSTMPTAmount
is an alternative type ofSTEitherAmount
).- The change is consistent with the introduction of the new
STEitherAmount
type and theSF_EITHER_AMOUNT
typedef.
621-621
: The new global variablesfMPTokenMetadata
looks good.
sfMPTokenMetadata
is declared as anSF_VL
type.- The name suggests it represents metadata associated with multi-party tokens (MPT).
- The name is descriptive and follows the naming convention used for other global variables in the file.
645-645
: The new global variablesfMPTokenHolder
looks good.
sfMPTokenHolder
is declared as anSF_ACCOUNT
type.- The name suggests it represents the account that holds a multi-party token (MPT).
- The name is descriptive and follows the naming convention used for other global variables in the file.
src/xrpld/app/tx/detail/Payment.cpp (8)
Line range hint
36-51
: LGTM!The function logic for calculating the maximum XRP spend is correct, and the implementation looks good.
53-58
: LGTM!The function logic for returning zero transaction consequences for MPT amounts is correct, and the implementation looks good.
Line range hint
64-224
: LGTM!The preflight checks for payment transactions with STAmount are comprehensive and cover various scenarios. The function logic is correct, and the implementation looks good.
225-295
: LGTM!The preflight checks for payment transactions with STMPTAmount are appropriate and cover the necessary scenarios. The function logic is correct, and the implementation looks good.
Line range hint
304-391
: LGTM!The preclaim checks for payment transactions with STAmount are appropriate and cover the necessary scenarios. The function logic is correct, and the implementation looks good.
392-429
: LGTM!The preclaim checks for payment transactions with STMPTAmount are appropriate and cover the necessary scenarios. The function logic is correct, and the implementation looks good.
Line range hint
438-665
: LGTM!The
applyHelper
function for payment transactions with STAmount handles both direct XRP payments and payments with paths. It covers various payment scenarios and performs the necessary validations and checks. The function logic is correct, and the implementation looks good.
666-707
: LGTM!The
applyHelper
function for payment transactions with STMPTAmount performs the necessary authorization checks and applies the payment using theaccountSend
function. The function logic is correct, and the implementation looks good.src/xrpld/app/tx/detail/AMMWithdraw.cpp (3)
51-51
: LGTM!The change improves type safety by explicitly casting the retrieved value to
STAmount
.
184-184
: LGTM!The change improves type safety by explicitly casting the retrieved value to
STAmount
.
298-298
: LGTM!The change improves type safety by explicitly casting the retrieved value to
STAmount
.src/xrpld/app/tx/detail/AMMDeposit.cpp (3)
51-51
: LGTM!The change to explicitly cast
ctx.tx[~sfAmount]
toSTAmount
usingget<STAmount>()
enhances type safety and clarity. This is a good practice to prevent potential type mismatch issues.
247-247
: LGTM!Similar to the change in the
preflight
function, explicitly castingctx.tx[~sfAmount]
toSTAmount
usingget<STAmount>()
enhances type safety and clarity. This is a good practice to maintain consistency and prevent potential type mismatch issues.
342-342
: LGTM!The change to explicitly cast
ctx_.tx[~sfAmount]
toSTAmount
usingget<STAmount>()
is consistent with the changes made in thepreflight
andpreclaim
functions. This enhances type safety, clarity, and maintains consistency throughout the code.src/libxrpl/protocol/SField.cpp (7)
48-55
: LGTM!The new constructor for
TypedVariantField
enhances its flexibility by allowing it to be constructed similarly toTypedField
. The use of a private access tag and forwarding of variadic arguments to the base class constructor is a good implementation.
110-110
: New SField constant for asset scale.The addition of the
sfAssetScale
SField constant with a type ofUINT8
and a field value of 20 indicates an expansion of the asset management capabilities within the XRPL protocol. This change is in line with the overall theme of the PR.
206-209
: New SField constants for MPToken-related amounts.The addition of the
sfMaximumAmount
,sfOutstandingAmount
,sfLockedAmount
, andsfMPTAmount
SField constants with a type ofUINT64
and field values 24-27 indicates an expansion of the asset management capabilities, particularly related to multi-party tokens (MPTokens). These changes align with the overall theme of the PR.
221-221
: New SField constant for MPToken issuance ID.The addition of the
sfMPTokenIssuanceID
SField constant with a type ofUINT192
and a field value of 1 introduces a unique identifier for MPToken issuances. This change supports the overall theme of adding MPToken-related functionality to the XRPL protocol.
327-327
: New SField constant for MPToken metadata.The addition of the
sfMPTokenMetadata
SField constant with a type ofVL
(variable length) and a field value of 30 introduces support for metadata associated with MPTokens. This change aligns with the overall theme of adding MPToken-related functionality to the XRPL protocol.
340-340
: New SField constant for MPToken holder account.The addition of the
sfMPTokenHolder
SField constant with a type ofACCOUNT
and a field value of 11 introduces support for specifying the account that holds MPTokens. This change aligns with the overall theme of adding MPToken-related functionality to the XRPL protocol.
260-260
: Verify the impact of changing thesfAmount
field type.The modification of the
sfAmount
SField constant to useEITHER_AMOUNT
instead ofAMOUNT
suggests a change in how this field will handle different types of amounts. This change may impact how transactions involving amounts are processed.Please run the following script to verify the usage of the
sfAmount
field across the codebase and ensure that the change is properly handled:Verification successful
To fully understand the impact of changing sfAmount from AMOUNT to EITHER_AMOUNT, we need to gather more information about the implementation of EITHER_AMOUNT and related changes. Let's run some scripts to investigate further.
The change to sfAmount enhances flexibility with minimal disruption.
The modification of sfAmount from AMOUNT to EITHER_AMOUNT is a well-implemented change that increases the flexibility of amount handling in the XRPL codebase. Key points:
- EITHER_AMOUNT shares the same serialization ID as AMOUNT, ensuring backward compatibility.
- The change has been implemented with minimal impact on existing code, as evidenced by the lack of significant changes in related areas.
- The new type (TypedVariantField) allows for handling multiple types of amounts, potentially including new formats like MPTokens.
- The gradual introduction of this change suggests a careful approach to maintaining system stability while enabling future enhancements.
While this change lays the groundwork for more versatile amount handling, developers should be aware of the potential for new amount types in future updates and ensure their code can handle these appropriately.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `sfAmount` field and ensure proper handling of the type change. # Test: Search for usage of `sfAmount` and analyze the code to ensure compatibility with the new `EITHER_AMOUNT` type. rg --type cpp -A 5 $'sfAmount'Length of output: 77676
Script:
#!/bin/bash # Search for the definition and usage of EITHER_AMOUNT echo "Searching for EITHER_AMOUNT definition and usage:" rg -A 5 "EITHER_AMOUNT" # Look for recent changes related to sfAmount echo -e "\nRecent changes related to sfAmount:" git log -p -n 5 --grep="sfAmount" # Check for changes in serialization/deserialization code echo -e "\nChanges in serialization/deserialization code:" rg -A 5 "serialize.*sfAmount|deserialize.*sfAmount" # Look for changes in transaction processing related to sfAmount echo -e "\nChanges in transaction processing related to sfAmount:" rg -A 5 "sfAmount.*process|process.*sfAmount"Length of output: 4469
src/libxrpl/protocol/STParsedJSON.cpp (2)
457-479
: LGTM!The new
STI_UINT192
case follows the same pattern as the existingSTI_UINT128
andSTI_UINT160
cases. The parsing logic and error handling look correct.
559-560
: Verify the impact ofSTEitherAmount
change on the codebase.The return type change from
STAmount
toSTEitherAmount
looks good. However, please ensure that the rest of the codebase has been updated to handleSTEitherAmount
instead ofSTAmount
wherever the return value ofparseLeaf
is used for theSTI_AMOUNT
case.Run the following script to verify the usage of
parseLeaf
forSTI_AMOUNT
case:Verification successful
Verified: Change is part of a broader refactoring effort
The change from
STAmount
toSTEitherAmount
in theparseLeaf
function for theSTI_AMOUNT
case is consistent with a larger refactoring effort visible throughout the codebase. This modification allows for more flexible handling of different amount types.While the change looks good, please ensure:
- This modification doesn't introduce unintended side effects in parsing amount fields.
- Thorough testing is performed on amount-related functionality to verify compatibility with both
STAmount
andSTEitherAmount
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all code that uses the return value of `parseLeaf` for `STI_AMOUNT` case has been updated to handle `STEitherAmount`. # Test: Search for usage of `parseLeaf` with `STI_AMOUNT`. Expect: No occurrences of `STAmount` in the context. rg --type cpp -A 5 $'parseLeaf\(.*STI_AMOUNT'Length of output: 46
Script:
#!/bin/bash # Check for parseLeaf function echo "Searching for parseLeaf function:" rg --type cpp "parseLeaf\s*\(" -A 2 echo -e "\nSearching for STI_AMOUNT occurrences:" rg --type cpp "STI_AMOUNT" echo -e "\nSearching for STEitherAmount usage:" rg --type cpp "STEitherAmount" echo -e "\nSearching for STAmount occurrences:" rg --type cpp "STAmount"Length of output: 218986
src/xrpld/app/tx/detail/NFTokenUtils.cpp (1)
1023-1023
: LGTM!The change to use
STEitherAmount
for assigning thesfAmount
field is a good enhancement. It allows for a more structured and type-safe representation of the amount.include/xrpl/protocol/STObject.h (8)
58-60
: LGTM!The addition of the
Proxy
template class with theT
andH
template parameters looks good. The class declaration follows the existing coding conventions and style.
62-63
: LGTM!The addition of the
OptionalProxy
template class with theT
andH
template parameters looks good. The class declaration follows the existing coding conventions and style.
239-243
: LGTM!The modifications to the
getFieldAmount
function and the addition of the new overload look good. The changes align with the introduction of theSTEitherAmount
type and provide a way to handle both the general case and the specific case ofSTAmount
fields.
264-268
: LGTM!The addition of the
operator[]
overload forTypedVariantField<T, H>
looks good. It provides a convenient way to access the value of a variant field using the square bracket notation, and the return type is determined by theH
template parameter. The overload is consistent with the existingoperator[]
overloads for other field types.
282-286
: LGTM!The addition of the
operator[]
overload forOptionaledVariantField<T, H>
looks good. It provides a convenient way to access the value of an optional variant field using the square bracket notation, and the return type isstd::optional
of the decayed value type determined by theH
template parameter. The overload is consistent with the existingoperator[]
overload forOptionaledField
.
484-490
: LGTM!The addition of the
atImpl
private member functions looks good. These functions serve as helper functions for accessing field values, with overloads forTypedField<T>
andOptionaledField<T>
. The return types are consistent with the expected value types of the respective field types. Having these helper functions will likely reduce code duplication in other member functions that need to access field values.
Line range hint
1034-1191
: LGTM!The addition of the
operator[]
andat
function definitions forTypedVariantField<T, H>
andOptionaledVariantField<T, H>
looks good. These functions provide a consistent way to access variant fields and optional variant fields using the familiaroperator[]
andat
syntax.The implementations delegate the field access logic to the corresponding
atImpl
helper functions, which promotes code reuse and reduces duplication. The return types and behavior of these functions are consistent with the existingoperator[]
andat
functions for other field types.
33-33
: Verify the necessity of includingSTEitherAmount.h
.Please ensure that including the
STEitherAmount.h
header file is necessary and that the code in this file depends on definitions or declarations fromSTEitherAmount.h
. If the dependency is unnecessary, consider removing the include statement to improve compilation times and reduce coupling.Verification successful
Inclusion of STEitherAmount.h is necessary and justified.
The
STEitherAmount.h
header file is correctly included and its usage is verified in theSTObject.h
file. Specifically:
STEitherAmount
is used as a return type and parameter type in method declarations.- It's also used in a template parameter, indicating deeper integration with the
STObject
class.These usages require the full type definition, justifying the inclusion of the header file. Removing this include statement would likely cause compilation errors.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the code uses the STEitherAmount type if ! rg -qw 'STEitherAmount' include/xrpl/protocol/STObject.h; then echo "STEitherAmount.h might be an unnecessary dependency." else echo "STEitherAmount.h appears to be a necessary dependency." fiLength of output: 175
Script:
#!/bin/bash # Display lines containing 'STEitherAmount' in STObject.h with context echo "Usage of STEitherAmount in STObject.h:" rg -n -C 2 'STEitherAmount' include/xrpl/protocol/STObject.h # Check if STEitherAmount is used in actual code (excluding comments and potentially unused declarations) echo -e "\nVerifying actual usage of STEitherAmount:" rg -n 'STEitherAmount' include/xrpl/protocol/STObject.h | rg -v '^\d+:(//|/\*|\*)' | # Exclude full-line comments rg -v '^\d+:.*?//.*STEitherAmount' # Exclude end-of-line commentsLength of output: 1295
src/xrpld/app/tx/detail/InvariantCheck.cpp (6)
105-107
: LGTM!The change improves type safety by explicitly casting the retrieved amount to
STAmount
usingget<STAmount>()
before performing arithmetic operations. The logic is correct.
110-110
: LGTM!The change improves type safety by explicitly casting the retrieved amount to
STAmount
usingget<STAmount>()
. The logic is correct.
126-127
: LGTM!The change improves type safety by explicitly casting the retrieved amount to
STAmount
usingget<STAmount>()
before performing arithmetic operations. The logic is correct.
133-133
: LGTM!The change improves type safety by explicitly casting the retrieved amount to
STAmount
usingget<STAmount>()
. The logic is correct.
890-892
: LGTM!The change adds tracking of
ltMPTOKEN
ledger entry changes in theValidClawback
class by incrementing themptokensChanged
counter. The logic is correct.
Line range hint
915-1122
: Excellent addition of theValidMPTIssuance
class!The
ValidMPTIssuance
class adds comprehensive tracking and validation of changes related to MPT issuances and tokens. The logic for checking the expected number of changes based on the transaction type and result is correct. The invariant checks help ensure the integrity of MPT-related transactions.Some key observations:
- The
visitEntry
method accurately counts the creation and deletion of MPT issuances and tokens.- The
finalize
method thoroughly checks the expected number of changes for each MPT-related transaction type.- The checks for successful transactions ensure that the correct number of MPT issuances and tokens are created or deleted based on the transaction type.
- The checks for failed transactions ensure that no changes are made to MPT issuances or tokens.
- The invariant checks log appropriate fatal-level messages when discrepancies are detected.
Overall, this is a well-designed and implemented class for maintaining the integrity of MPT-related transactions.
src/libxrpl/protocol/STAmount.cpp (5)
88-88
: Simplify constructor by removingSField
parameter.The removal of the
SField
parameter simplifies the constructor and reduces the coupling betweenSTAmount
andSField
. This change makes the constructor easier to use and maintain.
181-181
: Insufficient context to review changes.The provided code snippet does not clearly show the modifications made to this constructor. More context is needed to properly assess the changes and their impact.
259-259
: Simplify constructor by removingSField
parameter.The removal of the
SField
parameter simplifies the constructor and reduces the coupling betweenSTAmount
andSField
. This change makes the constructor easier to use and maintain.
261-261
: Simplifyconstruct
function by removingSField
parameter.The removal of the
SField
parameter from theconstruct
function is consistent with the changes made to the constructor. This change simplifies the usage of the function and reduces the coupling betweenSTAmount
andSField
.
344-353
: Improve native amount addition logic.The changes introduce a new code path for handling the addition of native amounts using
getSNValue
. This simplifies the addition logic, improves readability, and enhances maintainability. The behavior of the function remains the same, so there should be no impact on existing code that uses this operator.include/xrpl/protocol/jss.h (12)
44-44
: LGTM!The addition of the
AL_size
JSON field identifier looks good. It follows the existing conventions.
45-45
: LGTM!The addition of the
AL_hit_rate
JSON field identifier looks good. It follows the existing conventions.
99-105
: LGTM!The addition of the new JSON field identifiers related to MPToken functionality looks good. They follow the existing conventions and the comments provide useful context.
246-246
: LGTM!The addition of the
mpt_amount
JSON field identifier looks good. It follows the existing conventions.
247-247
: LGTM!The addition of the
mpt_issuance
JSON field identifier looks good. It follows the existing conventions.
248-248
: LGTM!The addition of the
mpt_issuance_id
JSON field identifier looks good. It follows the existing conventions.
249-249
: LGTM!The addition of the
mptoken
JSON field identifier looks good. It follows the existing conventions.
250-250
: LGTM!The addition of the
mptoken_index
JSON field identifier looks good. It follows the existing conventions.
378-378
: LGTM!The addition of the
holders
JSON field identifier looks good. It follows the existing conventions.
464-464
: LGTM!The addition of the
locked_amount
JSON field identifier looks good. It follows the existing conventions.
Line range hint
660-660
: LGTM!The addition of the
xchain_owned_claim_id
JSON field identifier looks good. It follows the existing conventions.
Line range hint
661-661
: LGTM!The addition of the
xchain_owned_create_account_claim_id
JSON field identifier looks good. It follows the existing conventions.
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 for the incomplete implementation.
The isXRP()
function is not fully implemented and always returns false
. This suggests that it is a placeholder or the implementation is incomplete.
Add a TODO comment to indicate that the function needs to be properly implemented:
inline bool
isXRP(MPTID const&)
{
+ // TODO: Implement proper check for XRP currency
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 check for XRP currency | |
return false; | |
} |
/** 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.
Clarify the purpose of the new transaction type ttMPTOKEN_AUTHORIZE
and fix the comment.
The comment for this transaction type seems to be a copy-paste error as it mentions destroying an MPTokenIssuance object, which doesn't match the transaction type name ttMPTOKEN_AUTHORIZE
.
Please:
- Clarify the intended purpose of this transaction type.
- Update the comment to accurately reflect the purpose.
@@ -80,7 +80,7 @@ namespace detail { | |||
// Feature.cpp. Because it's only used to reserve storage, and determine how | |||
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than | |||
// the actual number of amendments. A LogicError on startup will verify this. | |||
static constexpr std::size_t numFeatures = 79; | |||
static constexpr std::size_t numFeatures = 80; |
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
Verification failed: Mismatch between registered features and numFeatures
The verification process has revealed a discrepancy between the number of registered features in Feature.cpp
and the numFeatures
value in Feature.h
. Here are the details:
- Number of REGISTER_FEATURE and REGISTER_FIX calls in
Feature.cpp
: 75 - Value of
numFeatures
inFeature.h
: 80
This mismatch suggests that either:
- Some features are being registered in a way that wasn't captured by our verification process,
- The
numFeatures
value inFeature.h
may not have been updated correctly, or - There might be intentional padding in
numFeatures
for future additions.
Please review both Feature.cpp
and Feature.h
to ensure that all features are correctly registered and that numFeatures
accurately reflects the current state of the codebase.
Analysis chain
Ensure numFeatures
matches the actual number of amendments.
The increment in numFeatures
suggests that a new amendment has been added. Please ensure that the value of numFeatures
matches the actual number of amendments registered in Feature.cpp
to avoid a LogicError
on startup.
Run the following script to verify the consistency of numFeatures
:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if `numFeatures` matches the actual number of amendments in `Feature.cpp`.
# Test: Count the number of `uint256` declarations in `Feature.cpp`.
# Expect: The count should match the value of `numFeatures`.
actual_count=$(rg --type cpp --pcre2 --count-matches --only-matching $'uint256 const feature\w+;' src/xrpl/protocol/Feature.cpp)
expected_count=$(rg --type cpp --pcre2 --only-matching $'static constexpr std::size_t numFeatures = \d+;' include/xrpl/protocol/Feature.h | rg --only-matching $'\d+')
if [ "$actual_count" -ne "$expected_count" ]; then
echo "Mismatch found:"
echo " numFeatures = $expected_count"
echo " Actual number of amendments = $actual_count"
exit 1
else
echo "numFeatures matches the actual number of amendments."
fi
Length of output: 587
Script:
#!/bin/bash
# Search for Feature.cpp file
echo "Searching for Feature.cpp file:"
fd -t f "Feature.cpp"
# List all .cpp files in the repository
echo -e "\nListing all .cpp files:"
fd -e cpp
# Search for files containing 'uint256 const feature' pattern
echo -e "\nSearching for files containing 'uint256 const feature' pattern:"
rg -l "uint256 const feature"
Length of output: 23589
Script:
#!/bin/bash
# Description: Verify if `numFeatures` matches the actual number of amendments in `Feature.cpp`.
# Count the number of `uint256 const feature` declarations in `Feature.cpp`.
actual_count=$(rg --type cpp --pcre2 --count-matches --only-matching $'uint256 const feature\w+;' src/libxrpl/protocol/Feature.cpp)
# Get the value of numFeatures from Feature.h
expected_count=$(rg --type cpp --pcre2 --only-matching $'static constexpr std::size_t numFeatures = \d+;' include/xrpl/protocol/Feature.h | rg --only-matching $'\d+')
echo "Actual count of features: $actual_count"
echo "Expected count (numFeatures): $expected_count"
if [ "$actual_count" -ne "$expected_count" ]; then
echo "Mismatch found:"
echo " numFeatures = $expected_count"
echo " Actual number of amendments = $actual_count"
exit 1
else
echo "numFeatures matches the actual number of amendments."
fi
Length of output: 659
Script:
#!/bin/bash
# Description: Display the content of Feature.cpp and search for feature declarations
echo "Content of src/libxrpl/protocol/Feature.cpp:"
echo "----------------------------------------"
cat src/libxrpl/protocol/Feature.cpp
echo -e "\n\nSearching for lines containing 'feature' (case-insensitive):"
echo "----------------------------------------"
rg -i "feature" src/libxrpl/protocol/Feature.cpp
echo -e "\n\nSearching for lines containing 'uint256' (case-insensitive):"
echo "----------------------------------------"
rg -i "uint256" src/libxrpl/protocol/Feature.cpp
Length of output: 33950
Script:
#!/bin/bash
# Description: Count REGISTER_FEATURE and REGISTER_FIX calls in Feature.cpp and compare with numFeatures
# Count REGISTER_FEATURE and REGISTER_FIX calls
feature_count=$(grep -cE "REGISTER_(FEATURE|FIX)" src/libxrpl/protocol/Feature.cpp)
# Get the value of numFeatures from Feature.h
num_features=$(grep -oP "static constexpr std::size_t numFeatures = \K\d+" include/xrpl/protocol/Feature.h)
echo "Number of REGISTER_FEATURE and REGISTER_FIX calls: $feature_count"
echo "Value of numFeatures in Feature.h: $num_features"
if [ "$feature_count" -eq "$num_features" ]; then
echo "VERIFICATION SUCCESSFUL: The number of registered features matches numFeatures."
else
echo "VERIFICATION FAILED: Mismatch between registered features and numFeatures."
echo " Registered features: $feature_count"
echo " numFeatures: $num_features"
fi
Length of output: 688
o[sfAmount] = STEitherAmount{sfAmount, amount}; | ||
o[sfSignatureReward] = STAmount{rewardAmount}; |
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.
Update the rewardAmount
assignment to use STEitherAmount
.
The change in adding amount
to the STObject
correctly handles the transition from STAmount
to STEitherAmount
for the sfAmount
field.
However, to maintain consistency with the broader transition to STEitherAmount
, consider updating the rewardAmount
assignment to use STEitherAmount
as well.
Apply this diff to update the rewardAmount
assignment:
-o[sfSignatureReward] = STAmount{rewardAmount};
+o[sfSignatureReward] = STEitherAmount{sfSignatureReward, rewardAmount};
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.
o[sfAmount] = STEitherAmount{sfAmount, amount}; | |
o[sfSignatureReward] = STAmount{rewardAmount}; | |
o[sfAmount] = STEitherAmount{sfAmount, amount}; | |
o[sfSignatureReward] = STEitherAmount{sfSignatureReward, rewardAmount}; |
, amount(amount_) | ||
, rewardAmount(rewardAmount_) |
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 updating the constructor to use STEitherAmount
for the amount
and rewardAmount
parameters.
To align with the broader transition from STAmount
to STEitherAmount
for handling amounts, consider changing the amount
and rewardAmount
parameter types from STAmount const&
to STEitherAmount const&
.
Apply this diff to update the constructor:
XChainCreateAccountAttestation::XChainCreateAccountAttestation(
AccountID const& keyAccount_,
PublicKey const& publicKey_,
- STAmount const& amount_,
- STAmount const& rewardAmount_,
+ STEitherAmount const& amount_,
+ STEitherAmount const& rewardAmount_,
AccountID const& rewardAccount_,
bool wasLockingChainSend_,
AccountID const& dst_)
: keyAccount(keyAccount_)
, publicKey(publicKey_)
, amount(amount_)
, rewardAmount(rewardAmount_)
, rewardAccount(rewardAccount_)
, wasLockingChainSend(wasLockingChainSend_)
, dst(dst_)
{
}
Committable suggestion was skipped due to low confidence.
@@ -438,7 +438,7 @@ XChainClaimAttestation::XChainClaimAttestation( | |||
std::optional<AccountID> const& dst_) | |||
: keyAccount(keyAccount_) | |||
, publicKey(publicKey_) | |||
, amount(sfAmount, amount_) | |||
, amount(amount_) |
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 updating the constructor to use STEitherAmount
for the amount
parameter.
To align with the broader transition from STAmount
to STEitherAmount
for handling amounts, consider changing the amount
parameter type from STAmount const&
to STEitherAmount const&
.
Apply this diff to update the constructor:
XChainClaimAttestation::XChainClaimAttestation(
AccountID const& keyAccount_,
PublicKey const& publicKey_,
- STAmount const& amount_,
+ STEitherAmount const& amount_,
AccountID const& rewardAccount_,
bool wasLockingChainSend_,
std::optional<AccountID> const& dst_)
: keyAccount(keyAccount_)
, publicKey(publicKey_)
, amount(amount_)
, rewardAccount(rewardAccount_)
, wasLockingChainSend(wasLockingChainSend_)
, dst(dst_)
{
}
Committable suggestion was skipped due to low confidence.
@@ -26,10 +26,11 @@ | |||
#include <xrpl/basics/chrono.h> | |||
#include <xrpl/basics/contract.h> | |||
#include <xrpl/protocol/HashPrefix.h> | |||
#include <xrpl/protocol/Rules.h> |
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
Consider removing the unnecessary Rules.h
include
The inclusion of <xrpl/protocol/Rules.h>
in STObject.h
appears to be unnecessary. There is no direct usage of any symbols from Rules.h
in the header file. To improve compilation times and reduce unnecessary dependencies, consider removing this include statement.
Before removing it, please verify the following:
- Check if
STObject.cpp
(the implementation file) uses any symbols fromRules.h
. If it does, the include should be moved there instead. - Ensure that
STObject.h
doesn't rely on any types or definitions from the headers included byRules.h
(such asbase_uint.h
orSTVector256.h
). If it does, include those headers directly inSTObject.h
.
If neither of these conditions apply, you can safely remove the #include <xrpl/protocol/Rules.h>
line from STObject.h
.
Analysis chain
Verify the necessity of including Rules.h
.
Please ensure that including the Rules.h
header file is necessary and that the code in this file depends on definitions or declarations from Rules.h
. If the dependency is unnecessary, consider removing the include statement to improve compilation times and reduce coupling.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the code uses any symbols from Rules.h
if ! rg -qw 'Rule' include/xrpl/protocol/STObject.h; then
echo "Rules.h might be an unnecessary dependency."
else
echo "Rules.h appears to be a necessary dependency."
fi
Length of output: 143
Script:
#!/bin/bash
# 1. Check for any usage of symbols from Rules.h, regardless of case
echo "Searching for any 'rule' related symbols in STObject.h:"
rg -i 'rule' include/xrpl/protocol/STObject.h
# 2. Look for any comments explaining why Rules.h is included
echo -e "\nSearching for comments related to Rules.h:"
rg -i 'rules\.h' include/xrpl/protocol/STObject.h
# 3. Check if STObject.h is included in Rules.h
echo -e "\nChecking if STObject.h is included in Rules.h:"
rg '#include.*STObject\.h' include/xrpl/protocol/Rules.h
# 4. Check the content of Rules.h to understand what it provides
echo -e "\nDisplaying the content of Rules.h:"
cat include/xrpl/protocol/Rules.h
Length of output: 4266
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
Enhancements
Number
class to support conversion toMPTAmount
.STObject
class to manage different types of amounts flexibly.Bug Fixes
Documentation
Refactor
STAmount
class interface for better usability.