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

Permissioned Domains (XLS-80d) #5149

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/xrpl/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 79;
static constexpr std::size_t numFeatures = 80;

/** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated
Expand Down Expand Up @@ -372,6 +372,7 @@ extern uint256 const fixEnforceNFTokenTrustline;
extern uint256 const fixInnerObjTemplate2;
extern uint256 const featureInvariantsV1_1;
extern uint256 const fixNFTokenPageLinks;
extern uint256 const featurePermissionedDomains;

} // namespace ripple

Expand Down
5 changes: 5 additions & 0 deletions include/xrpl/protocol/Indexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ did(AccountID const& account) noexcept;
Keylet
oracle(AccountID const& account, std::uint32_t const& documentID) noexcept;

Keylet
mtrippled marked this conversation as resolved.
Show resolved Hide resolved
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept;

Keylet
permissionedDomain(uint256 const& domainID) noexcept;
} // namespace keylet

// Everything below is deprecated and should be removed in favor of keylets:
Expand Down
5 changes: 5 additions & 0 deletions include/xrpl/protocol/LedgerFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ enum LedgerEntryType : std::uint16_t
*/
ltORACLE = 0x0080,

/** A ledger object which tracks Permissioned Domain
\sa keylet::permissionedDomain
*/
ltPERMISSIONED_DOMAIN = 0x0077,

//---------------------------------------------------------------------------
/** A special type, matching any ledger entry type.

Expand Down
4 changes: 4 additions & 0 deletions include/xrpl/protocol/SField.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ extern SF_UINT256 const sfHookStateKey;
extern SF_UINT256 const sfHookHash;
extern SF_UINT256 const sfHookNamespace;
extern SF_UINT256 const sfHookSetTxnID;
extern SF_UINT256 const sfDomainID;

// currency amount (common)
extern SF_AMOUNT const sfAmount;
Expand Down Expand Up @@ -564,6 +565,7 @@ extern SF_VL const sfDIDDocument;
extern SF_VL const sfData;
extern SF_VL const sfAssetClass;
extern SF_VL const sfProvider;
extern SF_VL const sfCredentialType;

// variable length (uncommon)
extern SF_VL const sfFulfillment;
Expand Down Expand Up @@ -638,6 +640,7 @@ extern SField const sfVoteEntry;
extern SField const sfAuctionSlot;
extern SField const sfAuthAccount;
extern SField const sfPriceData;
extern SField const sfAcceptedCredential;

extern SField const sfSigner;
extern SField const sfMajority;
Expand Down Expand Up @@ -667,6 +670,7 @@ extern SField const sfHooks;
extern SField const sfVoteSlots;
extern SField const sfAuthAccounts;
extern SField const sfPriceDataSeries;
extern SField const sfAcceptedCredentials;

// array of objects (uncommon)
extern SField const sfMajorities;
Expand Down
6 changes: 6 additions & 0 deletions include/xrpl/protocol/TxFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ enum TxType : std::uint16_t
/** This transaction type fixes a problem in the ledger state */
ttLEDGER_STATE_FIX = 53,

/** This transaction type creates or modifies a Permissioned Domain */
ttPERMISSIONED_DOMAIN_SET = 54,

/** This transaction type deletes a Permissioned Domain */
ttPERMISSIONED_DOMAIN_DELETE = 55,


