respond to comments

This commit is contained in:
Mayukha Vadari
2026-07-29 17:29:18 -04:00
parent 0163366f78
commit e415c6d9eb
3 changed files with 38 additions and 46 deletions

View File

@@ -122,7 +122,7 @@ trustLine(AccountID const& id, Issue const& issue) noexcept
*/
/** @{ */
Keylet
offer(AccountID const& id, SeqProxy seq) noexcept;
offer(AccountID const& id, SeqProxy const& seq) noexcept;
inline Keylet
offer(uint256 const& key) noexcept
@@ -135,7 +135,7 @@ offer(uint256 const& key) noexcept
* The initial directory page for a specific quality
*/
Keylet
quality(Keylet const& k, std::uint64_t q) noexcept;
quality(Keylet const& k, std::uint64_t const q) noexcept;
/**
* The directory for the next lower quality
@@ -174,7 +174,7 @@ sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept;
*/
/** @{ */
Keylet
check(AccountID const& id, SeqProxy seq) noexcept;
check(AccountID const& id, SeqProxy const& seq) noexcept;
inline Keylet
check(uint256 const& key) noexcept
@@ -221,10 +221,10 @@ ownerDir(AccountID const& id) noexcept;
*/
/** @{ */
Keylet
page(uint256 const& root, std::uint64_t index = 0) noexcept;
page(uint256 const& root, std::uint64_t const index = 0) noexcept;
inline Keylet
page(Keylet const& root, std::uint64_t index = 0) noexcept
page(Keylet const& root, std::uint64_t const index = 0) noexcept
{
XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type");
return page(root.key, index);
@@ -235,13 +235,13 @@ page(Keylet const& root, std::uint64_t index = 0) noexcept
* An escrow entry
*/
Keylet
escrow(AccountID const& src, SeqProxy seq) noexcept;
escrow(AccountID const& src, SeqProxy const& seq) noexcept;
/**
* A PaymentChannel
*/
Keylet
payChannel(AccountID const& src, AccountID const& dst, SeqProxy seq) noexcept;
payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept;
/**
* NFT page keylets
@@ -272,7 +272,7 @@ nftokenPage(Keylet const& k, uint256 const& token);
* An offer from an account to buy or sell an NFT
*/
Keylet
nftokenOffer(AccountID const& owner, SeqProxy seq);
nftokenOffer(AccountID const& owner, SeqProxy const& seq);
inline Keylet
nftokenOffer(uint256 const& offer)
@@ -312,17 +312,17 @@ bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
// `seq` is stored as `sfXChainClaimID` in the object
Keylet
xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq);
xChainClaimID(STXChainBridge const& bridge, std::uint64_t const seq);
// `seq` is stored as `sfXChainAccountCreateCount` in the object
Keylet
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq);
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t const seq);
Keylet
did(AccountID const& account) noexcept;
Keylet
oracle(AccountID const& account, std::uint32_t const& documentID) noexcept;
oracle(AccountID const& account, std::uint32_t const documentID) noexcept;
Keylet
credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept;
@@ -333,9 +333,6 @@ credential(uint256 const& key) noexcept
return {ltCREDENTIAL, key};
}
Keylet
mptokenIssuance(SeqProxy seq, AccountID const& issuer) noexcept;
Keylet
mptokenIssuance(MPTID const& issuanceID) noexcept;
@@ -358,7 +355,7 @@ Keylet
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
Keylet
vault(AccountID const& owner, SeqProxy seq) noexcept;
vault(AccountID const& owner, SeqProxy const& seq) noexcept;
inline Keylet
vault(uint256 const& vaultKey)
@@ -367,7 +364,7 @@ vault(uint256 const& vaultKey)
}
Keylet
loanBroker(AccountID const& owner, SeqProxy seq) noexcept;
loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
inline Keylet
loanBroker(uint256 const& key)
@@ -385,7 +382,7 @@ loan(uint256 const& key)
}
Keylet
permissionedDomain(AccountID const& account, SeqProxy seq) noexcept;
permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept;
Keylet
permissionedDomain(uint256 const& domainID) noexcept;
@@ -416,6 +413,6 @@ struct KeyletDesc
extern std::array<KeyletDesc<AccountID const&>, 6> const kDirectAccountKeylets;
MPTID
makeMptID(std::uint32_t sequence, AccountID const& account);
makeMptID(std::uint32_t const sequence, AccountID const& account);
} // namespace xrpl

View File

