MPT and IOU support for amount and issue (#5573)

* MPT and IOU support for ammount and issue

* Fix tests
Update wasm code to the latest version
Remove deprecated tests
Remove deprecated wasm
This commit is contained in:
Olek
2025-07-22 13:43:21 -04:00
committed by GitHub
parent 24b7a03224
commit 9eca1a3a0c
9 changed files with 433 additions and 463 deletions

View File

@@ -1707,10 +1707,7 @@ struct Escrow_test : public beast::unit_test::suite
Account const carol{"carol"};
// Tests whether the ledger index is >= 5
// #[no_mangle]
// pub fn finish() -> bool {
// unsafe { host_lib::getLedgerSqn() >= 5}
// }
// getLedgerSqn() >= 5}
static auto wasmHex = ledgerSqnHex;
{
@@ -1880,10 +1877,7 @@ struct Escrow_test : public beast::unit_test::suite
Account const carol{"carol"};
// Tests whether the ledger index is >= 5
// #[no_mangle]
// pub fn finish() -> bool {
// unsafe { host_lib::getLedgerSqn() >= 5}
// }
// getLedgerSqn() >= 5}
static auto wasmHex = ledgerSqnHex;
{
@@ -2028,12 +2022,9 @@ struct Escrow_test : public beast::unit_test::suite
Account const carol{"carol"};
// Tests whether the ledger index is >= 5
// #[no_mangle]
// pub fn finish() -> bool {
// unsafe { host_lib::getLedgerSqn() >= 5}
// }
// getLedgerSqn() >= 5}
auto const& wasmHex = ledgerSqnHex;
std::uint32_t const allowance = 64;
std::uint32_t const allowance = 71;
{
// basic FinishFunction situation
@@ -2288,7 +2279,7 @@ struct Escrow_test : public beast::unit_test::suite
env.require(balance(alice, XRP(4000) - txnFees));
env.require(balance(carol, XRP(5000)));
auto const allowance = 20'000;
auto const allowance = 1'000'000;
// FinishAfter time hasn't passed
env(escrow::finish(carol, alice, seq),
@@ -2296,31 +2287,12 @@ struct Escrow_test : public beast::unit_test::suite
fee(txnFees),
ter(tecNO_PERMISSION));
env.close();
// tx sender not escrow creator (alice)
env(escrow::finish(carol, alice, seq),
escrow::comp_allowance(allowance),
fee(txnFees),
ter(tecWASM_REJECTED));
env.close();
// destination balance is too high
env(escrow::finish(carol, alice, seq),
escrow::comp_allowance(allowance),
fee(txnFees),
ter(tecWASM_REJECTED));
env.close();
// reduce the destination balance
env(pay(carol, alice, XRP(4500)));
env.close();
// tx sender not escrow creator (alice)
env(escrow::finish(carol, alice, seq),
escrow::comp_allowance(allowance),
fee(txnFees),
ter(tecWASM_REJECTED));
env.close();
env(escrow::finish(alice, alice, seq),
@@ -2329,8 +2301,8 @@ struct Escrow_test : public beast::unit_test::suite
ter(tesSUCCESS));
auto const txMeta = env.meta();
if (BEAST_EXPECT(txMeta->isFieldPresent(sfGasUsed)))
BEAST_EXPECT(txMeta->getFieldU32(sfGasUsed) == 10817);
if (BEAST_EXPECT(txMeta && txMeta->isFieldPresent(sfGasUsed)))
BEAST_EXPECT(txMeta->getFieldU32(sfGasUsed) == 39'596);
env.close();
BEAST_EXPECT((*env.le(alice))[sfOwnerCount] == 0);

View File

@@ -25,11 +25,38 @@
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpld/ledger/detail/ApplyViewBase.h>
#include <wasm_c_api.h>
namespace ripple {
namespace test {
struct TestLedgerDataProvider : public HostFunctions
{
jtx::Env* env_;
void const* rt_ = nullptr;
public:
TestLedgerDataProvider(jtx::Env* env) : env_(env)
{
}
virtual void
setRT(void const* rt) override
{
rt_ = rt;
}
virtual void const*
getRT() const override
{
return rt_;
}
Expected<std::uint32_t, HostFunctionError>
getLedgerSqn() override
{
return static_cast<std::uint32_t>(env_->current()->seq());
}
};
struct TestHostFunctions : public HostFunctions
{
test::jtx::Env& env_;
@@ -286,16 +313,19 @@ public:
#else
auto j = getJournal().trace();
#endif
j << "WASM TRACE: " << msg;
if (!asHex)
j << std::string_view(
reinterpret_cast<char const*>(data.data()), data.size());
{
j << "WAMR TRACE: " << msg << " "
<< std::string_view(
reinterpret_cast<char const*>(data.data()), data.size());
}
else
{
std::string hex;
hex.reserve(data.size() * 2);
boost::algorithm::hex(data.begin(), data.end(), hex.begin());
j << hex;
boost::algorithm::hex(
data.begin(), data.end(), std::back_inserter(hex));
j << "WAMR DEV TRACE: " << msg << " " << hex;
}
#ifdef DEBUG_OUTPUT
@@ -313,7 +343,7 @@ public:
#else
auto j = getJournal().trace();
#endif
j << "WASM TRACE NUM: " << msg << data;
j << "WAMR TRACE NUM: " << msg << " " << data;
#ifdef DEBUG_OUTPUT
j << std::endl;

View File

@@ -17,21 +17,15 @@
*/
//==============================================================================
#include <test/app/TestHostFunctions.h>
#include <test/app/wasm_fixtures/fixtures.h>
#include <test/jtx.h>
#include <xrpld/app/misc/WasmHostFunc.h>
#include <xrpld/app/misc/WasmVM.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpld/ledger/detail/ApplyViewBase.h>
#include <wasm_c_api.h>
#ifdef _DEBUG
// #define DEBUG_OUTPUT 1
#endif
#include <test/app/TestHostFunctions.h>
#include <xrpld/app/misc/WamrVM.h>
#include <xrpld/app/misc/WasmHostFuncWrapper.h>
namespace ripple {
namespace test {
@@ -49,34 +43,6 @@ Add(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results)
return nullptr;
}
struct TestLedgerDataProvider
{
jtx::Env* env;
public:
TestLedgerDataProvider(jtx::Env* env_) : env(env_)
{
}
Expected<int32_t, HostFunctionError>
get_ledger_sqn()
{
return (int32_t)env->current()->seq();
}
};
using getLedgerSqn_proto = std::int32_t();
static wasm_trap_t*
getLedgerSqn_wrap(void* env, wasm_val_vec_t const*, wasm_val_vec_t* results)
{
auto sqn = reinterpret_cast<TestLedgerDataProvider*>(env)->get_ledger_sqn();
results->data[0] = WASM_I32_VAL(sqn.value());
results->num_elems = 1;
return nullptr;
}
struct Wasm_test : public beast::unit_test::suite
{
void
@@ -174,20 +140,19 @@ struct Wasm_test : public beast::unit_test::suite
using namespace test::jtx;
Env env{*this};
TestLedgerDataProvider ledgerDataProvider(&env);
TestLedgerDataProvider hf(&env);
std::string const funcName("finish");
std::vector<WasmImportFunc> imports;
WASM_IMPORT_FUNC(imports, getLedgerSqn, &ledgerDataProvider, 33);
WASM_IMPORT_FUNC2(imports, getLedgerSqn, "get_ledger_sqn", &hf, 33);
auto& engine = WasmEngine::instance();
auto re = engine.run(
wasm, funcName, {}, imports, nullptr, 1'000'000, env.journal);
wasm, funcName, {}, imports, &hf, 1'000'000, env.journal);
// code takes 4 gas + 1 getLedgerSqn call
// code takes 11 gas + 1 getLedgerSqn call
if (BEAST_EXPECT(re.has_value()))
BEAST_EXPECT(!re->result && (re->cost == 37));
BEAST_EXPECT(!re->result && (re->cost == 44));
env.close();
env.close();
@@ -195,12 +160,11 @@ struct Wasm_test : public beast::unit_test::suite
env.close();
// empty module - run the same instance
re = engine.run(
{}, funcName, {}, imports, nullptr, 1'000'000, env.journal);
re = engine.run({}, funcName, {}, imports, &hf, 1'000'000, env.journal);
// code takes 8 gas + 2 getLedgerSqn calls
// code takes 22 gas + 2 getLedgerSqn calls
if (BEAST_EXPECT(re.has_value()))
BEAST_EXPECT(re->result && (re->cost == 74));
BEAST_EXPECT(re->result && (re->cost == 88));
}
void
@@ -372,26 +336,14 @@ struct Wasm_test : public beast::unit_test::suite
}
void
testEscrowWasmDN1()
testEscrowWasmDN()
{
testcase("escrow wasm devnet 1 test");
std::string const wasmHex = allHostFunctionsHex;
testcase("escrow wasm devnet test");
std::string const wasmStr = boost::algorithm::unhex(wasmHex);
std::string const wasmStr =
boost::algorithm::unhex(allHostFunctionsHex);
std::vector<uint8_t> wasm(wasmStr.begin(), wasmStr.end());
// let sender = get_tx_account_id();
// let owner = get_current_escrow_account_id();
// let dest = get_current_escrow_destination();
// let dest_balance = get_account_balance(dest);
// let escrow_data = get_current_escrow_data();
// let ed_str = String::from_utf8(escrow_data).unwrap();
// let threshold_balance = ed_str.parse::<u64>().unwrap();
// let pl_time = host_lib::getParentLedgerTime();
// let e_time = get_current_escrow_finish_after();
// sender == owner && dest_balance <= threshold_balance &&
// pl_time >= e_time
using namespace test::jtx;
Env env{*this};
{
@@ -400,29 +352,7 @@ struct Wasm_test : public beast::unit_test::suite
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100'000);
if (BEAST_EXPECT(re.has_value()))
{
BEAST_EXPECT(!re->result && (re->cost == 10817));
// std::cout << "good case result " << re.value().result
// << " cost: " << re.value().cost << std::endl;
}
}
env.close();
env.close();
env.close();
env.close();
{ // fail because current time < escrow_finish_after time
TestHostFunctions nfs(env, -1);
std::string funcName("finish");
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100000);
if (BEAST_EXPECT(re.has_value()))
{
BEAST_EXPECT(!re->result && (re->cost == 10817));
// std::cout << "bad case (current time < escrow_finish_after "
// "time) result "
// << re.value().result << " cost: " <<
// re.value().cost
// << std::endl;
BEAST_EXPECT(re->result && (re->cost == 41'132));
}
}
@@ -441,7 +371,7 @@ struct Wasm_test : public beast::unit_test::suite
BadTestHostFunctions nfs(env);
std::string funcName("finish");
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100000);
BEAST_EXPECT(re.has_value() && !re->result && (re->cost == 93));
BEAST_EXPECT(re.has_value() && !re->result && (re->cost == 5831));
// std::cout << "bad case (access nonexistent field) result "
// << re.error() << std::endl;
}
@@ -460,15 +390,15 @@ struct Wasm_test : public beast::unit_test::suite
};
BadTestHostFunctions nfs(env);
std::string funcName("finish");
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100000);
BEAST_EXPECT(re.has_value() && !re->result && (re->cost == 93));
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100'000);
BEAST_EXPECT(re.has_value() && !re->result && (re->cost == 5831));
// std::cout << "bad case (more than MAX_PAGES) result "
// << re.error() << std::endl;
}
{ // fail because recursion too deep
auto wasmHex = deepRecursionHex;
auto wasmStr = boost::algorithm::unhex(std::string(wasmHex));
auto const wasmStr = boost::algorithm::unhex(deepRecursionHex);
std::vector<uint8_t> wasm(wasmStr.begin(), wasmStr.end());
TestHostFunctionsSink nfs(env);
@@ -518,55 +448,6 @@ struct Wasm_test : public beast::unit_test::suite
}
}
void
testEscrowWasmDN3()
{
testcase("wasm devnet 3 test");
std::string const funcName("finish");
using namespace test::jtx;
Env env(*this);
{
std::string const wasmHex = xrplStdExampleHex;
std::string const wasmStr = boost::algorithm::unhex(wasmHex);
std::vector<uint8_t> const wasm(wasmStr.begin(), wasmStr.end());
TestHostFunctions nfs(env, 0);
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100'000);
if (BEAST_EXPECT(re.has_value()))
{
BEAST_EXPECT(re->result && (re->cost == 6570));
// std::cout << "good case result " << re.value().result
// << " cost: " << re.value().cost << std::endl;
}
}
env.close();
env.close();
env.close();
env.close();
env.close();
{
std::string const wasmHex = hostFunctions2Hex;
std::string const wasmStr = boost::algorithm::unhex(wasmHex);
std::vector<uint8_t> const wasm(wasmStr.begin(), wasmStr.end());
TestHostFunctions nfs(env, 0);
auto re = runEscrowWasm(wasm, funcName, {}, &nfs, 100'000);
if (BEAST_EXPECT(re.has_value()))
{
BEAST_EXPECT(re->result && (re->cost == 16558));
// std::cout << "good case result " << re.value().result
// << " cost: " << re.value().cost << std::endl;
}
}
}
void
testHFCost()
{
@@ -578,7 +459,7 @@ struct Wasm_test : public beast::unit_test::suite
Env env(*this);
{
std::string const wasmHex = hostFunctions2Hex;
std::string const wasmHex = allHostFunctionsHex;
std::string const wasmStr = boost::algorithm::unhex(wasmHex);
std::vector<uint8_t> const wasm(wasmStr.begin(), wasmStr.end());
@@ -590,13 +471,11 @@ struct Wasm_test : public beast::unit_test::suite
i.gas = 0;
auto re = engine.run(
wasm, funcName, {}, imp, &hfs, 1000'000, env.journal);
wasm, funcName, {}, imp, &hfs, 1'000'000, env.journal);
if (BEAST_EXPECT(re.has_value()))
{
// std::cout << ", ret: " << re->result
// << ", gas spent: " << re->cost << std::endl;
BEAST_EXPECT(re->result && (re->cost == 138));
BEAST_EXPECT(re->result && (re->cost == 872));
}
env.close();
@@ -609,7 +488,7 @@ struct Wasm_test : public beast::unit_test::suite
env.close();
{
std::string const wasmHex = hostFunctions2Hex;
std::string const wasmHex = allHostFunctionsHex;
std::string const wasmStr = boost::algorithm::unhex(wasmHex);
std::vector<uint8_t> const wasm(wasmStr.begin(), wasmStr.end());
@@ -619,13 +498,11 @@ struct Wasm_test : public beast::unit_test::suite
std::vector<WasmImportFunc> const imp = createWasmImport(&hfs);
auto re = engine.run(
wasm, funcName, {}, imp, &hfs, 1000'000, env.journal);
wasm, funcName, {}, imp, &hfs, 1'000'000, env.journal);
if (BEAST_EXPECT(re.has_value()))
{
// std::cout << ", ret: " << re->result
// << ", gas spent: " << re->cost << std::endl;
BEAST_EXPECT(re->result && (re->cost == 16558));
BEAST_EXPECT(re->result && (re->cost == 41'132));
}
env.close();
@@ -751,9 +628,7 @@ struct Wasm_test : public beast::unit_test::suite
testHFCost();
// TODO: fix result
testEscrowWasmDN1();
testEscrowWasmDN3();
testEscrowWasmDN();
// perfTest();
}

View File

@@ -10757,126 +10757,302 @@ extern std::string const sp1_wasm =
"2b087369676e2d6578742b0f7265666572656e63652d74797065732b0a6d"
"756c746976616c7565";
extern std::string const xrplStdExampleHex =
"0061736d0100000001240560037f7f7f017f60057f7f7f7f7f017f60047f7f7f7f017f6003"
"7f7f7e017f6000017f0295010608686f73745f6c69620c6765745f74785f6669656c640000"
"08686f73745f6c6962057472616365000108686f73745f6c69620e6163636f756e745f6b65"
"796c6574000208686f73745f6c69621063616368655f6c65646765725f6f626a000008686f"
"73745f6c6962146765745f6c65646765725f6f626a5f6669656c64000208686f73745f6c69"
"620974726163655f6e756d00030302010405030100110619037f01418080c0000b7f004190"
"80c0000b7f00419080c0000b072e04066d656d6f727902000666696e69736800060a5f5f64"
"6174615f656e6403010b5f5f686561705f6261736503020aa203019f0302047f017e238080"
"80800041e0006b2200248080808000200041c0006a41106a22014100360200200041c0006a"
"41086a220242003703002000420037034002400240024041818020200041c0006a41141080"
"808080004101480d00200041086a41106a2001280200360200200041086a41086a20022903"
"0037030020002000290340370308418080c08000410a200041086a41144101108180808000"
"1a200041c0006a41186a220342003703002001420037030020024200370300200042003703"
"400240200041086a4114200041c0006a41201082808080004101480d00200041206a41186a"
"2003290300370300200041206a41106a200041c0006a41106a290300370300200041206a41"
"086a200041c0006a41086a29030037030020002000290340370320200041206a4120410010"
"8380808000220241014e0d020b417b21010c020b417f21010c010b20004200370340417b21"
"01200241828018200041c0006a41081084808080004108470d00418a80c080004106200029"
"034022041085808080001a417741012004501b21010b200041e0006a24808080800020010b"
"0b190100418080c0000b1020204163636f756e743a20204665653a008903046e616d650016"
"157872706c5f7374645f6578616d706c652e7761736d01c9020700335f5a4e387872706c5f"
"73746434686f737431326765745f74785f6669656c64313768646531643438363634626333"
"6138346145012b5f5a4e387872706c5f73746434686f737435747261636531376831626534"
"3662336564373737306363624502355f5a4e387872706c5f73746434686f73743134616363"
"6f756e745f6b65796c6574313768333736666637613833306562626537624503375f5a4e38"
"7872706c5f73746434686f7374313663616368655f6c65646765725f6f626a313768646361"
"6435366531366262633331653345043b5f5a4e387872706c5f73746434686f737432306765"
"745f6c65646765725f6f626a5f6669656c6431376863623833653465366431326162306332"
"45052f5f5a4e387872706c5f73746434686f73743974726163655f6e756d31376832363139"
"36306163653839633831313845060666696e697368071201000f5f5f737461636b5f706f69"
"6e746572090a0100072e726f64617461004d0970726f64756365727302086c616e67756167"
"65010452757374000c70726f6365737365642d6279010572757374631d312e38372e302028"
"31373036376539616320323032352d30352d3039290094010f7461726765745f6665617475"
"726573082b0b62756c6b2d6d656d6f72792b0f62756c6b2d6d656d6f72792d6f70742b1663"
"616c6c2d696e6469726563742d6f7665726c6f6e672b0a6d756c746976616c75652b0f6d75"
"7461626c652d676c6f62616c732b136e6f6e7472617070696e672d6670746f696e742b0f72"
"65666572656e63652d74797065732b087369676e2d657874";
std::string const ledgerSqnHex =
"0061736d010000000105016000017f02190108686f73745f6c69620c6765"
"744c656467657253716e00000302010005030100100611027f00418080c0"
"000b7f00418080c0000b072e04066d656d6f727902000666696e69736800"
"010a5f5f646174615f656e6403000b5f5f686561705f6261736503010a09"
"010700100041044a0b004d0970726f64756365727302086c616e67756167"
"65010452757374000c70726f6365737365642d6279010572757374631d31"
"2e38352e31202834656231363132353020323032352d30332d3135290049"
"0f7461726765745f6665617475726573042b0f6d757461626c652d676c6f"
"62616c732b087369676e2d6578742b0f7265666572656e63652d74797065"
"732b0a6d756c746976616c7565";
"0061736d01000000010e0360027f7f017f6000006000017f02160103656e"
"760e6765745f6c65646765725f73716e000003030201020503010002063e"
"0a7f004180080b7f004180080b7f004180100b7f004180100b7f00418090"
"040b7f004180080b7f00418090040b7f00418080080b7f0041000b7f0041"
"010b07b0010d066d656d6f72790200115f5f7761736d5f63616c6c5f6374"
"6f727300010666696e69736800020362756603000c5f5f64736f5f68616e"
"646c6503010a5f5f646174615f656e6403020b5f5f737461636b5f6c6f77"
"03030c5f5f737461636b5f6869676803040d5f5f676c6f62616c5f626173"
"6503050b5f5f686561705f6261736503060a5f5f686561705f656e640307"
"0d5f5f6d656d6f72795f6261736503080c5f5f7461626c655f6261736503"
"090a2b0202000b2601017f41800841041000220041800828020020004100"
"481b2200200041044a20004100481b0b007f0970726f647563657273010c"
"70726f6365737365642d62790105636c616e675f31392e312e352d776173"
"692d73646b202868747470733a2f2f6769746875622e636f6d2f6c6c766d"
"2f6c6c766d2d70726f6a6563742061623462356132646235383239353861"
"6631656533303861373930636664623432626432343732302900490f7461"
"726765745f6665617475726573042b0f6d757461626c652d676c6f62616c"
"732b087369676e2d6578742b0f7265666572656e63652d74797065732b0a"
"6d756c746976616c7565";
std::string const allHostFunctionsHex =
"0061736d01000000012e0760037f7f7f017f60057f7f7f7f7f017f60047f7f7f7f017f6003"
"7f7f7e017f60027f7f017f6000017f60017f0002df010808686f73745f6c69620c6765745f"
"74785f6669656c64000008686f73745f6c6962057472616365000108686f73745f6c69621c"
"6765745f63757272656e745f6c65646765725f6f626a5f6669656c64000008686f73745f6c"
"69620e6163636f756e745f6b65796c6574000208686f73745f6c69621063616368655f6c65"
"646765725f6f626a000008686f73745f6c6962146765745f6c65646765725f6f626a5f6669"
"656c64000208686f73745f6c69620974726163655f6e756d000308686f73745f6c69621667"
"65745f706172656e745f6c65646765725f74696d6500040304030506000405017001010105"
"030100110619037f01418080c0000b7f00418481c0000b7f00419081c0000b072e04066d65"
"6d6f727902000666696e69736800080a5f5f646174615f656e6403010b5f5f686561705f62"
"61736503020af80803db0702047f027e23808080800041f0206b2200248080808000200041"
"d0006a41106a22014100360200200041d0006a41086a220242003703002000420037035002"
"4002400240024041818020200041d0006a41141080808080004101480d00200041086a4110"
"6a2001280200360200200041086a41086a2002290300370300200020002903503703084180"
"80c080004109200041086a411441011081808080001a200141003602002002420037030020"
"00420037035041818020200041d0006a411410828080800041004c0d01200041206a41106a"
"200041d0006a41106a2201280200360200200041206a41086a200041d0006a41086a220229"
"030037030020002000290350370320418980c080004108200041206a411441011081808080"
"001a2001410036020020024200370300200042003703500240024041838020200041d0006a"
"411410828080800041004c0d00200041386a41106a2001280200360200200041386a41086a"
"200229030037030020002000290350370338419180c080004107200041386a411441011081"
"808080001a200041d0006a41186a2203420037030020014200370300200242003703002000"
"42003703500240200041386a4114200041d0006a41201083808080004101480d00200041d0"
"206a41186a2003290300370300200041d0206a41106a200041d0006a41106a290300370300"
"200041d0206a41086a200041d0006a41086a290300370300200020002903503703d0202000"
"41d0206a41204100108480808000220241014e0d020b417c21010c050b417d21010c040b20"
"004200370350417c2101200241828018200041d0006a41081085808080004108470d034198"
"80c08000410f200029035022041086808080001a0240418020450d00200041d0006a410041"
"8020fc0b000b0240419b801c200041d0006a418020108280808000220241014e0d00417b21"
"010c040b41a780c08000410a2002ad1086808080001a0240200241084d0d00417a21010c04"
"0b41b180c080004107200041d0006a200241011081808080001a4100210142002105034020"
"05420886200041d0006a20016a3100008421052002200141016a2201470d000b41b880c080"
"00412120051086808080001a200041003602d0200240200041d0206a410410878080800041"
"004e0d00417921010c040b41d980c08000411520003402d0201086808080001a2000108980"
"80800020002802004101710d02417821010c030b417f21010c020b417e21010c010b41ee80"
"c08000411620002802042201ac1086808080001a200041086a200041206a4114108a808080"
"004520042005587120002802d02020014e7121010b200041f0206a24808080800020010b4e"
"01027f23808080800041106b22012480808080002001410036020c41a580082001410c6a41"
"0410828080800021022000200128020c3602042000200241004a360200200141106a248080"
"8080000b4a01037f4100210302402002450d000240034020002d0000220420012d00002205"
"470d01200041016a2100200141016a21012002417f6a2202450d020c000b0b200420056b21"
"030b20030b0b8e010100418080c0000b8401202073656e6465723a20206f776e65723a2020"
"646573743a2020646573745f62616c616e63653a2020646174615f6c656e2020646174613a"
"20207468726573686f6c645f62616c616e63652c2075736520646174615b695d3a20207061"
"72656e745f6c65646765725f74696d653a2020657363726f775f66696e6973685f61667465"
"723a00d804046e616d650016157872706c5f7374645f6578616d706c652e7761736d019804"
"0b00335f5a4e387872706c5f73746434686f737431326765745f74785f6669656c64313768"
"6465316434383636346263336138346145012b5f5a4e387872706c5f73746434686f737435"
"7472616365313768316265343662336564373737306363624502435f5a4e387872706c5f73"
"746434686f737432386765745f63757272656e745f6c65646765725f6f626a5f6669656c64"
"313768343532633531353638653033353531384503355f5a4e387872706c5f73746434686f"
"737431346163636f756e745f6b65796c657431376833373666663761383330656262653762"
"4504375f5a4e387872706c5f73746434686f7374313663616368655f6c65646765725f6f62"
"6a3137686463616435366531366262633331653345053b5f5a4e387872706c5f7374643468"
"6f737432306765745f6c65646765725f6f626a5f6669656c64313768636238336534653664"
"3132616230633245062f5f5a4e387872706c5f73746434686f73743974726163655f6e756d"
"3137683236313936306163653839633831313845073d5f5a4e387872706c5f73746434686f"
"737432326765745f706172656e745f6c65646765725f74696d653137686234636264356664"
"336463326230383445080666696e69736809415f5a4e387872706c5f73746433316765745f"
"63757272656e745f657363726f775f66696e6973685f616674657231376863333562336366"
"356633353733363933450a066d656d636d70071201000f5f5f737461636b5f706f696e7465"
"72090a0100072e726f64617461004d0970726f64756365727302086c616e67756167650104"
"52757374000c70726f6365737365642d6279010572757374631d312e38372e302028313730"
"36376539616320323032352d30352d3039290094010f7461726765745f6665617475726573"
"082b0b62756c6b2d6d656d6f72792b0f62756c6b2d6d656d6f72792d6f70742b1663616c6c"
"2d696e6469726563742d6f7665726c6f6e672b0a6d756c746976616c75652b0f6d75746162"
"6c652d676c6f62616c732b136e6f6e7472617070696e672d6670746f696e742b0f72656665"
"72656e63652d74797065732b087369676e2d657874";
"0061736d0100000001540c60027f7f017f60047f7f7f7f017f60037f7f7f"
"017f60057f7f7f7f7f017f60017f017f60037f7f7f0060037f7f7e017f60"
"087f7f7f7f7f7f7f7f017f60067f7f7f7f7f7f017f60017f0060027f7f00"
"6000017f0295061908686f73745f6c69620c6765745f74785f6669656c64"
"000208686f73745f6c69620974726163655f6e756d000608686f73745f6c"
"6962057472616365000308686f73745f6c69620e6765745f6c6564676572"
"5f73716e000008686f73745f6c6962166765745f706172656e745f6c6564"
"6765725f74696d65000008686f73745f6c6962166765745f706172656e74"
"5f6c65646765725f68617368000008686f73745f6c6962136765745f7478"
"5f6e65737465645f6669656c64000108686f73745f6c6962106765745f74"
"785f61727261795f6c656e000408686f73745f6c6962176765745f74785f"
"6e65737465645f61727261795f6c656e000008686f73745f6c69621c6765"
"745f63757272656e745f6c65646765725f6f626a5f6669656c6400020868"
"6f73745f6c6962236765745f63757272656e745f6c65646765725f6f626a"
"5f6e65737465645f6669656c64000108686f73745f6c6962206765745f63"
"757272656e745f6c65646765725f6f626a5f61727261795f6c656e000408"
"686f73745f6c6962276765745f63757272656e745f6c65646765725f6f62"
"6a5f6e65737465645f61727261795f6c656e000008686f73745f6c69620e"
"6163636f756e745f6b65796c6574000108686f73745f6c69621063616368"
"655f6c65646765725f6f626a000208686f73745f6c6962146765745f6c65"
"646765725f6f626a5f6669656c64000108686f73745f6c69621b6765745f"
"6c65646765725f6f626a5f6e65737465645f6669656c64000308686f7374"
"5f6c6962186765745f6c65646765725f6f626a5f61727261795f6c656e00"
"0008686f73745f6c69621f6765745f6c65646765725f6f626a5f6e657374"
"65645f61727261795f6c656e000208686f73745f6c69621163726564656e"
"7469616c5f6b65796c6574000708686f73745f6c69620d657363726f775f"
"6b65796c6574000308686f73745f6c69620d6f7261636c655f6b65796c65"
"74000308686f73745f6c696213636f6d707574655f7368613531325f6861"
"6c66000108686f73745f6c6962076765745f6e6674000808686f73745f6c"
"69620b7570646174655f6461746100000306050505090a0b050301001106"
"19037f01418080c0000b7f0041eb99c0000b7f0041f099c0000b072e0406"
"6d656d6f727902000666696e697368001d0a5f5f646174615f656e640301"
"0b5f5f686561705f6261736503020a951d051900200241214f0440000b20"
"002002360204200020013602000b1900200241094f0440000b2000200236"
"0204200020013602000b970101057f230041206b22012400200141186a22"
"044100360200200141106a22054200370300200142003703080240418180"
"20200141086a411410002203411447044002402003410048044020002003"
"3602040c010b2000417f3602040b410121020c010b200020012903083700"
"01200041116a2004280200360000200041096a20052903003700000b2000"
"20023a0000200141206a24000b450020012d000045044020002001290001"
"370000200041106a200141116a280000360000200041086a200141096a29"
"00003700000f0b418080c000410b20013402041001000bff1a01097f2300"
"41c0036b22002400418b80c000411b41014100410110021a41a680c00041"
"2841014100410110021a41f680c000412b41014100410110021a20004200"
"370380010240024002400240024002400240024020004180016a22064108"
"1003220141004a044041a181c000411d2001ad10011a200041406b200620"
"01101a41be81c000411020002802402000280244410110021a2000420037"
"03a001200041a0016a220341081004220141004c0d0141ce81c000411920"
"01ad10011a200041386a20032001101a41e781c000411120002802382000"
"28023c410110021a200041d8016a22024200370300200041d0016a220542"
"00370300200041c8016a22044200370300200042003703c001200041c001"
"6a22074120100522014120470d0241f881c000411320074120410110021a"
"418b82c000412041014100410110021a419883c000412e41014100410110"
"021a200041b0016a4100360200200041a8016a4200370300200042003703"
"a0014181802020034114100022014114470d0341c683c000411420034114"
"410110021a20004200370380014188801820064108100022014108470d04"
"41da83c0004117420810011a41f183c000412820064108410110021a2000"
"410036026041848008200041e0006a22034104100022014104470d054199"
"84c000411520034104410110021a200041013b004c200242003703002005"
"420037030020044200370300200042003703c0010240200041cc006a4102"
"200741201006220141004e044041ae84c00041142001ad10011a20004130"
"6a20072001101941c284c000410d20002802302000280234410110021a0c"
"010b41cf84c00041292001ac10011a0b41f884c00041154183803c1007ac"
"10011a418d85c00041134189803c1007ac10011a0240200041cc006a4102"
"1008220141004e044041a085c00041142001ad10011a0c010b41b485c000"
"412d2001ac10011a0b41e185c000412341014100410110021a419a87c000"
"413341014100410110021a20004200370380014182801820004180016a22"
"0141081009220341004c0d062003410846044041cd87c000412b42081001"
"1a41f887c000412f20014108410110021a0c080b41a788c000412f2003ad"
"10011a200041286a20004180016a2003101a41d688c00041172000280228"
"200028022c410110021a0c070b41fb82c000411d2001ac10011a419b7f21"
"020c070b41d682c00041252001ac10011a419a7f21020c060b41ab82c000"
"412b2001ac10011a41997f21020c050b41f086c000412a2001ac10011a41"
"b77e21020c040b41af86c00041c1002001ac10011a41b67e21020c030b41"
"8486c000412b2001ac10011a41b57e21020c020b41ed88c00041c5002003"
"ac10011a0b200041b0016a4100360200200041a8016a4200370300200042"
"003703a0010240024002400240024002400240024041818020200041a001"
"6a220141141009220341004a0440200341154f0d0241b289c000411e2001"
"2003410110021a0c010b41d089c00041332003ac10011a0b200041013b00"
"60200041d8016a4200370300200041d0016a4200370300200041c8016a42"
"00370300200042003703c0010240200041e0006a4102200041c0016a2201"
"4120100a220341004e044041838ac000411c2003ad10011a200041206a20"
"0120031019419f8ac000411520002802202000280224410110021a0c010b"
"41b48ac00041392003ac10011a0b41ed8ac00041244183803c100bac1001"
"1a0240200041e0006a4102100c220141004e044041918bc000411c2001ad"
"10011a0c010b41ad8bc000413d2001ac10011a0b41ea8bc0004128410141"
"00410110021a41928cc000412f41014100410110021a200041c0016a2203"
"101b20004180016a22012003101c200041b8016a4200370300200041b001"
"6a4200370300200041a8016a4200370300200042003703a0012001411420"
"0041a0016a22034120100d22014120470d01200341204100100e22044100"
"4a044041c18cc00041232004ad10011a2000420037036020044182801820"
"0041e0006a22014108100f220341004c0d032003410846044041e48cc000"
"412a420810011a418e8dc000412e20014108410110021a0c070b41bc8dc0"
"00412e2003ad10011a200041186a200041e0006a2003101a41ea8dc00041"
"162000280218200028021c410110021a0c060b41a290c000413c2004ac10"
"011a200041d8016a4200370300200041d0016a4200370300200041c8016a"
"4200370300200042003703c001410141828018200041c0016a4120100f22"
"014100480d030c040b000b41f692c000412e2001ac10011a41ef7c21020c"
"050b41808ec000412b2003ac10011a0c020b41de90c00041c1002001ac10"
"011a0b200041013b00604101200041e0006a4102200041c0016a41201010"
"22014100480440419f91c00041352001ac10011a0b41014183803c101122"
"01410048044041d491c00041322001ac10011a0b4101200041e0006a4102"
"101222014100480440418692c00041392001ac10011a0b41bf92c0004137"
"41014100410110021a0c010b200041013b004c200041d8016a4200370300"
"200041d0016a4200370300200041c8016a4200370300200042003703c001"
"02402004200041cc006a4102200041c0016a220141201010220341004e04"
"4041ab8ec000411b2003ad10011a200041106a20012003101941c68ec000"
"411420002802102000280214410110021a0c010b41da8ec00041312003ac"
"10011a0b418b8fc000412320044183803c1011ac10011a02402004200041"
"cc006a41021012220141004e044041ae8fc000411b2001ad10011a0c010b"
"41c98fc00041352001ac10011a0b41fe8fc000412441014100410110021a"
"0b41a493c000412f41014100410110021a200041c0016a2201101b200041"
"cc006a22042001101c200041f8006a4200370300200041f0006a42003703"
"00200041e8006a4200370300200042003703600240024002400240024002"
"4020044114200041e0006a22034120100d2201412046044041d393c00041"
"0f20034120410110021a20004198016a420037030020004190016a420037"
"030020004188016a42003703002000420037038001024020044114200441"
"1441e293c000410920004180016a220141201013220341004a0440200041"
"086a20012003101941ea93c00041122000280208200028020c410110021a"
"0c010b41fc93c000413c2003ac10011a0b200041b8016a22064200370300"
"200041b0016a22024200370300200041a8016a2205420037030020004200"
"3703a001200041cc006a2203411441e807200041a0016a22084120101422"
"014120470d0141b894c000410e20084120410110021a200041d8016a4200"
"370300200041d0016a4200370300200041c8016a42003703002000420037"
"03c00120034114412a200041c0016a22044120101522014120470d0241c6"
"94c000410e20044120410110021a41d494c000412441014100410110021a"
"41cd95c000412541014100410110021a20004198016a4200370300200041"
"90016a420037030020004188016a4200370300200042003703800141f295"
"c000411720004180016a22034120101622014120470d03418996c000410b"
"41f295c0004117410110021a419496c000411120034120410110021a2004"
"101b200041e0006a22072004101c20064200370300200242003703002005"
"4200370300200042003703a0010240200422022002410020026b41037122"
"036a22054f0d0020030440200321010340200241003a0000200241016a21"
"02200141016b22010d000b0b200341016b4107490d000340200241003a00"
"00200241076a41003a0000200241066a41003a0000200241056a41003a00"
"00200241046a41003a0000200241036a41003a0000200241026a41003a00"
"00200241016a41003a0000200241086a22022005470d000b0b2005418002"
"20036b2201417c716a220220054b0440034020054100360200200541046a"
"22052002490d000b0b024020022001410371220120026a22034f0d002001"
"220504400340200241003a0000200241016a2102200541016b22050d000b"
"0b200141016b4107490d000340200241003a0000200241076a41003a0000"
"200241066a41003a0000200241056a41003a0000200241046a41003a0000"
"200241036a41003a0000200241026a41003a0000200241016a41003a0000"
"200241086a22022003470d000b0b02402007411420084120200441800210"
"17220141004a044041a596c00041102001ad10011a20014181024f0d0641"
"b596c000410920042001410110021a0c010b41be96c000412e2001ac1001"
"1a0b41ec96c000411241fe96c00041074101100222014100480d05418597"
"c000411d2001ad10011a41a297c0004111422a10014100480d0641b397c0"
"00411c420010011a4101210241cf97c000411a41014100410110021a41bb"
"98c000412941014100410110021a41e498c000412810182201450440418c"
"99c000412741e498c0004128410110021a41b399c000411e410141004101"
"10021a41ce80c000412841014100410110021a0c080b41d199c000411a20"
"01ac10011a41c37a21020c070b41b095c000411d2001ac10011a418b7c21"
"020c060b419495c000411c2001ac10011a41897c21020c050b41f894c000"
"411c2001ac10011a41887c21020c040b419998c00041222001ac10011a41"
"a77b21020c030b000b418398c00041162001ac10011a41a57b21020c010b"
"41e997c000411a42a47b10011a41a47b21020b200041c0036a240020020b"
"0bf5190100418080c0000beb196572726f725f636f64653d3d3d3d20484f"
"53542046554e4354494f4e532054455354203d3d3d54657374696e672032"
"3620686f73742066756e6374696f6e732028372063617465676f72696573"
"29535543434553533a20416c6c20686f73742066756e6374696f6e207465"
"73747320706173736564212d2d2d2043617465676f727920313a204c6564"
"676572204865616465722046756e6374696f6e73202d2d2d4c6564676572"
"2073657175656e6365206e756d6265722062797465733a4c656467657220"
"73716e20646174613a506172656e74206c65646765722074696d65206279"
"7465733a506172656e742074696d6520646174613a506172656e74206c65"
"6467657220686173683a535543434553533a204c65646765722068656164"
"65722066756e6374696f6e734552524f523a206765745f706172656e745f"
"6c65646765725f686173682077726f6e67206c656e6774683a4552524f52"
"3a206765745f706172656e745f6c65646765725f74696d65206661696c65"
"643a4552524f523a206765745f6c65646765725f73716e206661696c6564"
"3a2d2d2d2043617465676f727920323a205472616e73616374696f6e2044"
"6174612046756e6374696f6e73202d2d2d5472616e73616374696f6e2041"
"63636f756e743a5472616e73616374696f6e20466565206c656e6774683a"
"5472616e73616374696f6e20466565202873657269616c697a6564205852"
"5020616d6f756e74293a5472616e73616374696f6e2053657175656e6365"
"3a4e6573746564206669656c64206c656e6774683a4e6573746564206669"
"656c643a494e464f3a206765745f74785f6e65737465645f6669656c6420"
"6e6f74206170706c696361626c653a5369676e657273206172726179206c"
"656e6774683a4d656d6f73206172726179206c656e6774683a4e65737465"
"64206172726179206c656e6774683a494e464f3a206765745f74785f6e65"
"737465645f61727261795f6c656e206e6f74206170706c696361626c653a"
"535543434553533a205472616e73616374696f6e20646174612066756e63"
"74696f6e734552524f523a206765745f74785f6669656c64285365717565"
"6e6365292077726f6e67206c656e6774683a4552524f523a206765745f74"
"785f6669656c6428466565292077726f6e67206c656e6774682028657870"
"6563746564203820627974657320666f7220585250293a4552524f523a20"
"6765745f74785f6669656c64284163636f756e74292077726f6e67206c65"
"6e6774683a2d2d2d2043617465676f727920333a2043757272656e74204c"
"6564676572204f626a6563742046756e6374696f6e73202d2d2d43757272"
"656e74206f626a6563742062616c616e6365206c656e6774682028585250"
"20616d6f756e74293a43757272656e74206f626a6563742062616c616e63"
"65202873657269616c697a65642058525020616d6f756e74293a43757272"
"656e74206f626a6563742062616c616e6365206c656e67746820286e6f6e"
"2d58525020616d6f756e74293a43757272656e74206f626a656374206261"
"6c616e63653a494e464f3a206765745f63757272656e745f6c6564676572"
"5f6f626a5f6669656c642842616c616e636529206661696c656420286d61"
"79206265206578706563746564293a43757272656e74206c656467657220"
"6f626a656374206163636f756e743a494e464f3a206765745f6375727265"
"6e745f6c65646765725f6f626a5f6669656c64284163636f756e74292066"
"61696c65643a43757272656e74206e6573746564206669656c64206c656e"
"6774683a43757272656e74206e6573746564206669656c643a494e464f3a"
"206765745f63757272656e745f6c65646765725f6f626a5f6e6573746564"
"5f6669656c64206e6f74206170706c696361626c653a43757272656e7420"
"6f626a656374205369676e657273206172726179206c656e6774683a4375"
"7272656e74206e6573746564206172726179206c656e6774683a494e464f"
"3a206765745f63757272656e745f6c65646765725f6f626a5f6e65737465"
"645f61727261795f6c656e206e6f74206170706c696361626c653a535543"
"434553533a2043757272656e74206c6564676572206f626a656374206675"
"6e6374696f6e732d2d2d2043617465676f727920343a20416e79204c6564"
"676572204f626a6563742046756e6374696f6e73202d2d2d537563636573"
"7366756c6c7920636163686564206f626a65637420696e20736c6f743a43"
"6163686564206f626a6563742062616c616e6365206c656e677468202858"
"525020616d6f756e74293a436163686564206f626a6563742062616c616e"
"6365202873657269616c697a65642058525020616d6f756e74293a436163"
"686564206f626a6563742062616c616e6365206c656e67746820286e6f6e"
"2d58525020616d6f756e74293a436163686564206f626a6563742062616c"
"616e63653a494e464f3a206765745f6c65646765725f6f626a5f6669656c"
"642842616c616e636529206661696c65643a436163686564206e65737465"
"64206669656c64206c656e6774683a436163686564206e65737465642066"
"69656c643a494e464f3a206765745f6c65646765725f6f626a5f6e657374"
"65645f6669656c64206e6f74206170706c696361626c653a436163686564"
"206f626a656374205369676e657273206172726179206c656e6774683a43"
"6163686564206e6573746564206172726179206c656e6774683a494e464f"
"3a206765745f6c65646765725f6f626a5f6e65737465645f61727261795f"
"6c656e206e6f74206170706c696361626c653a535543434553533a20416e"
"79206c6564676572206f626a6563742066756e6374696f6e73494e464f3a"
"2063616368655f6c65646765725f6f626a206661696c6564202865787065"
"6374656420776974682074657374206669787475726573293a494e464f3a"
"206765745f6c65646765725f6f626a5f6669656c64206661696c65642061"
"7320657870656374656420286e6f20636163686564206f626a656374293a"
"494e464f3a206765745f6c65646765725f6f626a5f6e65737465645f6669"
"656c64206661696c65642061732065787065637465643a494e464f3a2067"
"65745f6c65646765725f6f626a5f61727261795f6c656e206661696c6564"
"2061732065787065637465643a494e464f3a206765745f6c65646765725f"
"6f626a5f6e65737465645f61727261795f6c656e206661696c6564206173"
"2065787065637465643a535543434553533a20416e79206c656467657220"
"6f626a6563742066756e6374696f6e732028696e74657266616365207465"
"73746564294552524f523a206163636f756e745f6b65796c657420666169"
"6c656420666f722063616368696e6720746573743a2d2d2d204361746567"
"6f727920353a204b65796c65742047656e65726174696f6e2046756e6374"
"696f6e73202d2d2d4163636f756e74206b65796c65743a54657374547970"
"6543726564656e7469616c206b65796c65743a494e464f3a206372656465"
"6e7469616c5f6b65796c6574206661696c65642028657870656374656420"
"2d20696e74657266616365206973737565293a457363726f77206b65796c"
"65743a4f7261636c65206b65796c65743a535543434553533a204b65796c"
"65742067656e65726174696f6e2066756e6374696f6e734552524f523a20"
"6f7261636c655f6b65796c6574206661696c65643a4552524f523a206573"
"63726f775f6b65796c6574206661696c65643a4552524f523a206163636f"
"756e745f6b65796c6574206661696c65643a2d2d2d2043617465676f7279"
"20363a205574696c6974792046756e6374696f6e73202d2d2d48656c6c6f"
"2c205852504c205741534d20776f726c6421496e70757420646174613a53"
"48413531322068616c6620686173683a4e46542064617461206c656e6774"
"683a4e465420646174613a494e464f3a206765745f6e6674206661696c65"
"6420286578706563746564202d206e6f2073756368204e4654293a546573"
"74207472616365206d6573736167657061796c6f61645472616365206675"
"6e6374696f6e206279746573207772697474656e3a54657374206e756d62"
"657220747261636554726163655f6e756d2066756e6374696f6e20737563"
"636565646564535543434553533a205574696c6974792066756e6374696f"
"6e734552524f523a2074726163655f6e756d2829206661696c65643a4552"
"524f523a2074726163652829206661696c65643a4552524f523a20636f6d"
"707574655f7368613531325f68616c66206661696c65643a2d2d2d204361"
"7465676f727920373a2044617461205570646174652046756e6374696f6e"
"73202d2d2d55706461746564206c656467657220656e7472792064617461"
"2066726f6d205741534d20746573745375636365737366756c6c79207570"
"6461746564206c656467657220656e74727920776974683a535543434553"
"533a2044617461207570646174652066756e6374696f6e734552524f523a"
"207570646174655f64617461206661696c65643a00550970726f64756365"
"727302086c616e6775616765010452757374000c70726f6365737365642d"
"62790105727573746325312e38362e302d6e696768746c79202862336233"
"363861313820323032352d30312d30352900490f7461726765745f666561"
"7475726573042b0f6d757461626c652d676c6f62616c732b087369676e2d"
"6578742b0f7265666572656e63652d74797065732b0a6d756c746976616c"
"7565";
std::string const deepRecursionHex =
"0061736d01000000013f0b60017f0060037f7f7f017f60027f7f017f60027f"
@@ -11598,92 +11774,6 @@ std::string const deepRecursionHex =
"2d676c6f62616c732b0f7265666572656e63652d74797065732b087369676e"
"2d657874";
extern std::string const hostFunctions2Hex =
"0061736d01000000012f0760047f7f7f7f017f60037f7f7f017f60027f7f"
"017f60057f7f7f7f7f017f60037f7f7e017f60017f017f6000017f028a02"
"0a08686f73745f6c6962057472616365000308686f73745f6c69620c6765"
"745f74785f6669656c64000108686f73745f6c69620974726163655f6e75"
"6d000408686f73745f6c69620e6163636f756e745f6b65796c6574000008"
"686f73745f6c69621063616368655f6c65646765725f6f626a000108686f"
"73745f6c6962146765745f6c65646765725f6f626a5f6669656c64000008"
"686f73745f6c6962136765745f74785f6e65737465645f6669656c640000"
"08686f73745f6c6962106765745f74785f61727261795f6c656e00050868"
"6f73745f6c6962176765745f74785f6e65737465645f61727261795f6c65"
"6e000208686f73745f6c69620b7570646174655f64617461000203020106"
"05030100110619037f01418080c0000b7f00419187c0000b7f0041a087c0"
"000b072e04066d656d6f727902000666696e697368000a0a5f5f64617461"
"5f656e6403010b5f5f686561705f6261736503020ae50701e20701057f23"
"0041e0006b2201240041b580c000411b41014100410110001a41f380c000"
"412841014100410110001a200141d0006a4100360200200141c8006a4200"
"370300200142003703400240024002400240024002400240418180202001"
"41406b22004114100122024114460440419b81c000410e20004114410110"
"001a2001420037032041888018200141206a41081001220041004c0d0141"
"a981c00041112000ad10021a2001410036020841848008200141086a4104"
"1001220041004c044041d081c00041252000ac10021a0c070b41ba81c000"
"41162000ad10021a41bf82c000412841014100410110001a200141306a22"
"034100360200200141286a22044200370300200142003703204181802020"
"0141206a22024114100122004100480d0220012000360238200141143602"
"3c20004114470d03200141106a2004290300370300200141186a20032802"
"0036020020012001290320370308200141d8006a4200370300200141d000"
"6a4200370300200141c8006a420037030020014200370340024002402001"
"41086a4114200141406b220341201003220041004a044041e782c000410f"
"20034120410110001a41f682c00041172000ad10021a2003200041001004"
"220041004c0d01418d83c00041162000ad10021a20014200370320200041"
"828018200241081005220041004a044041a383c00041152000ad10021a20"
"0041094f0d0841b883c000410e20022000410110001a0c030b41c683c000"
"412b2000ac10021a0c020b41ac84c000411d2000ac10021a417e21000c09"
"0b41f183c000413b2000ac10021a0b41c984c00041234101410041011000"
"1a200141d8006a4200370300200141d0006a4200370300200141c8006a42"
"0037030020014200370340024041ec84c0004102200141406b2202412010"
"06220041004e044041ee84c000411e2000ad10021a200041214f0d07418c"
"85c000411220022000410110001a0c010b419e85c00041292000ac10021a"
"0b02404183803c10072200410048044041c785c00041202000ac10021a0c"
"010b41e785c00041152000ad10021a0b024041ec84c00041021008220041"
"0048044041fc85c000411f2000ac10021a0c010b419b86c00041142000ad"
"10021a0b4101210041af86c000412241014100410110001a41d186c00041"
"0e10092202044041f786c000411a2002ac10021a417c21000c080b41df86"
"c000411841d186c000410e410110001a41d080c000412341014100410110"
"001a0c070b419582c000412a2002ac10021a0c050b41f581c00041202000"
"ac10021a0c040b418080c00041354100410041001000000b200141003602"
"40230041106b2400000b000b000b417f21000b200141e0006a240020000b"
"0b9b070100418080c0000b9107486f73742066756e6374696f6e20676574"
"5f63757272656e745f657363726f775f66696e6973685f6669656c642066"
"61696c6564213d3d3d20484f53542046554e4354494f4e53205445535420"
"3d3d3d535543434553533a20486f73742066756e6374696f6e2074657374"
"73207061737365642d2d2d205465737420313a205472616e73616374696f"
"6e204669656c6420416363657373202d2d2d4163636f756e74206669656c"
"643a466565206669656c64206c656e6774683a53657175656e6365206669"
"656c64206c656e6774683a4552524f523a206765745f74785f6669656c64"
"2853657175656e636529206661696c65643a4552524f523a206765745f74"
"785f6669656c642846656529206661696c65643a4552524f523a20676574"
"5f74785f6669656c64284163636f756e74292077726f6e67206c656e6774"
"683a2d2d2d205465737420323a204c6564676572204f626a656374204f70"
"65726174696f6e73202d2d2d4163636f756e74206b65796c65743a4b6579"
"6c65742062797465732067656e6572617465643a4f626a65637420636163"
"68656420696e20736c6f743a42616c616e6365206669656c64206c656e67"
"74683a42616c616e6365206669656c643a494e464f3a206765745f6c6564"
"6765725f6f626a5f6669656c642842616c616e636529206661696c65643a"
"494e464f3a2063616368655f6c65646765725f6f626a206661696c656420"
"28657870656374656420666f722074657374206669787475726573293a45"
"52524f523a206163636f756e745f6b65796c6574206661696c65643a2d2d"
"2d205465737420333a204e6573746564204669656c642041636365737320"
"2d2d2d01024e6573746564206669656c6420616363657373207375636365"
"656465643a4e6573746564206669656c6420646174613a494e464f3a2067"
"65745f74785f6e65737465645f6669656c64206e6f74206170706c696361"
"626c653a494e464f3a204e6f207369676e657273206172726179206f7220"
"6572726f723a5369676e657273206172726179206c656e6774683a494e46"
"4f3a204e6f206e6573746564206172726179206f72206572726f723a4e65"
"73746564206172726179206c656e6774683a2d2d2d205465737420343a20"
"5374617465204d6f64696669636174696f6e202d2d2d746573745f737461"
"74655f31323353746174652075706461746564207769746820646174613a"
"4552524f523a207570646174655f64617461206661696c65643a00550970"
"726f64756365727302086c616e6775616765010452757374000c70726f63"
"65737365642d62790105727573746325312e38362e302d6e696768746c79"
"202862336233363861313820323032352d30312d30352900490f74617267"
"65745f6665617475726573042b0f6d757461626c652d676c6f62616c732b"
"087369676e2d6578742b0f7265666572656e63652d74797065732b0a6d75"
"6c746976616c7565";
extern std::string const reqNonexistentField =
"0061736d0100000001120360027f7f0060047f7f7f7f017f6000017f02200108686f73745f"
"6c6962136765745f74785f6e65737465645f6669656c640001030403020000050301001006"

View File

@@ -51,10 +51,6 @@ extern std::string const zkProofHex;
extern std::string const sp1_wasm;
extern std::string const xrplStdExampleHex;
extern std::string const hostFunctions2Hex;
extern std::string const reqNonexistentField;
extern std::string const hfPerfTest;

View File

@@ -92,33 +92,41 @@ getAnyFieldData(STBase const* obj)
return Unexpected(HostFunctionError::NOT_LEAF_FIELD);
break;
case STI_ACCOUNT: {
auto const& account(static_cast<STAccount const*>(obj));
auto const* account(static_cast<STAccount const*>(obj));
auto const& data = account->value();
return Bytes{data.begin(), data.end()};
}
break;
case STI_AMOUNT: {
auto const& amount(static_cast<STAmount const*>(obj));
int64_t const data = amount->xrp().drops();
auto const* b = reinterpret_cast<uint8_t const*>(&data);
auto const* e = reinterpret_cast<uint8_t const*>(&data + 1);
return Bytes{b, e};
case STI_AMOUNT:
// will be processed by serializer
break;
case STI_ISSUE: {
auto const* issue(static_cast<STIssue const*>(obj));
Asset const& asset(issue->value());
// XRP and IOU will be processed by serializer
if (!asset.holds<Issue>())
{
// MPT
auto const& mptIssue = asset.get<MPTIssue>();
auto const& mptID = mptIssue.getMptID();
return Bytes{mptID.cbegin(), mptID.cend()};
}
}
break;
case STI_VL: {
auto const& vl(static_cast<STBlob const*>(obj));
auto const* vl(static_cast<STBlob const*>(obj));
auto const& data = vl->value();
return Bytes{data.begin(), data.end()};
}
break;
case STI_UINT256: {
auto const& num(static_cast<STBitString<256> const*>(obj));
auto const* num(static_cast<STBitString<256> const*>(obj));
auto const& data = num->value();
return Bytes{data.begin(), data.end()};
}
break;
case STI_UINT32: {
auto const& num(static_cast<STInteger<std::uint32_t> const*>(obj));
auto const* num(static_cast<STInteger<std::uint32_t> const*>(obj));
std::uint32_t const data = num->value();
auto const* b = reinterpret_cast<uint8_t const*>(&data);
auto const* e = reinterpret_cast<uint8_t const*>(&data + 1);
@@ -131,8 +139,9 @@ getAnyFieldData(STBase const* obj)
Serializer msg;
obj->add(msg);
auto const data = msg.getData();
return msg.getData();
return data;
}
Expected<Bytes, HostFunctionError>
@@ -600,13 +609,13 @@ WasmHostFunctionsImpl::trace(
bool asHex)
{
#ifdef DEBUG_OUTPUT
auto j = ctx.journal.error();
auto j = getJournal().error();
#else
auto j = ctx.journal.trace();
auto j = getJournal().trace();
#endif
if (!asHex)
{
j << "WAMR TRACE (" << leKey.key << "): " << msg << " - "
j << "WAMR TRACE (" << leKey.key << "): " << msg << " "
<< std::string_view(
reinterpret_cast<char const*>(data.data()), data.size());
}
@@ -614,8 +623,9 @@ WasmHostFunctionsImpl::trace(
{
std::string hex;
hex.reserve(data.size() * 2);
boost::algorithm::hex(data.begin(), data.end(), hex.begin());
j << "WAMR DEV TRACE (" << leKey.key << "): " << msg << " - " << hex;
boost::algorithm::hex(
data.begin(), data.end(), std::back_inserter(hex));
j << "WAMR DEV TRACE (" << leKey.key << "): " << msg << " " << hex;
}
return msg.size() + data.size() * (asHex ? 2 : 1);
@@ -625,13 +635,11 @@ Expected<int32_t, HostFunctionError>
WasmHostFunctionsImpl::traceNum(std::string_view const& msg, int64_t data)
{
#ifdef DEBUG_OUTPUT
auto j = ctx.journal.error();
auto j = getJournal().error();
#else
auto j = ctx.journal.trace();
auto j = getJournal().trace();
#endif
j << "WAMR DEV TRACE (" << leKey.key << "): " << msg << " - " << data;
j << "WAMR TRACE NUM(" << leKey.key << "): " << msg << " " << data;
return msg.size() + sizeof(data);
}

View File

@@ -98,13 +98,14 @@ getDataSlice(IW const* rt, wasm_val_vec_t const* params, int32_t& i)
{
auto const src = params->data[i].of.i32;
auto const ssz = params->data[i + 1].of.i32;
if (src < 0 || ssz <= 0)
if (src < 0 || ssz < 0)
return Unexpected(HostFunctionError::INVALID_PARAMS);
if (!ssz)
return Slice();
if (ssz > maxWasmDataLength)
{
return Unexpected(HostFunctionError::DATA_FIELD_TOO_LARGE);
}
auto mem = rt ? rt->getMem() : wmem();
if (!mem.s)
@@ -245,22 +246,6 @@ returnResult(
}
}
wasm_trap_t*
getLedgerSqnOld_wrap(
void* env,
wasm_val_vec_t const* params,
wasm_val_vec_t* results)
{
auto* hf = reinterpret_cast<HostFunctions*>(env);
// auto const* rt = reinterpret_cast<InstanceWrapper const*>(hf->getRT());
auto const sqn = hf->getLedgerSqn();
if (!sqn)
{
return hfResult(results, sqn.error());
}
return hfResult(results, static_cast<int32_t>(sqn.value()));
}
wasm_trap_t*
getLedgerSqn_wrap(
void* env,
@@ -1172,7 +1157,7 @@ testGetDataIncrement()
int index = 0;
auto const result = getDataSlice(&rt, &params, index);
if (!result || result.value() != Slice(buffer.data(), 3))
if (!result || result.value() != Slice(buffer.data(), 3) || index != 2)
return false;
}
@@ -1188,7 +1173,8 @@ testGetDataIncrement()
if (!result ||
result.value() !=
std::string_view(
reinterpret_cast<char const*>(buffer.data()), 5))
reinterpret_cast<char const*>(buffer.data()), 5) ||
index != 2)
return false;
}
@@ -1205,7 +1191,7 @@ testGetDataIncrement()
int index = 0;
auto const result = getDataAccountID(&rt, &params, index);
if (!result || result.value() != id)
if (!result || result.value() != id || index != 2)
return false;
}
@@ -1221,7 +1207,23 @@ testGetDataIncrement()
int index = 0;
auto const result = getDataUInt256(&rt, &params, index);
if (!result || result.value() != h1)
if (!result || result.value() != h1 || index != 2)
return false;
}
{
// test Currency
Currency const c = xrpCurrency();
wasm_val_vec_t params = {2, &values[0], 2, sizeof(wasm_val_t), nullptr};
values[0] = WASM_I32_VAL(0);
values[1] = WASM_I32_VAL(c.bytes);
memcpy(&buffer[0], c.data(), c.bytes);
int index = 0;
auto const result = getDataCurrency(&rt, &params, index);
if (!result || result.value() != c || index != 2)
return false;
}

View File

@@ -23,13 +23,6 @@
namespace ripple {
using getLedgerSqnOld_proto = int32_t();
wasm_trap_t*
getLedgerSqnOld_wrap(
void* env,
wasm_val_vec_t const* params,
wasm_val_vec_t* results);
using getLedgerSqn_proto = int32_t(uint8_t*, int32_t);
wasm_trap_t*
getLedgerSqn_wrap(

View File

@@ -17,6 +17,10 @@
*/
//==============================================================================
#ifdef _DEBUG
// #define DEBUG_OUTPUT 1
#endif
#include <xrpld/app/misc/WamrVM.h>
#include <xrpld/app/misc/WasmHostFunc.h>
#include <xrpld/app/misc/WasmHostFuncWrapper.h>
@@ -38,10 +42,6 @@ createWasmImport(HostFunctions* hfs)
{
// clang-format off
// TODO: remove after escrow_test wasm module will be updated
WASM_IMPORT_FUNC2(i, getLedgerSqnOld, "getLedgerSqn", hfs, 60);
WASM_IMPORT_FUNC2(i, getLedgerSqn, "get_ledger_sqn", hfs, 60);
WASM_IMPORT_FUNC2(i, getParentLedgerTime, "get_parent_ledger_time", hfs, 60);
WASM_IMPORT_FUNC2(i, getParentLedgerHash, "get_parent_ledger_hash", hfs, 60);
@@ -111,12 +111,16 @@ runEscrowWasm(
if (!ret)
{
// std::cout << ", error: " << ret.error() << std::endl;
#ifdef DEBUG_OUTPUT
std::cout << ", error: " << ret.error() << std::endl;
#endif
return Unexpected<TER>(ret.error());
}
// std::cout << ", ret: " << ret->result << ", gas spent: " << ret->cost <<
// std::endl;
#ifdef DEBUG_OUTPUT
std::cout << ", ret: " << ret->result << ", gas spent: " << ret->cost
<< std::endl;
#endif
return EscrowResult{ret->result > 0, ret->cost};
}