XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.53k stars 1.47k forks source link

[Work in Progress] add AccountPermission #5164

Open yinyiqian1 opened 4 weeks ago

yinyiqian1 commented 4 weeks ago

spec: https://github.com/XRPLF/XRPL-Standards/discussions/217 https://github.com/XRPLF/XRPL-Standards/discussions/218

This PR includes the following changes:

  1. Added AccountPermissionSet transaction. to enable an account(delegating account) delegate some permissions to another account(delegated account), so that the delegated account can send transactions on behalf of the delegating account.
  2. Added Account_Permission ledger object The AccountPermissionSet transaction will create AccountPermission ledger object, with keylet(delegating account, delegated account)
  3. Added Onbehalf of common field.
  4. Permission has two types: a. transaction level permission b. granular permission which will be part of a transaction

more details:

  1. introduced account and isDelegated in PreflightContext, PreclaimContext and ApplyContext. The account is the account which is the transaction being operated on.
  2. transactor's member account_ is updated to the account which is the transaction being operated on.
  3. a set of Granular Permissions gpSet is added to ApplyContext. It contains the granular permissions enabled for that transaction. But if the transaction is fully delegated, then even there are granular permissions related to that transaction, the gpSet will be cleared up. To be more specific: a. isDelegated=true && gpSet not empty: only granular permissions delegated to the transaction b. isDelegated=true && gpSet is empty: the transaction is fully delegated
  4. only the granular permissions listed in Permissions.cpp are supported, so the unauthorized granular operations and the other parts under these transactions are prohibited under granular permission mode.

High Level Overview of Change

Context of Change

Type of Change

API Impact

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 48.30287% with 198 lines in your changes missing coverage. Please review.

Project coverage is 77.6%. Comparing base (838978b) to head (372cc5c). Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/app/tx/detail/AccountPermissionSet.cpp 0.0% 59 Missing :warning:
src/libxrpl/protocol/Permissions.cpp 0.0% 34 Missing :warning:
src/xrpld/app/tx/detail/Transactor.cpp 8.8% 31 Missing :warning:
src/xrpld/app/tx/detail/SetTrust.cpp 22.7% 17 Missing :warning:
src/libxrpl/protocol/STParsedJSON.cpp 23.5% 13 Missing :warning:
src/xrpld/app/tx/detail/Payment.cpp 20.0% 12 Missing :warning:
src/xrpld/app/tx/detail/SetAccount.cpp 59.1% 9 Missing :warning:
src/libxrpl/protocol/Indexes.cpp 0.0% 5 Missing :warning:
src/xrpld/app/tx/detail/DeleteAccount.cpp 28.6% 5 Missing :warning:
src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp 58.3% 5 Missing :warning:
... and 3 more
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/XRPLF/rippled/pull/5164/graphs/tree.svg?width=650&height=150&src=pr&token=i2RPGI5xGF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) ```diff @@ Coverage Diff @@ ## develop #5164 +/- ## ========================================= - Coverage 77.9% 77.6% -0.3% ========================================= Files 782 785 +3 Lines 66621 66847 +226 Branches 8161 8277 +116 ========================================= - Hits 51902 51897 -5 - Misses 14719 14950 +231 ``` | [Files with missing lines](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) | Coverage Δ | | |---|---|---| | [include/xrpl/protocol/Feature.h](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=include%2Fxrpl%2Fprotocol%2FFeature.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-aW5jbHVkZS94cnBsL3Byb3RvY29sL0ZlYXR1cmUuaA==) | `100.0% <ø> (ø)` | | | [include/xrpl/protocol/Indexes.h](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=include%2Fxrpl%2Fprotocol%2FIndexes.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-aW5jbHVkZS94cnBsL3Byb3RvY29sL0luZGV4ZXMuaA==) | `100.0% <ø> (ø)` | | | [include/xrpl/protocol/detail/ledger\_entries.macro](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=include%2Fxrpl%2Fprotocol%2Fdetail%2Fledger_entries.macro&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-aW5jbHVkZS94cnBsL3Byb3RvY29sL2RldGFpbC9sZWRnZXJfZW50cmllcy5tYWNybw==) | `100.0% <100.0%> (ø)` | | | [include/xrpl/protocol/detail/transactions.macro](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=include%2Fxrpl%2Fprotocol%2Fdetail%2Ftransactions.macro&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-aW5jbHVkZS94cnBsL3Byb3RvY29sL2RldGFpbC90cmFuc2FjdGlvbnMubWFjcm8=) | `100.0% <100.0%> (ø)` | | | [src/libxrpl/protocol/InnerObjectFormats.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Flibxrpl%2Fprotocol%2FInnerObjectFormats.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL2xpYnhycGwvcHJvdG9jb2wvSW5uZXJPYmplY3RGb3JtYXRzLmNwcA==) | `100.0% <100.0%> (ø)` | | | [src/libxrpl/protocol/TxFormats.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Flibxrpl%2Fprotocol%2FTxFormats.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL2xpYnhycGwvcHJvdG9jb2wvVHhGb3JtYXRzLmNwcA==) | `100.0% <ø> (ø)` | | | [src/xrpld/app/tx/applySteps.h](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Fxrpld%2Fapp%2Ftx%2FapplySteps.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL3hycGxkL2FwcC90eC9hcHBseVN0ZXBzLmg=) | `100.0% <100.0%> (ø)` | | | [src/xrpld/app/tx/detail/AMMBid.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Fxrpld%2Fapp%2Ftx%2Fdetail%2FAMMBid.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL3hycGxkL2FwcC90eC9kZXRhaWwvQU1NQmlkLmNwcA==) | `90.4% <100.0%> (ø)` | | | [src/xrpld/app/tx/detail/AMMClawback.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Fxrpld%2Fapp%2Ftx%2Fdetail%2FAMMClawback.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL3hycGxkL2FwcC90eC9kZXRhaWwvQU1NQ2xhd2JhY2suY3Bw) | `100.0% <100.0%> (ø)` | | | [src/xrpld/app/tx/detail/AMMCreate.cpp](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&filepath=src%2Fxrpld%2Fapp%2Ftx%2Fdetail%2FAMMCreate.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF#diff-c3JjL3hycGxkL2FwcC90eC9kZXRhaWwvQU1NQ3JlYXRlLmNwcA==) | `90.5% <100.0%> (ø)` | | | ... and [45 more](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) | | ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/XRPLF/rippled/pull/5164/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF) [![Impacted file tree graph](https://app.codecov.io/gh/XRPLF/rippled/pull/5164/graphs/tree.svg?width=650&height=150&src=pr&token=i2RPGI5xGF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)](https://app.codecov.io/gh/XRPLF/rippled/pull/5164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=XRPLF)

🚨 Try these New Features:

gregtatcam commented 3 days ago

PR description should be added with a link to technical specifications if applicable.

yinyiqian1 commented 3 days ago

PR description should be added with a link to technical specifications if applicable.

just added

yinyiqian1 commented 3 days ago

FYI: unit test failures are transient, which have passed locally. "ERR:Env Env::close() failed: no response from server"