@@ -181,12 +181,12 @@ getQuality(uint256 const& uBase)
}
MPTID
makeMptID(std::uint32_t sequence, AccountID const& account)
makeMptID(std::uint32_t const sequence, AccountID const& account)
{
MPTID u;
sequence = boost::endian::native_to_big(sequence);
memcpy(u.data(), &sequence, sizeof(sequence));
memcpy(u.data() + sizeof(sequence), account.data(), sizeof(account));
auto const bigEndianSequence = boost::endian::native_to_big(sequence);
memcpy(u.data(), &bigEndianSequence, sizeof(bigEndianSequence));
memcpy(u.data() + sizeof(bigEndianSequence), account.data(), sizeof(account));
return u;
}
@@ -273,13 +273,13 @@ trustLine(AccountID const& id0, AccountID const& id1, Currency const& currency)
}
Keylet
offer(AccountID const& id, SeqProxy seq) noexcept
offer(AccountID const& id, SeqProxy const& seq) noexcept
{
return {ltOFFER, indexHash(LedgerNameSpace::Offer, id, seq.value())};
}
Keylet
quality(Keylet const& k, std::uint64_t q) noexcept
quality(Keylet const& k, std::uint64_t const q) noexcept
{
XRPL_ASSERT(k.type == ltDIR_NODE, "xrpl::keylet::quality : valid input type");
@@ -307,7 +307,7 @@ next(Keylet const& k)
}
Keylet
ticket(AccountID const& id, SeqProxy seq)
ticket(AccountID const& id, SeqProxy const& seq)
{
return {ltTICKET, indexHash(LedgerNameSpace::Ticket, id, seq.value())};
}
@@ -316,7 +316,7 @@ ticket(AccountID const& id, SeqProxy seq)
// else. If we ever support multiple pages of signer lists, this would be the
// keylet used to locate them.
static Keylet
signerList(AccountID const& account, std::uint32_t page) noexcept
signerList(AccountID const& account, std::uint32_t const page) noexcept
{
return {ltSIGNER_LIST, indexHash(LedgerNameSpace::SignerList, account, page)};
}
@@ -334,7 +334,7 @@ sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept
}
Keylet
check(AccountID const& id, SeqProxy seq) noexcept
check(AccountID const& id, SeqProxy const& seq) noexcept
{
return {ltCHECK, indexHash(LedgerNameSpace::Check, id, seq.value())};
}
@@ -375,7 +375,7 @@ ownerDir(AccountID const& id) noexcept
}
Keylet
page(uint256 const& key, std::uint64_t index) noexcept
page(uint256 const& key, std::uint64_t const index) noexcept
{
if (index == 0)
return {ltDIR_NODE, key};
@@ -384,13 +384,13 @@ page(uint256 const& key, std::uint64_t index) noexcept
}
Keylet
escrow(AccountID const& src, SeqProxy seq) noexcept
escrow(AccountID const& src, SeqProxy const& seq) noexcept
{
return {ltESCROW, indexHash(LedgerNameSpace::Escrow, src, seq.value())};
}
Keylet
payChannel(AccountID const& src, AccountID const& dst, SeqProxy seq) noexcept
payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept
{
return {ltPAYCHAN, indexHash(LedgerNameSpace::XRPPaymentChannel, src, dst, seq.value())};
}
@@ -419,7 +419,7 @@ nftokenPage(Keylet const& k, uint256 const& token)
}
Keylet
nftokenOffer(AccountID const& owner, SeqProxy seq)
nftokenOffer(AccountID const& owner, SeqProxy const& seq)
{
return {ltNFTOKEN_OFFER, indexHash(LedgerNameSpace::NftokenOffer, owner, seq.value())};
}
@@ -493,7 +493,7 @@ bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType)
}
Keylet
xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq)
xChainClaimID(STXChainBridge const& bridge, std::uint64_t const seq)
{
return {
ltXCHAIN_OWNED_CLAIM_ID,
@@ -507,7 +507,7 @@ xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq)
}
Keylet
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq)
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t const seq)
{
return {
ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID,
@@ -527,17 +527,11 @@ did(AccountID const& account) noexcept
}
Keylet
oracle(AccountID const& account, std::uint32_t const& documentID) noexcept
oracle(AccountID const& account, std::uint32_t const documentID) noexcept
{
return {ltORACLE, indexHash(LedgerNameSpace::Oracle, account, documentID)};
}
Keylet
mptokenIssuance(SeqProxy seq, AccountID const& issuer) noexcept
{
return mptokenIssuance(makeMptID(seq.value(), issuer));
}
Keylet
mptokenIssuance(MPTID const& issuanceID) noexcept
{
@@ -563,13 +557,13 @@ credential(AccountID const& subject, AccountID const& issuer, Slice const& credT
}
Keylet
vault(AccountID const& owner, SeqProxy seq) noexcept
vault(AccountID const& owner, SeqProxy const& seq) noexcept
{
return vault(indexHash(LedgerNameSpace::Vault, owner, seq.value()));
}
Keylet
loanBroker(AccountID const& owner, SeqProxy seq) noexcept
loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept
{
return loanBroker(indexHash(LedgerNameSpace::LoanBroker, owner, seq.value()));
}
@@ -581,7 +575,7 @@ loan(uint256 const& loanBrokerID, SeqProxy loanSeq) noexcept
}
Keylet
permissionedDomain(AccountID const& account, SeqProxy seq) noexcept
permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept
{
return {
ltPERMISSIONED_DOMAIN,

View File

@@ -115,12 +115,13 @@ PermissionedDomainSet::doApply()
return tecINSUFFICIENT_RESERVE;
bool const fixEnabled = view().rules().enabled(fixCleanup3_1_3);
auto const seq = fixEnabled ? ctx_.tx.getSeqValue() : ctx_.tx.getFieldU32(sfSequence);
Keylet const pdKeylet = keylet::permissionedDomain(accountID_, SeqProxy::rawSequence(seq));
auto const seq = fixEnabled ? ctx_.tx.getSeqProxy()
: SeqProxy::rawSequence(ctx_.tx.getFieldU32(sfSequence));
Keylet const pdKeylet = keylet::permissionedDomain(accountID_, seq);
auto slePd = std::make_shared<SLE>(pdKeylet);
slePd->setAccountID(sfOwner, accountID_);
slePd->setFieldU32(sfSequence, seq);
slePd->setFieldU32(sfSequence, seq.value());
slePd->peekFieldArray(sfAcceptedCredentials) = std::move(sortedLE);
auto const page =
view().dirInsert(keylet::ownerDir(accountID_), pdKeylet, describeOwnerDir(accountID_));