-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Single Asset Vault #5224
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
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5224 +/- ##
=========================================
+ Coverage 78.1% 78.3% +0.2%
=========================================
Files 795 808 +13
Lines 68582 69629 +1047
Branches 8278 8293 +15
=========================================
+ Hits 53574 54521 +947
- Misses 15008 15108 +100
🚀 New features to boost your workflow:
|
@@ -80,17 +85,23 @@ VaultDeposit::preclaim(PreclaimContext const& ctx) | |||
|
|||
if ((vault->getFlags() & tfVaultPrivate) && account != vault->at(sfOwner)) |
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.
STObject::isFlag()
is a nice helper function that abstracts the getFlags() & tfWhatever
check. It's not the best name. Probably should have been called isFlagSet
. But I like it because it's more concise and precise. Consider switching to it.
if ((vault->getFlags() & tfVaultPrivate) && account != vault->at(sfOwner)) | |
if ((vault->isFlag(tfVaultPrivate)) && account != vault->at(sfOwner)) |
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.
Thanks, done.
.mptIssuanceID = mptIssuanceID->value(), | ||
.accountID = account_}); | ||
!isTesSuccess(err)) | ||
return err; | ||
} | ||
|
||
// If the vault is private, set the authorized flag for the vault owner | ||
if (vault->getFlags() & tfVaultPrivate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also use isFlag()
|
||
return tesSUCCESS; | ||
XRPL_ASSERT( | ||
sleIssuance->getFieldU32(sfFlags) & lsfMPTRequireAuth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also use isFlag()
src/xrpld/ledger/detail/View.cpp
Outdated
if (sleIssuance->getFieldU32(sfFlags) & lsfMPTRequireAuth && | ||
!(sleToken->getFlags() & lsfMPTAuthorized)) |
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.
Both of these checks could also use isFlag
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.
Thanks, done (in requireAuth
)
src/xrpld/rpc/handlers/VaultInfo.cpp
Outdated
{ | ||
if (!uNodeIndex.parseHex(params[jss::vault_id].asString())) | ||
{ | ||
jvResult[jss::error] = "malformedRequest"; |
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.
It would be good (in this file) where any checks that is checking for wrong type, rpcINVALID_PARAMS
is used instead of malformedRequest
to maintain consistency across other handlers
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.
Thanks, done
Also drive-by fix in MPTokenIssuanceDestroy, the sfOutstandingAmount field is required.
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
)