-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Introduce MPT V1 support (XLS-33d) #5108
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>
69f2027
to
57c21a6
Compare
r -= 1; | ||
} | ||
if (r > std::numeric_limits<MPTAmount::value_type>::max()) | ||
Throw<std::overflow_error>("XRP mulRatio overflow"); |
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.
Nitpick: Overflow message should be MPT or MPTAmount instead of XRP.
std::size_t constexpr maxMPTokenMetadataLength = 1024; | ||
|
||
/** The maximum amount of MPTokenIssuance */ | ||
std::uint64_t constexpr maxMPTokenAmount = 0x7FFFFFFFFFFFFFFFull; |
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.
Stylistic: I had to put in '
every four digits to convince myself that there was the proper number of F
s.
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
List of warnings flagged by clang. None of these are caused by this commit. The first warning has already made its way onto develop. The rest are not yet on develop.
|
STAmount{ | ||
std::get<Issue>(issue), mantissa, exponent, native, negative}}; | ||
while (exponent-- > 0) | ||
mantissa *= 10; |
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.
What if mantissa > maxMPTokenAmount
prior to entering this loop, or becomes so after the *= 10
but before exponent == 0
?
Unless there is other logic to prevent this I think we need to guard against mantissa *= 10
overflowing the uint64_t
. This is only guaranteed if mantissa <= maxMPTokenAmount
prior to the *= 10
.
} | ||
|
||
while (exponent-- > 0) | ||
mantissa *= 10; |
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.
Do we need overflow checks here?
* 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
* MPT amount base 10 * add assert * revert formatting * test * add test for maxamt * clang * parse as base 10 for all mpt amounts
Replaced with #5143 |
High Level Overview of Change
New Transactions:
Modified Transactions:
New Objects:
API updates:
Refactor:
replaces STAmount as a serializable type for amount fields.
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
)Test Plan
Added test for new feature:
Future Tasks
Integrate MPT into XRPL DEX.