mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Add PermissionDelegation feature (#5354)
This change implements the account permission delegation described in XLS-75d, see https://github.com/XRPLF/XRPL-Standards/pull/257. * Introduces transaction-level and granular permissions that can be delegated to other accounts. * Adds `DelegateSet` transaction to grant specified permissions to another account. * Adds `ltDelegate` ledger object to maintain the permission list for delegating/delegated account pair. * Adds an optional `Delegate` field in common fields, allowing a delegated account to send transactions on behalf of the delegating account within the granted permission scope. The `Account` field remains the delegating account; the `Delegate` field specifies the delegated account. The transaction is signed by the delegated account.
This commit is contained in:
@@ -2042,6 +2042,78 @@ static constexpr TxnTestData txnTestArray[] = {
|
||||
"Cannot specify differing 'Amount' and 'DeliverMax'",
|
||||
"Cannot specify differing 'Amount' and 'DeliverMax'"}}},
|
||||
|
||||
{"Minimal delegated transaction.",
|
||||
__LINE__,
|
||||
R"({
|
||||
"command": "doesnt_matter",
|
||||
"secret": "a",
|
||||
"tx_json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Amount": "1000000000",
|
||||
"Destination": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA",
|
||||
"TransactionType": "Payment",
|
||||
"Delegate": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
|
||||
}
|
||||
})",
|
||||
{{"",
|
||||
"",
|
||||
"Missing field 'account'.",
|
||||
"Missing field 'tx_json.Sequence'."}}},
|
||||
|
||||
{"Delegate not well formed.",
|
||||
__LINE__,
|
||||
R"({
|
||||
"command": "doesnt_matter",
|
||||
"secret": "a",
|
||||
"tx_json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Amount": "1000000000",
|
||||
"Destination": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi",
|
||||
"TransactionType": "Payment",
|
||||
"Delegate": "NotAnAccount"
|
||||
}
|
||||
})",
|
||||
{{"Invalid field 'tx_json.Delegate'.",
|
||||
"Invalid field 'tx_json.Delegate'.",
|
||||
"Missing field 'account'.",
|
||||
"Missing field 'tx_json.Sequence'."}}},
|
||||
|
||||
{"Delegate not in ledger.",
|
||||
__LINE__,
|
||||
R"({
|
||||
"command": "doesnt_matter",
|
||||
"secret": "a",
|
||||
"tx_json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Amount": "1000000000",
|
||||
"Destination": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi",
|
||||
"TransactionType": "Payment",
|
||||
"Delegate": "rDg53Haik2475DJx8bjMDSDPj4VX7htaMd"
|
||||
}
|
||||
})",
|
||||
{{"Delegate account not found.",
|
||||
"Delegate account not found.",
|
||||
"Missing field 'account'.",
|
||||
"Missing field 'tx_json.Sequence'."}}},
|
||||
|
||||
{"Delegate and secret not match.",
|
||||
__LINE__,
|
||||
R"({
|
||||
"command": "doesnt_matter",
|
||||
"secret": "aa",
|
||||
"tx_json": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Amount": "1000000000",
|
||||
"Destination": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi",
|
||||
"TransactionType": "Payment",
|
||||
"Delegate": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"
|
||||
}
|
||||
})",
|
||||
{{"Secret does not match account.",
|
||||
"Secret does not match account.",
|
||||
"Missing field 'account'.",
|
||||
"Missing field 'tx_json.Sequence'."}}},
|
||||
|
||||
};
|
||||
|
||||
class JSONRPC_test : public beast::unit_test::suite
|
||||
|
||||
Reference in New Issue
Block a user