Skip to content
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
6 changes: 3 additions & 3 deletions include/xrpl/ledger/ApplyViewImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class ApplyViewImpl final : public detail::ApplyViewBase
}

void
setWasmReturnCode(std::int32_t const wasmReturnCode)
setVMReturnCode(std::int32_t const vmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
vmReturnCode_ = vmReturnCode;
}

/** Get the number of modified entries
Expand All @@ -85,7 +85,7 @@ class ApplyViewImpl final : public detail::ApplyViewBase
private:
std::optional<STAmount> deliver_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
std::optional<std::int32_t> vmReturnCode_;
};

} // namespace xrpl
2 changes: 1 addition & 1 deletion include/xrpl/ledger/detail/ApplyStateTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ApplyStateTable
std::optional<STAmount> const& deliver,
std::optional<uint256 const> const& parentBatchId,
std::optional<std::uint32_t> const& gasUsed,
std::optional<std::int32_t> const& wasmReturnCode,
std::optional<std::int32_t> const& vmReturnCode,
bool isDryRun,
beast::Journal j);

Expand Down
14 changes: 7 additions & 7 deletions include/xrpl/protocol/TxMeta.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class TxMeta
if (obj.isFieldPresent(sfGasUsed))
gasUsed_ = obj.getFieldU32(sfGasUsed);

if (obj.isFieldPresent(sfWasmReturnCode))
wasmReturnCode_ = obj.getFieldI32(sfWasmReturnCode);
if (obj.isFieldPresent(sfVMReturnCode))
vmReturnCode_ = obj.getFieldI32(sfVMReturnCode);
}

[[nodiscard]] std::optional<STAmount> const&
Expand Down Expand Up @@ -123,15 +123,15 @@ class TxMeta
}

void
setWasmReturnCode(std::optional<std::int32_t> const wasmReturnCode)
setVMReturnCode(std::optional<std::int32_t> const vmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
vmReturnCode_ = vmReturnCode;
}

[[nodiscard]] std::optional<std::int32_t> const&
getWasmReturnCode() const
getVMReturnCode() const
{
return wasmReturnCode_;
return vmReturnCode_;
}

private:
Expand All @@ -143,7 +143,7 @@ class TxMeta
std::optional<STAmount> deliveredAmount_;
std::optional<uint256> parentBatchID_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
std::optional<std::int32_t> vmReturnCode_;

STArray nodes_;
};
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/protocol/detail/ledger_entries.macro
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
{sfCondition, SoeOptional},
{sfCancelAfter, SoeOptional},
{sfFinishAfter, SoeOptional},
{sfFinishFunction, SoeOptional},
{sfBytecode, SoeOptional},
{sfData, SoeOptional},
{sfSourceTag, SoeOptional},
{sfDestinationTag, SoeOptional},
Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/protocol/detail/sfields.macro
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TYPED_SFIELD(sfOverpaymentInterestRate, UINT32, 68) // 1/10 basis points (bi
TYPED_SFIELD(sfExtensionComputeLimit, UINT32, 69)
TYPED_SFIELD(sfExtensionSizeLimit, UINT32, 70)
TYPED_SFIELD(sfGasPrice, UINT32, 71)
TYPED_SFIELD(sfComputationAllowance, UINT32, 72)
TYPED_SFIELD(sfGas, UINT32, 72)
TYPED_SFIELD(sfGasUsed, UINT32, 73)

// 64-bit integers (common)
Expand Down Expand Up @@ -232,7 +232,7 @@ TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::kSmdNeedsAsset

// 32-bit signed (common)
TYPED_SFIELD(sfLoanScale, INT32, 1)
TYPED_SFIELD(sfWasmReturnCode, INT32, 2)
TYPED_SFIELD(sfVMReturnCode, INT32, 2)

// currency amount (common)
TYPED_SFIELD(sfAmount, AMOUNT, 1)
Expand Down Expand Up @@ -304,7 +304,7 @@ TYPED_SFIELD(sfAssetClass, VL, 28)
TYPED_SFIELD(sfProvider, VL, 29)
TYPED_SFIELD(sfMPTokenMetadata, VL, 30)
TYPED_SFIELD(sfCredentialType, VL, 31)
TYPED_SFIELD(sfFinishFunction, VL, 32)
TYPED_SFIELD(sfBytecode, VL, 32)

// account (common)
TYPED_SFIELD(sfAccount, ACCOUNT, 1)
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/protocol/detail/transactions.macro
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
{sfCondition, SoeOptional},
{sfCancelAfter, SoeOptional},
{sfFinishAfter, SoeOptional},
{sfFinishFunction, SoeOptional},
{sfBytecode, SoeOptional},
{sfData, SoeOptional},
}))

Expand All @@ -73,7 +73,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
{sfFulfillment, SoeOptional},
{sfCondition, SoeOptional},
{sfCredentialIDs, SoeOptional},
{sfComputationAllowance, SoeOptional},
{sfGas, SoeOptional},
}))


Expand Down
20 changes: 10 additions & 10 deletions include/xrpl/protocol_autogen/ledger_entries/Escrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,27 @@ class Escrow : public LedgerEntryBase
}

/**
* @brief Get sfFinishFunction (SoeOptional)
* @brief Get sfBytecode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getFinishFunction() const
getBytecode() const
{
if (hasFinishFunction())
return this->sle_->at(sfFinishFunction);
if (hasBytecode())
return this->sle_->at(sfBytecode);
return std::nullopt;
}

/**
* @brief Check if sfFinishFunction is present.
* @brief Check if sfBytecode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFinishFunction() const
hasBytecode() const
{
return this->sle_->isFieldPresent(sfFinishFunction);
return this->sle_->isFieldPresent(sfBytecode);
}

/**
Expand Down Expand Up @@ -500,13 +500,13 @@ class EscrowBuilder : public LedgerEntryBuilderBase<EscrowBuilder>
}

/**
* @brief Set sfFinishFunction (SoeOptional)
* @brief Set sfBytecode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
EscrowBuilder&
setFinishFunction(std::decay_t<typename SF_VL::type::value_type> const& value)
setBytecode(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfFinishFunction] = value;
object_[sfBytecode] = value;
return *this;
}

Expand Down
20 changes: 10 additions & 10 deletions include/xrpl/protocol_autogen/transactions/EscrowCreate.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,29 +175,29 @@ class EscrowCreate : public TransactionBase
}

/**
* @brief Get sfFinishFunction (SoeOptional)
* @brief Get sfBytecode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_VL::type::value_type>
getFinishFunction() const
getBytecode() const
{
if (hasFinishFunction())
if (hasBytecode())
{
return this->tx_->at(sfFinishFunction);
return this->tx_->at(sfBytecode);
}
return std::nullopt;
}

/**
* @brief Check if sfFinishFunction is present.
* @brief Check if sfBytecode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasFinishFunction() const
hasBytecode() const
{
return this->tx_->isFieldPresent(sfFinishFunction);
return this->tx_->isFieldPresent(sfBytecode);
}

/**
Expand Down Expand Up @@ -339,13 +339,13 @@ class EscrowCreateBuilder : public TransactionBuilderBase<EscrowCreateBuilder>
}

/**
* @brief Set sfFinishFunction (SoeOptional)
* @brief Set sfBytecode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
EscrowCreateBuilder&
setFinishFunction(std::decay_t<typename SF_VL::type::value_type> const& value)
setBytecode(std::decay_t<typename SF_VL::type::value_type> const& value)
{
object_[sfFinishFunction] = value;
object_[sfBytecode] = value;
return *this;
}

Expand Down
20 changes: 10 additions & 10 deletions include/xrpl/protocol_autogen/transactions/EscrowFinish.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,29 @@ class EscrowFinish : public TransactionBase
}

/**
* @brief Get sfComputationAllowance (SoeOptional)
* @brief Get sfGas (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_UINT32::type::value_type>
getComputationAllowance() const
getGas() const
{
if (hasComputationAllowance())
if (hasGas())
{
return this->tx_->at(sfComputationAllowance);
return this->tx_->at(sfGas);
}
return std::nullopt;
}

/**
* @brief Check if sfComputationAllowance is present.
* @brief Check if sfGas is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasComputationAllowance() const
hasGas() const
{
return this->tx_->isFieldPresent(sfComputationAllowance);
return this->tx_->isFieldPresent(sfGas);
}
};

Expand Down Expand Up @@ -274,13 +274,13 @@ class EscrowFinishBuilder : public TransactionBuilderBase<EscrowFinishBuilder>
}

/**
* @brief Set sfComputationAllowance (SoeOptional)
* @brief Set sfGas (SoeOptional)
* @return Reference to this builder for method chaining.
*/
EscrowFinishBuilder&
setComputationAllowance(std::decay_t<typename SF_UINT32::type::value_type> const& value)
setGas(std::decay_t<typename SF_UINT32::type::value_type> const& value)
{
object_[sfComputationAllowance] = value;
object_[sfGas] = value;
return *this;
}

Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/tx/ApplyContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class ApplyContext

