mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 09:46:53 +00:00
clean up some hf code (#6354)
* clean up some hf code * fix comments * fix ubsan * Revert "fix ubsan"
This commit is contained in:
@@ -326,9 +326,9 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
{ // fail because trying to access nonexistent field
|
||||
struct BadTestHostFunctions : public TestHostFunctions
|
||||
struct FieldNotFoundHostFunctions : public TestHostFunctions
|
||||
{
|
||||
explicit BadTestHostFunctions(Env& env) : TestHostFunctions(env)
|
||||
explicit FieldNotFoundHostFunctions(Env& env) : TestHostFunctions(env)
|
||||
{
|
||||
}
|
||||
Expected<Bytes, HostFunctionError>
|
||||
@@ -338,15 +338,15 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<HostFunctions> hfs(new BadTestHostFunctions(env));
|
||||
std::shared_ptr<HostFunctions> hfs(new FieldNotFoundHostFunctions(env));
|
||||
auto re = runEscrowWasm(allHFWasm, hfs, ESCROW_FUNCTION_NAME, {}, 100'000);
|
||||
checkResult(re, -201, 28'965);
|
||||
}
|
||||
|
||||
{ // fail because trying to allocate more than MAX_PAGES memory
|
||||
struct BadTestHostFunctions : public TestHostFunctions
|
||||
struct OversizedFieldHostFunctions : public TestHostFunctions
|
||||
{
|
||||
explicit BadTestHostFunctions(Env& env) : TestHostFunctions(env)
|
||||
explicit OversizedFieldHostFunctions(Env& env) : TestHostFunctions(env)
|
||||
{
|
||||
}
|
||||
Expected<Bytes, HostFunctionError>
|
||||
@@ -356,7 +356,7 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<HostFunctions> hfs(new BadTestHostFunctions(env));
|
||||
std::shared_ptr<HostFunctions> hfs(new OversizedFieldHostFunctions(env));
|
||||
auto re = runEscrowWasm(allHFWasm, hfs, ESCROW_FUNCTION_NAME, {}, 100'000);
|
||||
checkResult(re, -201, 28'965);
|
||||
}
|
||||
@@ -574,7 +574,7 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
auto const codecovWasm = hexToBytes(codecovTestsWasmHex);
|
||||
std::shared_ptr<HostFunctions> hfs(new TestHostFunctions(env, 0));
|
||||
|
||||
auto const allowance = 201'503;
|
||||
auto const allowance = 202'724;
|
||||
auto re = runEscrowWasm(codecovWasm, hfs, ESCROW_FUNCTION_NAME, {}, allowance);
|
||||
|
||||
checkResult(re, 1, allowance);
|
||||
|
||||
Reference in New Issue
Block a user