-
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
Single Asset Vault #5224
base: develop
Are you sure you want to change the base?
Single Asset Vault #5224
Conversation
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.
I got compile error on MAC M1 Sequoia 15.1.1, apple clang 16.0.0
xrpl/json/json_value.h:705:5: error: constexpr function's return type 'Value' is not a literal type
705 | operator()(T&& t) const
xrpl/json/json_value.h:148:7: note: 'Value' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
148 | class Value
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.
There are a few warnings, of which the most common is:
xrpl/protocol/STIssue.h:49:5: warning: definition of implicit copy constructor for 'STIssue' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
49 | operator=(STIssue const& rhs) = default;
And once the compile error is fixed (remove constexpr
in to_json_fn::operator()
return value), there are VaultDelete
unit-tests failures.
This is fixed now. The |
2bcc6ad
to
17af6e7
Compare
Also remove potential ODR violation from json_value.h
@@ -44,6 +44,11 @@ class IOUAmount_test : public beast::unit_test::suite | |||
|
|||
IOUAmount const zz(beast::zero); | |||
BEAST_EXPECT(z == zz); | |||
|
|||
// https://github.com/XRPLF/rippled/issues/5170 | |||
IOUAmount const zzz{}; |
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.
IOUAmount const zzz{}; | |
IOUAmount const zzz{0, -100}; |
// https://github.com/XRPLF/rippled/issues/5170 | ||
IOUAmount const zzz{}; | ||
BEAST_EXPECT(zzz == beast::zero); | ||
// BEAST_EXPECT(zzz == zz); |
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.
The suggestion above fixes this test. The discrepancy comes from our custom assignment operator:
inline IOUAmount&
IOUAmount::operator=(beast::Zero)
{
// The -100 is used to allow 0 to sort less than small positive values
// which will have a large negative exponent.
mantissa_ = 0;
exponent_ = -100;
return *this;
}
JLOG(j.fatal()) << "Invariant failed: account root created " | ||
"by a non-Payment, by an unsuccessful transaction, " | ||
"or by AMM"; | ||
JLOG(j.fatal()) << "Invariant failed: account root created illegally"; |
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.
Since there are multiple reasons for this failure, it makes sense to add transaction details into this log (i.e. tx.getFullText()).
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.
Since there are multiple reasons for this failure, it makes sense to add transaction details into this log (i.e. tx.getFullText()).
The transaction ID should be sufficient. In almost all cases, a transaction that fails invariant checks will be applied to the ledger with a tec
code, so it can be looked up using the ID.
src/xrpld/ledger/View.h
Outdated
* if needed, on the basis of non-expired credentals found. | ||
*/ | ||
[[nodiscard]] TER | ||
verifyAuth( |
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.
Not sure if it's a good name since it doesn't just verify auth but also creates MPToken
.
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.
renamed to enforceMPTokenAuthorization
. A bit clumsy but that's best I could come up with :-|
src/xrpld/ledger/detail/View.cpp
Outdated
else if (!authorizedByDomain && domainCheck) // && sleToken, implied | ||
{ | ||
// We will only delete MPToken here if it has 0 balance | ||
[[maybe_unused]] auto _ = MPTokenAuthorize::authorize( |
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 to delete it? Later if permissions change then we'd have to create it again. Is there any harm in keeping MPToken
if it has 0 balance?
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.
I think we do - otherwise it won't be ever removed by anyone else. Unless MPTokens are all deleted when MPTokenIssuance is deleted ?
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.
No, we don't delete all MPToken when MPTokenIssuance is deleted. This could be computationally unbound. The argument in this case is that it's up to the holders to delete MPTToken. In case of SAV, MPToken is automatically created. So yes, it makes sense automatically delete even though there is some inefficiency.
This reverts commit 06a8a61.
- Also make MPTID more consistent
High Level Overview of Change
This is implementation of XLS-65 Single Asset Vault. First draft was implemented by @thejohnfreeman in #5147
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
)