/** Sets the gas used in the metadata */
void
setWasmReturnCode(std::int32_t const wasmReturnCode)
setVMReturnCode(std::int32_t const vmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
vmReturnCode_ = vmReturnCode;
}

/** Discard changes and start fresh. */
Expand Down Expand Up @@ -141,7 +141,7 @@ class ApplyContext
// The ID of the batch transaction we are executing under, if seated.
std::optional<uint256 const> parentBatchId_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
std::optional<std::int32_t> vmReturnCode_;
};

} // namespace xrpl
4 changes: 2 additions & 2 deletions src/libxrpl/ledger/ApplyStateTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ApplyStateTable::apply(
std::optional<STAmount> const& deliver,
std::optional<uint256 const> const& parentBatchId,
std::optional<std::uint32_t> const& gasUsed,
std::optional<std::int32_t> const& wasmReturnCode,
std::optional<std::int32_t> const& vmReturnCode,
bool isDryRun,
beast::Journal j)
{
Expand All @@ -132,7 +132,7 @@ ApplyStateTable::apply(
meta.setDeliveredAmount(deliver);
meta.setParentBatchID(parentBatchId);
meta.setGasUsed(gasUsed);
meta.setWasmReturnCode(wasmReturnCode);
meta.setVMReturnCode(vmReturnCode);

Mods newMod;
for (auto& item : items_)
Expand Down
3 changes: 1 addition & 2 deletions src/libxrpl/ledger/ApplyViewImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ ApplyViewImpl::apply(
bool isDryRun,
beast::Journal j)
{
return items_.apply(
to, tx, ter, deliver_, parentBatchId, gasUsed_, wasmReturnCode_, isDryRun, j);
return items_.apply(to, tx, ter, deliver_, parentBatchId, gasUsed_, vmReturnCode_, isDryRun, j);
}

std::size_t
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/protocol/TxMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ TxMeta::getAsObject() const
if (gasUsed_.has_value())
metaData.setFieldU32(sfGasUsed, *gasUsed_);

if (wasmReturnCode_.has_value())
metaData.setFieldI32(sfWasmReturnCode, *wasmReturnCode_);
if (vmReturnCode_.has_value())
metaData.setFieldI32(sfVMReturnCode, *vmReturnCode_);

return metaData;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/tx/ApplyContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ ApplyContext::discard()
std::optional<TxMeta>
ApplyContext::apply(TER ter)
{
if (wasmReturnCode_.has_value())
if (vmReturnCode_.has_value())
{
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
view_->setWasmReturnCode(*wasmReturnCode_);
view_->setVMReturnCode(*vmReturnCode_);
}
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
view_->setGasUsed(gasUsed_);
Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ EscrowCancel::doApply()
}
}

auto const reserveToSubtract = calculateAdditionalReserve((*slep)[~sfFinishFunction]);
auto const reserveToSubtract = calculateAdditionalReserve((*slep)[~sfBytecode]);
adjustOwnerCount(ctx_.view(), sle, -1 * reserveToSubtract, ctx_.journal);
ctx_.view().update(sle);

Expand Down
Loading
Loading