fix more issues, reduce diff

This commit is contained in:
Mayukha Vadari
2025-09-18 17:24:30 -04:00
parent c14bc53aa3
commit 6733689102
5 changed files with 27 additions and 147 deletions

View File

@@ -293,9 +293,11 @@ delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
Keylet Keylet
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType); bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
// `seq` is stored as `sfXChainClaimID` in the object
Keylet Keylet
xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq); xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq);
// `seq` is stored as `sfXChainAccountCreateCount` in the object
Keylet Keylet
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq); xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq);

View File

@@ -22,7 +22,6 @@
#include <xrpl/basics/ByteUtilities.h> #include <xrpl/basics/ByteUtilities.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>
#include <xrpl/basics/partitioned_unordered_map.h>
#include <cstdint> #include <cstdint>
@@ -133,13 +132,6 @@ std::uint8_t constexpr vaultMaximumIOUScale = 18;
* another vault; counted from 0 */ * another vault; counted from 0 */
std::uint8_t constexpr maxAssetCheckDepth = 5; std::uint8_t constexpr maxAssetCheckDepth = 5;
/** The maximum length of a Data field in Escrow object that can be updated by
* Wasm code */
std::size_t constexpr maxWasmDataLength = 4 * 1024;
/** The maximum length of a parameters passed from Wasm code*/
std::size_t constexpr maxWasmParamLength = 1024;
/** A ledger index. */ /** A ledger index. */
using LedgerIndex = std::uint32_t; using LedgerIndex = std::uint32_t;
@@ -186,6 +178,13 @@ std::size_t constexpr permissionMaxSize = 10;
/** The maximum number of transactions that can be in a batch. */ /** The maximum number of transactions that can be in a batch. */
std::size_t constexpr maxBatchTxCount = 8; std::size_t constexpr maxBatchTxCount = 8;
/** The maximum length of a Data field in Escrow object that can be updated by
* Wasm code */
std::size_t constexpr maxWasmDataLength = 4 * 1024;
/** The maximum length of a parameters passed from Wasm code*/
std::size_t constexpr maxWasmParamLength = 1024;
} // namespace ripple } // namespace ripple
#endif #endif

View File

