mirror of
https://github.com/Xahau/xahaud.git
synced 2026-04-29 15:37:46 +00:00
increase size of hook state to 256 bytes, parameters too, change the reserve requirement to 1:1 for hook state, allow weak execution on rollback if hook_again was specified, add further state_set tests
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <stdexcept>
|
||||
#include <test/jtx/hook.h>
|
||||
#include <ripple/app/hook/Enum.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
@@ -65,9 +66,23 @@ std::string uint64_hex(uint64_t x)
|
||||
nibble(x >> 4U) + nibble(x >> 0U);
|
||||
}
|
||||
|
||||
Json::Value
|
||||
hso_delete(void (*f)(Json::Value& jv))
|
||||
{
|
||||
Json::Value jv;
|
||||
jv[jss::CreateCode] = "";
|
||||
jv[jss::Flags] = hsfOVERRIDE;
|
||||
|
||||
if (f)
|
||||
f(jv);
|
||||
|
||||
return jv;
|
||||
}
|
||||
|
||||
Json::Value
|
||||
hso(std::vector<uint8_t> const& wasmBytes, void (*f)(Json::Value& jv))
|
||||
{
|
||||
|
||||
if (wasmBytes.size() == 0)
|
||||
throw std::runtime_error("empty hook wasm passed to hso()");
|
||||
|
||||
@@ -78,12 +93,12 @@ hso(std::vector<uint8_t> const& wasmBytes, void (*f)(Json::Value& jv))
|
||||
jv[jss::HookNamespace] = to_string(uint256{beast::zero});
|
||||
jv[jss::HookApiVersion] = Json::Value{0};
|
||||
}
|
||||
|
||||
|
||||
if (f)
|
||||
if (f)
|
||||
f(jv);
|
||||
|
||||
return jv;
|
||||
|
||||
}
|
||||
|
||||
} // namespace jtx
|
||||
|
||||
Reference in New Issue
Block a user