Skip to content

Commit 61d628d

Browse files
authored
fix: Add restrictions to Permission Delegation: fixDelegateV1_1 (#5650)
- Amendment: fixDelegateV1_1 - In DelegateSet, disallow invalid PermissionValues like 0, and transaction values when the transaction's amendment is not enabled. Acts as if the transaction doesn't exist, which is the same thing older versions without the amendment will do. - Payment burn/mint should disallow DEX currency exchange. - Support MPT for Payment burn/mint.
1 parent 3d92375 commit 61d628d

File tree

12 files changed

+732
-102
lines changed

12 files changed

+732
-102
lines changed

include/xrpl/protocol/Permissions.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
2121
#define RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
2222

23+
#include <xrpl/protocol/Rules.h>
24+
#include <xrpl/protocol/TER.h>
2325
#include <xrpl/protocol/TxFormats.h>
2426

2527
#include <optional>
@@ -53,6 +55,8 @@ class Permission
5355
private:
5456
Permission();
5557

58+
std::unordered_map<std::uint16_t, uint256> txFeatureMap_;
59+
5660
std::unordered_map<std::uint16_t, Delegation> delegatableTx_;
5761

5862
std::unordered_map<std::string, GranularPermissionType>
@@ -80,7 +84,8 @@ class Permission
8084
getGranularTxType(GranularPermissionType const& gpType) const;
8185

8286
bool
83-
isDelegatable(std::uint32_t const& permissionValue) const;
87+
isDelegatable(std::uint32_t const& permissionValue, Rules const& rules)
88+
const;
8489

8590
// for tx level permission, permission value is equal to tx type plus one
8691
uint32_t

include/xrpl/protocol/TxFormats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ enum TxType : std::uint16_t
5959
#pragma push_macro("TRANSACTION")
6060
#undef TRANSACTION
6161

62-
#define TRANSACTION(tag, value, name, delegatable, fields) tag = value,
62+
#define TRANSACTION(tag, value, ...) tag = value,
6363

6464
#include <xrpl/protocol/detail/transactions.macro>
6565

include/xrpl/protocol/detail/features.macro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// If you add an amendment here, then do not forget to increment `numFeatures`
3333
// in include/xrpl/protocol/Feature.h.
3434

35+
XRPL_FIX (DelegateV1_1, Supported::no, VoteBehavior::DefaultNo)
3536
XRPL_FIX (PriceOracleOrder, Supported::no, VoteBehavior::DefaultNo)
3637
XRPL_FIX (MPTDeliveredAmount, Supported::no, VoteBehavior::DefaultNo)
3738
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)

0 commit comments

Comments
 (0)