Connect votable gas limit into VM (#5360)

* [WIP] add gas limit

* [WIP] host function escrow tests

* finish test

* uncomment out tests
This commit is contained in:
Mayukha Vadari
2025-03-25 10:55:33 -04:00
committed by GitHub
parent 1573a443b7
commit 177cdaf550
6 changed files with 1224 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -372,6 +372,32 @@ public:
} }
}; };
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_;
}
};
/* Payment Channel */ /* Payment Channel */
/******************************************************************************/ /******************************************************************************/

View File

@@ -17,8 +17,8 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED #ifndef RIPPLE_APP_MISC_AMMUTILS_H_INCLUDED
#define RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED #define RIPPLE_APP_MISC_AMMUTILS_H_INCLUDED
#include <xrpld/ledger/View.h> #include <xrpld/ledger/View.h>
@@ -127,4 +127,4 @@ isOnlyLiquidityProvider(
} // namespace ripple } // namespace ripple
#endif // RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED #endif // RIPPLE_APP_MISC_AMMUTILS_H_INCLUDED

View File

@@ -17,9 +17,9 @@
*/ */
//============================================================================== //==============================================================================
#include "xrpld/app/misc/WasmHostFuncImpl.h" #include <xrpld/app/misc/WasmHostFuncImpl.h>
#include "xrpl/protocol/digest.h" #include <xrpl/protocol/digest.h>
namespace ripple { namespace ripple {

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/* /*
This file is part of rippled: https://github.com/ripple/rippled This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2023 Ripple Labs Inc. Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above

View File

@@ -588,7 +588,8 @@ EscrowFinish::doApply()
WasmHostFunctionsImpl ledgerDataProvider(ctx_, k); WasmHostFunctionsImpl ledgerDataProvider(ctx_, k);
auto re = runEscrowWasm(wasm, funcName, &ledgerDataProvider, 100000); std::uint32_t gasLimit = ctx_.app.config().FEES.extension_compute_limit;
auto re = runEscrowWasm(wasm, funcName, &ledgerDataProvider, gasLimit);
JLOG(j_.trace()) << "Escrow WASM ran"; JLOG(j_.trace()) << "Escrow WASM ran";
if (re.has_value()) if (re.has_value())
{ {