/** This system-generated transaction type is used to update the status of the various amendments.

Expand Down
4 changes: 4 additions & 0 deletions include/xrpl/protocol/jss.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ JSS(Payment); // transaction type.
JSS(PaymentChannelClaim); // transaction type.
JSS(PaymentChannelCreate); // transaction type.
JSS(PaymentChannelFund); // transaction type.
JSS(PermissionedDomain); // ledger type.
JSS(PermissionedDomainSet); // transaction type.
JSS(PermissionedDomainDelete); // transaction type.
JSS(PriceDataSeries); // field.
JSS(PriceData); // field.
JSS(Provider); // field.
Expand Down Expand Up @@ -551,6 +554,7 @@ JSS(peers); // out: InboundLedger, handlers/Peers, Overlay
JSS(peer_disconnects); // Severed peer connection counter.
JSS(peer_disconnects_resources); // Severed peer connections because of
// excess resource consumption.
JSS(permissioned_domain); // out: AccountObjects
JSS(port); // in: Connect, out: NetworkOPs
JSS(ports); // out: NetworkOPs
JSS(previous); // out: Reservations
Expand Down
1 change: 1 addition & 0 deletions src/libxrpl/protocol/Feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ REGISTER_FIX (fixNFTokenPageLinks, Supported::yes, VoteBehavior::De
// InvariantsV1_1 will be changes to Supported::yes when all the
// invariants expected to be included under it are complete.
REGISTER_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo);
REGISTER_FEATURE(PermissionedDomains, Supported::no, VoteBehavior::DefaultNo);

// The following amendments are obsolete, but must remain supported
// because they could potentially get enabled.
Expand Down
15 changes: 15 additions & 0 deletions src/libxrpl/protocol/Indexes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ enum class LedgerNameSpace : std::uint16_t {
XCHAIN_CREATE_ACCOUNT_CLAIM_ID = 'K',
DID = 'I',
ORACLE = 'R',
PERMISSIONED_DOMAIN = 'P',

// No longer used or supported. Left here to reserve the space
// to avoid accidental reuse.
Expand Down Expand Up @@ -451,6 +452,20 @@ oracle(AccountID const& account, std::uint32_t const& documentID) noexcept
return {ltORACLE, indexHash(LedgerNameSpace::ORACLE, account, documentID)};
}

Keylet
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept
{
return {
ltPERMISSIONED_DOMAIN,
indexHash(LedgerNameSpace::PERMISSIONED_DOMAIN, account, seq)};
}

Keylet
permissionedDomain(uint256 const& domainID) noexcept
{
return {ltPERMISSIONED_DOMAIN, domainID};
}

} // namespace keylet

} // namespace ripple
12 changes: 12 additions & 0 deletions src/libxrpl/protocol/LedgerFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ LedgerFormats::LedgerFormats()
},
commonFields);

add(jss::PermissionedDomain,
ltPERMISSIONED_DOMAIN,
{
{sfOwner, soeREQUIRED},
{sfSequence, soeREQUIRED},
mtrippled marked this conversation as resolved.
Show resolved Hide resolved
{sfAcceptedCredentials, soeREQUIRED},
{sfOwnerNode, soeREQUIRED},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}
},
commonFields);

// clang-format on
}

Expand Down
5 changes: 5 additions & 0 deletions src/libxrpl/protocol/SField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ CONSTRUCT_TYPED_SFIELD(sfHookStateKey, "HookStateKey", UINT256,
CONSTRUCT_TYPED_SFIELD(sfHookHash, "HookHash", UINT256, 31);
CONSTRUCT_TYPED_SFIELD(sfHookNamespace, "HookNamespace", UINT256, 32);
CONSTRUCT_TYPED_SFIELD(sfHookSetTxnID, "HookSetTxnID", UINT256, 33);
CONSTRUCT_TYPED_SFIELD(sfDomainID, "DomainID", UINT256, 34);

// currency amount (common)
CONSTRUCT_TYPED_SFIELD(sfAmount, "Amount", AMOUNT, 1);
Expand Down Expand Up @@ -307,6 +308,7 @@ CONSTRUCT_TYPED_SFIELD(sfDIDDocument, "DIDDocument", VL,
CONSTRUCT_TYPED_SFIELD(sfData, "Data", VL, 27);
CONSTRUCT_TYPED_SFIELD(sfAssetClass, "AssetClass", VL, 28);
CONSTRUCT_TYPED_SFIELD(sfProvider, "Provider", VL, 29);
CONSTRUCT_TYPED_SFIELD(sfCredentialType, "CredentialType", VL, 30);

// account
CONSTRUCT_TYPED_SFIELD(sfAccount, "Account", ACCOUNT, 1);
Expand Down Expand Up @@ -391,6 +393,8 @@ CONSTRUCT_UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement,
"XChainCreateAccountAttestationCollectionElement",
OBJECT, 31);
CONSTRUCT_UNTYPED_SFIELD(sfPriceData, "PriceData", OBJECT, 32);
// TODO perhaps this should be a typed field once actual credentials are merged.
CONSTRUCT_UNTYPED_SFIELD(sfAcceptedCredential, "AcceptedCredential", OBJECT, 33);

// array of objects
// ARRAY/1 is reserved for end of array
Expand All @@ -405,6 +409,7 @@ CONSTRUCT_UNTYPED_SFIELD(sfMemos, "Memos", ARRAY,
CONSTRUCT_UNTYPED_SFIELD(sfNFTokens, "NFTokens", ARRAY, 10);
CONSTRUCT_UNTYPED_SFIELD(sfHooks, "Hooks", ARRAY, 11);
CONSTRUCT_UNTYPED_SFIELD(sfVoteSlots, "VoteSlots", ARRAY, 12);
CONSTRUCT_UNTYPED_SFIELD(sfAcceptedCredentials, "AcceptedCredentials", ARRAY, 13);

// array of objects (uncommon)
CONSTRUCT_UNTYPED_SFIELD(sfMajorities, "Majorities", ARRAY, 16);
Expand Down
15 changes: 15 additions & 0 deletions src/libxrpl/protocol/TxFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,21 @@ TxFormats::TxFormats()
{sfOwner, soeOPTIONAL},
},
commonFields);

add(jss::PermissionedDomainSet,
ttPERMISSIONED_DOMAIN_SET,
{
{sfDomainID, soeOPTIONAL},
{sfAcceptedCredentials, soeREQUIRED},
},
commonFields);

add(jss::PermissionedDomainDelete,
ttPERMISSIONED_DOMAIN_DELETE,
{
{sfDomainID, soeREQUIRED},
},
commonFields);
}

TxFormats const&
Expand Down
Loading
Loading