Fix review comments

This commit is contained in:
Sergey Kuznetsov
2026-08-21 18:28:42 +01:00
parent 27859c1f6f
commit b57ead1a8a
3 changed files with 32 additions and 22 deletions

View File

@@ -14,6 +14,7 @@
#include <cstdint>
#include <expected>
#include <optional>
#include <stdexcept>
#include <string_view>
namespace xrpl {
@@ -23,8 +24,8 @@ namespace {
using RunStatus = rs::wasm_vm::RunStatus;
using CheckStatus = rs::wasm_vm::CheckStatus;
// The engine's outcome as the caller's: a value with its cost, or a TER with the cost to
// record beside it.
// The engine's outcome as the caller's: a value with its gas cost, or a TER with the gas cost
// to record beside it.
//
// A `tecINTERNAL` reports no cost. It says the fault is the node's, and charging a
// transaction for a node's defect would write that defect into the ledger.
@@ -123,6 +124,9 @@ runEscrowWasm(
std::int64_t gasLimit,
std::string_view funcName) noexcept
{
XRPL_ASSERT(
gasLimit > 0,
"::xrpl::runEscrowWasm : gas limit is positive (should be checked in preflight)");
// A run needs a budget to spend. Refused here rather than in the engine because what a
// non-positive limit means is a transaction-validity rule; the engine's own budget is
// therefore an unsigned quantity with no invalid value to represent.
@@ -135,10 +139,11 @@ runEscrowWasm(
// The host caches the current ledger object, the slot table and the
// contract's data for the length of one run, so a reused one would answer a
// later contract out of an earlier contract's state.
XRPL_ASSERT(
hfs.checkSelf(), "::xrpl::runEscrowWasm : host functions not clean before the run");
if (!hfs.checkSelf())
{
JLOG(hfs.getJournal().error()) << "wasm: host functions not clean before the run";
return nodeSideFault;
throw std::runtime_error("host functions not clean before the run");
}
HostContext const ctx{hfs};