mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-12 01:30:18 +00:00
Compare commits
1 Commits
smart-escr
...
ripple/se/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62d9f40d33 |
@@ -15,7 +15,7 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FEATURE(SmartEscrow, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(SmartEscrow, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_2_0, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV2, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_1_3, Supported::Yes, VoteBehavior::DefaultYes)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@@ -1545,73 +1544,11 @@ struct Wasm_test : public beast::unit_test::Suite
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Functor>
|
||||
void
|
||||
perf(size_t runs, Functor&& f)
|
||||
{
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::steady_clock;
|
||||
|
||||
// Warm up first.
|
||||
for (auto i = size_t{}; i < 10; ++i)
|
||||
{
|
||||
BEAST_EXPECT(f());
|
||||
}
|
||||
|
||||
auto totalTime = uint64_t{};
|
||||
for (auto i = size_t{}; i < runs; ++i)
|
||||
{
|
||||
auto const start = steady_clock::now();
|
||||
auto result = f();
|
||||
auto const end = steady_clock::now();
|
||||
totalTime += duration_cast<std::chrono::nanoseconds>(end - start).count();
|
||||
BEAST_EXPECT(result);
|
||||
}
|
||||
log << "Average time for " << runs << " runs: " << (totalTime / runs) << " ns\n";
|
||||
}
|
||||
|
||||
void
|
||||
perfEscrowFinish()
|
||||
{
|
||||
testcase("perf escrow finish");
|
||||
using namespace test::jtx;
|
||||
|
||||
static constexpr auto kRuns = 1000;
|
||||
|
||||
auto const wasm = hexToBytes(kAllHostFunctionsWasmHex);
|
||||
|
||||
Env env{*this};
|
||||
auto hfns = TestHostFunctions{env, 0};
|
||||
|
||||
perf(kRuns, [&] {
|
||||
return runEscrowWasm(wasm, hfns, 1'000'000, escrowFunctionName, {}).has_value();
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
perfEscrowCreate()
|
||||
{
|
||||
testcase("perf escrow create");
|
||||
using namespace test::jtx;
|
||||
|
||||
static constexpr auto kRuns = 1000;
|
||||
|
||||
auto const wasm = hexToBytes(kAllHostFunctionsWasmHex);
|
||||
|
||||
Env const env{*this};
|
||||
auto mock = HostFunctions{env.journal};
|
||||
|
||||
perf(kRuns, [&] { return !preflightEscrowWasm(wasm, mock, escrowFunctionName); });
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
perfEscrowFinish();
|
||||
perfEscrowCreate();
|
||||
|
||||
testGetDataHelperFunctions();
|
||||
testWasmLib();
|
||||
testBadWasm();
|
||||
|
||||
Reference in New Issue
Block a user