@@ -120,6 +120,7 @@ LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
// All fields are soeREQUIRED because there is always a SignerEntries. // All fields are soeREQUIRED because there is always a SignerEntries.
// If there are no SignerEntries the node is deleted. // If there are no SignerEntries the node is deleted.
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({ LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
{sfOwner, soeOPTIONAL},
{sfOwnerNode, soeREQUIRED}, {sfOwnerNode, soeREQUIRED},
{sfSignerQuorum, soeREQUIRED}, {sfSignerQuorum, soeREQUIRED},
{sfSignerEntries, soeREQUIRED}, {sfSignerEntries, soeREQUIRED},
@@ -188,7 +189,7 @@ LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
{sfNFTokenID, soeOPTIONAL}, {sfNFTokenID, soeOPTIONAL},
{sfPreviousTxnID, soeOPTIONAL}, {sfPreviousTxnID, soeOPTIONAL},
{sfPreviousTxnLgrSeq, soeOPTIONAL}, {sfPreviousTxnLgrSeq, soeOPTIONAL},
{sfDomainID, soeOPTIONAL} {sfDomainID, soeOPTIONAL} // order book directories
})) }))
/** The ledger object which lists details about amendments on the network. /** The ledger object which lists details about amendments on the network.
@@ -319,7 +320,6 @@ LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
{sfBaseFeeDrops, soeOPTIONAL}, {sfBaseFeeDrops, soeOPTIONAL},
{sfReserveBaseDrops, soeOPTIONAL}, {sfReserveBaseDrops, soeOPTIONAL},
{sfReserveIncrementDrops, soeOPTIONAL}, {sfReserveIncrementDrops, soeOPTIONAL},
{sfPreviousTxnID, soeOPTIONAL}, {sfPreviousTxnID, soeOPTIONAL},
{sfPreviousTxnLgrSeq, soeOPTIONAL}, {sfPreviousTxnLgrSeq, soeOPTIONAL},
})) }))
@@ -344,6 +344,7 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAc
*/ */
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
{sfAccount, soeREQUIRED}, {sfAccount, soeREQUIRED},
{sfSequence, soeOPTIONAL},
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfCondition, soeOPTIONAL}, {sfCondition, soeOPTIONAL},
@@ -368,6 +369,7 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({ LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
{sfAccount, soeREQUIRED}, {sfAccount, soeREQUIRED},
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfSequence, soeOPTIONAL},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfBalance, soeREQUIRED}, {sfBalance, soeREQUIRED},
{sfPublicKey, soeREQUIRED}, {sfPublicKey, soeREQUIRED},
@@ -415,6 +417,7 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
{sfPreviousTxnID, soeREQUIRED}, {sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}, {sfPreviousTxnLgrSeq, soeREQUIRED},
{sfDomainID, soeOPTIONAL}, {sfDomainID, soeOPTIONAL},
{sfMutableFlags, soeDEFAULT},
})) }))
/** A ledger object which tracks MPToken /** A ledger object which tracks MPToken
@@ -435,6 +438,7 @@ LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
*/ */
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({ LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
{sfOwner, soeREQUIRED}, {sfOwner, soeREQUIRED},
{sfOracleDocumentID, soeOPTIONAL},
{sfProvider, soeREQUIRED}, {sfProvider, soeREQUIRED},
{sfPriceDataSeries, soeREQUIRED}, {sfPriceDataSeries, soeREQUIRED},
{sfAssetClass, soeREQUIRED}, {sfAssetClass, soeREQUIRED},

View File

@@ -179,7 +179,8 @@ TYPED_SFIELD(sfNFTokenID, UINT256, 10)
TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11) TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11)
TYPED_SFIELD(sfEmitNonce, UINT256, 12) TYPED_SFIELD(sfEmitNonce, UINT256, 12)
TYPED_SFIELD(sfEmitHookHash, UINT256, 13) TYPED_SFIELD(sfEmitHookHash, UINT256, 13)
TYPED_SFIELD(sfAMMID, UINT256, 14) TYPED_SFIELD(sfAMMID, UINT256, 14,
SField::sMD_PseudoAccount | SField::sMD_Default)
// 256-bit (uncommon) // 256-bit (uncommon)
TYPED_SFIELD(sfBookDirectory, UINT256, 16) TYPED_SFIELD(sfBookDirectory, UINT256, 16)
@@ -201,7 +202,8 @@ TYPED_SFIELD(sfHookHash, UINT256, 31)
TYPED_SFIELD(sfHookNamespace, UINT256, 32) TYPED_SFIELD(sfHookNamespace, UINT256, 32)
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33) TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
TYPED_SFIELD(sfDomainID, UINT256, 34) TYPED_SFIELD(sfDomainID, UINT256, 34)
TYPED_SFIELD(sfVaultID, UINT256, 35) TYPED_SFIELD(sfVaultID, UINT256, 35,
SField::sMD_PseudoAccount | SField::sMD_Default)
TYPED_SFIELD(sfParentBatchID, UINT256, 36) TYPED_SFIELD(sfParentBatchID, UINT256, 36)
// number (common) // number (common)
@@ -250,6 +252,7 @@ TYPED_SFIELD(sfPrice, AMOUNT, 28)
TYPED_SFIELD(sfSignatureReward, AMOUNT, 29) TYPED_SFIELD(sfSignatureReward, AMOUNT, 29)
TYPED_SFIELD(sfMinAccountCreateAmount, AMOUNT, 30) TYPED_SFIELD(sfMinAccountCreateAmount, AMOUNT, 30)
TYPED_SFIELD(sfLPTokenBalance, AMOUNT, 31) TYPED_SFIELD(sfLPTokenBalance, AMOUNT, 31)
TYPED_SFIELD(sfFinishFunction, VL, 32)
// variable length (common) // variable length (common)
TYPED_SFIELD(sfPublicKey, VL, 1) TYPED_SFIELD(sfPublicKey, VL, 1)
@@ -284,7 +287,6 @@ TYPED_SFIELD(sfAssetClass, VL, 28)
TYPED_SFIELD(sfProvider, VL, 29) TYPED_SFIELD(sfProvider, VL, 29)
TYPED_SFIELD(sfMPTokenMetadata, VL, 30) TYPED_SFIELD(sfMPTokenMetadata, VL, 30)
TYPED_SFIELD(sfCredentialType, VL, 31) TYPED_SFIELD(sfCredentialType, VL, 31)
TYPED_SFIELD(sfFinishFunction, VL, 32)
// account (common) // account (common)
TYPED_SFIELD(sfAccount, ACCOUNT, 1) TYPED_SFIELD(sfAccount, ACCOUNT, 1)

