Skip to content
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

Add allowClawback flag for account_info #4590

Merged
merged 4 commits into from
Jul 5, 2023

Conversation

shawnxie999
Copy link
Collaborator

@shawnxie999 shawnxie999 commented Jun 27, 2023

High Level Overview of Change

Clawback introduced an allowClawback flag for AccountRoot object. This PR updates the account_info API so that this flag is reflected in the API response.

Solves issue #4588

Context of Change

(Clawback implementation can be found here)

Example

{
   "result": {
      "account_data": {
         "Account": "rLqYRLKorwEWGzwCJLgtiCdKF416oGt4yx",
         "Balance": "99999999960",
         "Flags": 2147483648,
         "LedgerEntryType": "AccountRoot",
         "OwnerCount": 0,
         "PreviousTxnID": "6696AE4C3F6153E414B114E35EE7A232D03F7B5B8FCDA08A7F10250B49D8BA2C",
         "PreviousTxnLgrSeq": 264,
         "Sequence": 262,
         "index": "87F3974669983DE311498C7F34B2D40E00E9A8FCCCDAC6C026C91EC160934632"
      },
      "account_flags": {
         "allowClawback": true,
         "defaultRipple": false,
         "depositAuth": false,
         "disableMasterKey": false,
         "disallowIncomingXRP": false,
         "globalFreeze": false,
         "noFreeze": false,
         "passwordSpent": false,
         "requireAuthorization": false,
         "requireDestinationTag": false
      },
      "ledger_current_index": 266,
      "status": "success",
      "validated": false
   }
}
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

@shawnxie999 shawnxie999 marked this pull request as ready for review June 27, 2023 01:41
@kennyzlei kennyzlei requested review from ckniffen, nbougalis, seelabs, ckeshava and ledhed2222 and removed request for ckniffen June 27, 2023 02:18
@@ -607,6 +632,8 @@ class AccountInfo_test : public beast::unit_test::suite
ripple::test::jtx::supported_amendments()};
testAccountFlags(allFeatures);
testAccountFlags(allFeatures - featureDisallowIncoming);
testAccountFlags(
allFeatures - featureDisallowIncoming - featureClawback);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing the featureClawback from set of all features? Shouldn't that be enabled for us to run the unit tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amendments are included by default I think. So it has already been tested on lines 633 and 634

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh okay, got it.

@@ -508,13 +508,16 @@ class AccountInfo_test : public beast::unit_test::suite

Env env(*this, features);
Account const alice{"alice"};
env.fund(XRP(1000), alice);
Account const bob{"bob"};
env.fund(XRP(1000), alice, bob);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it required to fund bob's account in order to test the account flags?

Also, shouldn't the clawback feature be tested with a custom token (different from XRP) ?

Copy link
Collaborator Author

@shawnxie999 shawnxie999 Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom token is only needed for trustlines, we don’t do that here. This line is to just fund bob so that it becomes a valid account

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. But the clawback feature is not applicable for XRP token asset right?
Isn't it better to perform this check on an account with custom tokens, instead of XRP tokens?

It appears that we are only checking if certain flags are set/unset, so I guess it doesn't matter.

@ckeshava
Copy link
Collaborator

it looks good to me. it's strange that only the macOS workflow is failing, but I couldn't access the logs.

Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@intelliot
Copy link
Collaborator

intelliot commented Jul 4, 2023

it's strange that only the macOS workflow is failing, but I couldn't access the logs.

Attempt # 2 passed. I guess the earlier run failed due to either a glitch in GitHub, or because the macOS runner wasn't available at the time.

@shawnxie999
Copy link
Collaborator Author

@intelliot it failed because of the github downtime last week :-)

It's ready to merge.

@intelliot intelliot merged commit 77dc63b into XRPLF:develop Jul 5, 2023
ckeshava pushed a commit to ckeshava/rippled that referenced this pull request Jul 10, 2023
* Update the `account_info` API so that the `allowClawback` flag is
  included in the response.
  * The proposed `Clawback` amendement added an `allowClawback` flag in
    the `AccountRoot` object.
  * In the API response, under `account_flags`, there is now an
    `allowClawback` field with a boolean (`true` or `false`) value.
  * For reference, the XLS-39 Clawback implementation can be found in
    XRPLF#4553

Fix XRPLF#4588
ckeshava pushed a commit to ckeshava/rippled that referenced this pull request Sep 22, 2023
* Update the `account_info` API so that the `allowClawback` flag is
  included in the response.
  * The proposed `Clawback` amendement added an `allowClawback` flag in
    the `AccountRoot` object.
  * In the API response, under `account_flags`, there is now an
    `allowClawback` field with a boolean (`true` or `false`) value.
  * For reference, the XLS-39 Clawback implementation can be found in
    XRPLF#4553

Fix XRPLF#4588
ckeshava pushed a commit to ckeshava/rippled that referenced this pull request Sep 25, 2023
* Update the `account_info` API so that the `allowClawback` flag is
  included in the response.
  * The proposed `Clawback` amendement added an `allowClawback` flag in
    the `AccountRoot` object.
  * In the API response, under `account_flags`, there is now an
    `allowClawback` field with a boolean (`true` or `false`) value.
  * For reference, the XLS-39 Clawback implementation can be found in
    XRPLF#4553

Fix XRPLF#4588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants