refactor: Rename sfield names, sfExtensionComputeLimit -> sfGasLimit, sfExtensionSizeLimit -> sfBytecodeSizeLimit (#7708)

This commit is contained in:
Rithvik Reddygari
2026-07-08 16:26:58 -04:00
committed by GitHub
parent 4a01fe5aa6
commit 2e48bb4b7f
21 changed files with 249 additions and 262 deletions

View File

@@ -14,8 +14,8 @@ inline constexpr std::uint32_t kFeeUnitsDeprecated = 10;
constexpr std::uint32_t microDropsPerDrop{1'000'000};
/** Maximum Feature Extension fee settings. */
inline constexpr std::uint32_t kMaxExtensionComputeLimit{2'000'000};
inline constexpr std::uint32_t kMaxExtensionSizeLimit{200'000};
inline constexpr std::uint32_t kMaxGasLimit{2'000'000};
inline constexpr std::uint32_t kMaxBytecodeSizeLimit{200'000};
/** Reflects the fee settings for a particular ledger.
@@ -33,11 +33,11 @@ struct Fees
/** @brief Additional XRP reserve required per owned ledger object. */
XRPAmount increment{0};
/** @brief Compute limit for Feature Extensions (instructions). */
std::uint32_t extensionComputeLimit{0};
/** @brief Gas limit for Feature Extensions (instructions). */
std::uint32_t gasLimit{0};
/** @brief Size limit for Feature Extensions (bytes). */
std::uint32_t extensionSizeLimit{0};
/** @brief Bytecode size limit for Feature Extensions (bytes). */
std::uint32_t bytecodeSizeLimit{0};
/** @brief Price of WASM gas (micro-drops). */
std::uint32_t gasPrice{0};

View File

@@ -305,8 +305,8 @@ LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
{sfReserveBaseDrops, SoeOptional},
{sfReserveIncrementDrops, SoeOptional},
// Smart Escrow fields
{sfExtensionComputeLimit, SoeOptional},
{sfExtensionSizeLimit, SoeOptional},
{sfGasLimit, SoeOptional},
{sfBytecodeSizeLimit, SoeOptional},
{sfGasPrice, SoeOptional},
{sfPreviousTxnID, SoeOptional},

View File

@@ -113,8 +113,8 @@ TYPED_SFIELD(sfInterestRate, UINT32, 65) // 1/10 basis points (bi
TYPED_SFIELD(sfLateInterestRate, UINT32, 66) // 1/10 basis points (bips)
TYPED_SFIELD(sfCloseInterestRate, UINT32, 67) // 1/10 basis points (bips)
TYPED_SFIELD(sfOverpaymentInterestRate, UINT32, 68) // 1/10 basis points (bips)
TYPED_SFIELD(sfExtensionComputeLimit, UINT32, 69)
TYPED_SFIELD(sfExtensionSizeLimit, UINT32, 70)
TYPED_SFIELD(sfGasLimit, UINT32, 69)
TYPED_SFIELD(sfBytecodeSizeLimit, UINT32, 70)
TYPED_SFIELD(sfGasPrice, UINT32, 71)
// 64-bit integers (common)

View File

@@ -1111,8 +1111,8 @@ TRANSACTION(ttFEE, 101, SetFee,
{sfReserveBaseDrops, SoeOptional},
{sfReserveIncrementDrops, SoeOptional},
// Smart Escrow fields
{sfExtensionComputeLimit, SoeOptional},
{sfExtensionSizeLimit, SoeOptional},
{sfGasLimit, SoeOptional},
{sfBytecodeSizeLimit, SoeOptional},
{sfGasPrice, SoeOptional},
}))

View File

@@ -248,8 +248,8 @@ JSS(expected_date); // out: any (warnings)
JSS(expected_date_UTC); // out: any (warnings)
JSS(expected_ledger_size); // out: TxQ
JSS(expiration); // out: AccountOffers, AccountChannels, ValidatorList, amm_info
JSS(extension_compute); // out: NetworkOPs
JSS(extension_size); // out: NetworkOPs
JSS(gas_limit); // out: NetworkOPs
JSS(bytecode_size_limit); // out: NetworkOPs
JSS(gas_price); // out: NetworkOPs
JSS(fail_hard); // in: Sign, Submit
JSS(failed); // out: InboundLedger

View File

@@ -214,51 +214,51 @@ public:
}
/**
* @brief Get sfExtensionComputeLimit (SoeOptional)
* @brief Get sfGasLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExtensionComputeLimit() const
getGasLimit() const
{
if (hasExtensionComputeLimit())
return this->sle_->at(sfExtensionComputeLimit);
if (hasGasLimit())
return this->sle_->at(sfGasLimit);
return std::nullopt;
}
/**
* @brief Check if sfExtensionComputeLimit is present.
* @brief Check if sfGasLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExtensionComputeLimit() const
hasGasLimit() const
{
return this->sle_->isFieldPresent(sfExtensionComputeLimit);
return this->sle_->isFieldPresent(sfGasLimit);
}
/**
* @brief Get sfExtensionSizeLimit (SoeOptional)
* @brief Get sfBytecodeSizeLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExtensionSizeLimit() const
getBytecodeSizeLimit() const
{
if (hasExtensionSizeLimit())
return this->sle_->at(sfExtensionSizeLimit);
if (hasBytecodeSizeLimit())
return this->sle_->at(sfBytecodeSizeLimit);
return std::nullopt;
}
/**
* @brief Check if sfExtensionSizeLimit is present.
* @brief Check if sfBytecodeSizeLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExtensionSizeLimit() const
hasBytecodeSizeLimit() const
{
return this->sle_->isFieldPresent(sfExtensionSizeLimit);
return this->sle_->isFieldPresent(sfBytecodeSizeLimit);
}
/**
@@ -446,24 +446,24 @@ public:
}
/**
* @brief Set sfExtensionComputeLimit (SoeOptional)
* @brief Set sfGasLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FeeSettingsBuilder&
setExtensionComputeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
setGasLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExtensionComputeLimit] = value;
object_[sfGasLimit] = value;
return *this;
}
/**
* @brief Set sfExtensionSizeLimit (SoeOptional)
* @brief Set sfBytecodeSizeLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
FeeSettingsBuilder&
setExtensionSizeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
setBytecodeSizeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExtensionSizeLimit] = value;
object_[sfBytecodeSizeLimit] = value;
return *this;
}

View File

@@ -256,55 +256,55 @@ public:
}
/**
* @brief Get sfExtensionComputeLimit (SoeOptional)
* @brief Get sfGasLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExtensionComputeLimit() const
getGasLimit() const
{
if (hasExtensionComputeLimit())
if (hasGasLimit())
{
return this->tx_->at(sfExtensionComputeLimit);
return this->tx_->at(sfGasLimit);
}
return std::nullopt;
}
/**
* @brief Check if sfExtensionComputeLimit is present.
* @brief Check if sfGasLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExtensionComputeLimit() const
hasGasLimit() const
{
return this->tx_->isFieldPresent(sfExtensionComputeLimit);
return this->tx_->isFieldPresent(sfGasLimit);
}
/**
* @brief Get sfExtensionSizeLimit (SoeOptional)
* @brief Get sfBytecodeSizeLimit (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getExtensionSizeLimit() const
getBytecodeSizeLimit() const
{
if (hasExtensionSizeLimit())
if (hasBytecodeSizeLimit())
{
return this->tx_->at(sfExtensionSizeLimit);
return this->tx_->at(sfBytecodeSizeLimit);
}
return std::nullopt;
}
/**
* @brief Check if sfExtensionSizeLimit is present.
* @brief Check if sfBytecodeSizeLimit is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasExtensionSizeLimit() const
hasBytecodeSizeLimit() const
{
return this->tx_->isFieldPresent(sfExtensionSizeLimit);
return this->tx_->isFieldPresent(sfBytecodeSizeLimit);
}
/**
@@ -463,24 +463,24 @@ public:
}
/**
* @brief Set sfExtensionComputeLimit (SoeOptional)
* @brief Set sfGasLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SetFeeBuilder&
setExtensionComputeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
setGasLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExtensionComputeLimit] = value;
object_[sfGasLimit] = value;
return *this;
}
/**
* @brief Set sfExtensionSizeLimit (SoeOptional)
* @brief Set sfBytecodeSizeLimit (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SetFeeBuilder&
setExtensionSizeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
setBytecodeSizeLimit(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfExtensionSizeLimit] = value;
object_[sfBytecodeSizeLimit] = value;
return *this;
}