View File

@@ -22,6 +22,7 @@
#include <test/jtx/Account.h> #include <test/jtx/Account.h>
#include <test/jtx/Env.h> #include <test/jtx/Env.h>
#include <test/jtx/TestHelpers.h>
#include <test/jtx/owners.h> #include <test/jtx/owners.h>
#include <test/jtx/rate.h> #include <test/jtx/rate.h>
@@ -93,140 +94,12 @@ std::array<std::uint8_t, 39> const cb3 = {
0x26, 0x4A, 0x2D, 0x85, 0x7B, 0xE8, 0xA0, 0x9C, 0x1D, 0xFD, 0x26, 0x4A, 0x2D, 0x85, 0x7B, 0xE8, 0xA0, 0x9C, 0x1D, 0xFD,
0x57, 0x0D, 0x15, 0x85, 0x8B, 0xD4, 0x81, 0x01, 0x04}}; 0x57, 0x0D, 0x15, 0x85, 0x8B, 0xD4, 0x81, 0x01, 0x04}};
/** Set the "FinishAfter" time tag on a JTx */ auto const finish_time = JTxFieldWrapper<timePointField>(sfFinishAfter);
struct finish_time auto const cancel_time = JTxFieldWrapper<timePointField>(sfCancelAfter);
{ auto const condition = JTxFieldWrapper<blobField>(sfCondition);
private: auto const fulfillment = JTxFieldWrapper<blobField>(sfFulfillment);
NetClock::time_point value_; auto const finish_function = JTxFieldWrapper<blobField>(sfFinishFunction);
auto const data = JTxFieldWrapper<blobField>(sfData);
public:
explicit finish_time(NetClock::time_point const& value) : value_(value)
{
}
void
operator()(Env&, JTx& jt) const
{
jt.jv[sfFinishAfter.jsonName] = value_.time_since_epoch().count();
}
};
/** Set the "CancelAfter" time tag on a JTx */
struct cancel_time
{
private:
NetClock::time_point value_;
public:
explicit cancel_time(NetClock::time_point const& value) : value_(value)
{
}
void
operator()(jtx::Env&, jtx::JTx& jt) const
{
jt.jv[sfCancelAfter.jsonName] = value_.time_since_epoch().count();
}
};
struct condition
{
private:
std::string value_;
public:
explicit condition(Slice const& cond) : value_(strHex(cond))
{
}
template <size_t N>
explicit condition(std::array<std::uint8_t, N> const& c)
: condition(makeSlice(c))
{
}
void
operator()(Env&, JTx& jt) const
{
jt.jv[sfCondition.jsonName] = value_;
}
};
struct fulfillment
{
private:
std::string value_;
public:
explicit fulfillment(Slice condition) : value_(strHex(condition))
{
}
template <size_t N>
explicit fulfillment(std::array<std::uint8_t, N> f)
: fulfillment(makeSlice(f))
{
}
void
operator()(Env&, JTx& jt) const
{
jt.jv[sfFulfillment.jsonName] = value_;
}
};
struct finish_function
{
private:
std::string value_;
public:
explicit finish_function(std::string func) : value_(func)
{
}
explicit finish_function(Slice const& func) : value_(strHex(func))
{
}
template <size_t N>
explicit finish_function(std::array<std::uint8_t, N> const& f)
: finish_function(makeSlice(f))
{
}
void
operator()(Env&, JTx& jt) const
{
jt.jv[sfFinishFunction.jsonName] = value_;
}
};
struct data
{
private:
std::string value_;
public:
explicit data(std::string func) : value_(func)
{
}
explicit data(Slice const& func) : value_(strHex(func))
{
}
template <size_t N>
explicit data(std::array<std::uint8_t, N> const& f) : data(makeSlice(f))
{
}
void
operator()(Env&, JTx& jt) const
{
jt.jv[sfData.jsonName] = value_;
}
};
struct comp_allowance struct comp_allowance
{ {