Compare commits

..

5 Commits

Author SHA1 Message Date
Nicholas Dudfield
1e6cda4d64 fix: add fatal log on amendment-blocked shutdown 2026-06-19 09:35:39 +07:00
Nicholas Dudfield
c146f15247 fix: rethrow runtime_error if not amendment blocked 2026-06-19 09:35:39 +07:00
Nicholas Dudfield
fb5081d1f4 fix: narrow catch to std::runtime_error in switchLastClosedLedger 2026-06-19 09:35:39 +07:00
Nicholas Dudfield
d4bec012a2 fix: skip signalStop in standalone mode for test compatibility 2026-06-19 09:35:39 +07:00
Nicholas Dudfield
f7187ba94f fix: fail fast when amendment blocked instead of zombie state
- signalStop() for graceful shutdown when unsupported amendment activates
- early shutdown ~1 minute before expected activation to avoid race
- try/catch in switchLastClosedLedger to survive unknown field crashes
  during shutdown window
- show amendment warning to all RPC users, not just admin

Fixes: #706
2026-06-19 09:35:39 +07:00
9 changed files with 170 additions and 297 deletions

View File

@@ -95,16 +95,8 @@ if [[ "$4" == "" ]]; then
echo "Non GH, local building, no Action runner magic"
else
# GH Action, runner
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "release" ]]; then
echo "building on the release branch... placing it in builds/candidate"
mkdir /data/builds/candidate
cp /io/release-build/xahaud /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
else
echo "building non-release branch, placing it in builds root"
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
fi
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
echo "Published build to: http://build.xahau.tech/"
echo $(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
fi

View File

@@ -17,7 +17,6 @@
#define featureHooksUpdate2 "1"
#define fix20250131 "1"
#define fixGuardDepth32 "1"
#define fixHookMemoryMissing "1"
namespace hook_api {
struct Rules
{
@@ -268,7 +267,6 @@ enum hook_log_code : uint16_t {
CUSTOM_SECTION_DISALLOWED =
86, // the wasm contained a custom section (id=0)
INTERNAL_ERROR = 87, // an internal error described by the log text
MEMORY_MISSING = 88, // hook wasm did not contain a memory section
// RH NOTE: only HookSet msgs got log codes, possibly all Hook log lines
// should get a code?
};
@@ -447,7 +445,6 @@ getImportWhitelist(Rules const& rules)
enum GuardRulesVersion : uint64_t {
GuardRuleFix20250131 = 0x00000001,
GuardRuleDepth32 = 0x00000002,
GuardRuleMemoryMissing = 0x00000004,
};
inline uint64_t
@@ -458,8 +455,6 @@ getGuardRulesVersion(Rules const& rules)
version |= GuardRuleFix20250131;
if (rules.enabled(fixGuardDepth32))
version |= GuardRuleDepth32;
if (rules.enabled(fixHookMemoryMissing))
version |= GuardRuleMemoryMissing;
return version;
}

View File

@@ -893,7 +893,6 @@ validateGuards(
int last_import_number = -1;
int import_count = 0;
int last_section_type = 0;
bool has_memory_section = false;
for (int i = 8, j = 0; i < wasm.size();)
{
if (j == i)
@@ -1182,24 +1181,11 @@ validateGuards(
func_type_map[j] = type_idx;
}
}
else if (section_type == 5) // memory section
{
has_memory_section = true;
}
i = next_section;
continue;
}
if ((rulesVersion & hook_api::GuardRuleMemoryMissing) &&
!has_memory_section)
{
GUARDLOG(hook::log::MEMORY_MISSING)
<< "Malformed transaction. Hook did not contain a memory section."
<< "\n";
return {};
}
// we must subtract import_count from the hook and cbak function in order to
// be able to look them up in the functions section. this is a rule of the
// webassembly spec note that at this point in execution we are guarenteed

View File

@@ -150,32 +150,23 @@
WasmEdge_CallingFrameContext const& frameCtx __VA_OPT__( \
COMMA __VA_ARGS__))
#define HOOK_SETUP() \
using enum hook_api::hook_return_code; \
try \
{ \
[[maybe_unused]] ApplyContext& applyCtx = hookCtx.applyCtx; \
[[maybe_unused]] auto& view = applyCtx.view(); \
[[maybe_unused]] auto j = applyCtx.app.journal("View"); \
[[maybe_unused]] WasmEdge_MemoryInstanceContext* memoryCtx = \
WasmEdge_CallingFrameGetMemoryInstance(&frameCtx, 0); \
if (!memoryCtx) \
{ \
JLOG(j.warn()) << "HookError[" << HC_ACC() \
<< "]: wasm memory is unavailable"; \
if (view.rules().enabled(fixHookMemoryMissing)) \
{ \
hookCtx.result.exitType = hook_api::ExitType::WASM_ERROR; \
hookCtx.result.exitReason = ""; \
return INTERNAL_ERROR; \
} \
} \
[[maybe_unused]] unsigned char* memory = \
WasmEdge_MemoryInstanceGetPointer(memoryCtx, 0, 0); \
[[maybe_unused]] const uint64_t memory_length = \
WasmEdge_MemoryInstanceGetPageSize(memoryCtx) * \
WasmEdge_kPageSize; \
[[maybe_unused]] auto& api = hookCtx.api();
#define HOOK_SETUP() \
using enum hook_api::hook_return_code; \
try \
{ \
[[maybe_unused]] ApplyContext& applyCtx = hookCtx.applyCtx; \
[[maybe_unused]] auto& view = applyCtx.view(); \
[[maybe_unused]] auto j = applyCtx.app.journal("View"); \
[[maybe_unused]] WasmEdge_MemoryInstanceContext* memoryCtx = \
WasmEdge_CallingFrameGetMemoryInstance(&frameCtx, 0); \
[[maybe_unused]] unsigned char* memory = \
WasmEdge_MemoryInstanceGetPointer(memoryCtx, 0, 0); \
[[maybe_unused]] const uint64_t memory_length = \
WasmEdge_MemoryInstanceGetPageSize(memoryCtx) * \
WasmEdge_kPageSize; \
[[maybe_unused]] auto& api = hookCtx.api(); \
if (!memoryCtx || !memory || !memory_length) \
return INTERNAL_ERROR;
#define HOOK_TEARDOWN() \
} \

View File

@@ -34,7 +34,6 @@
// If you add an amendment here, then do not forget to increment `numFeatures`
// in include/xrpl/protocol/Feature.h.
XRPL_FIX (HookMemoryMissing, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (HookMap, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (GuardDepth32, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(NamedHooks, Supported::yes, VoteBehavior::DefaultNo)

View File

@@ -3081,100 +3081,6 @@ public:
ter(temMALFORMED));
}
void
testWasmMissingMemory(FeatureBitset features)
{
testcase("missing memory");
using namespace jtx;
auto const alice = Account{"alice"};
auto const bob = Account{"bob"};
auto const carol = Account{"carol"};
TestHook missing_memory_wasm = wasm[R"[test.hook](
(module
(type $rollback_type
(func (param i32 i32 i64) (result i64)))
(type $guard_type (func (param i32 i32) (result i32)))
(type $hook_type (func (param i32) (result i64)))
(import "env" "rollback"
(func $rollback (type $rollback_type)))
(import "env" "_g" (func $_g (type $guard_type)))
(func $hook (type $hook_type) (param i32) (result i64)
i32.const 1
i32.const 1
i64.const 0
call $rollback
drop
i32.const 1
i32.const 1
call $_g
drop
i64.const 0)
(export "hook" (func $hook)))
)[test.hook]"];
for (auto const& withFix : {false, true})
{
// test if the Hook is created before the Amendment is enabled
Env env{*this, features - fixHookMemoryMissing};
env.fund(XRP(10000), alice, bob, carol);
env(ripple::test::jtx::hook(alice, {{hso(missing_memory_wasm)}}, 0),
M("Install missing memory hook"),
HSFEE);
env.close();
if (withFix)
{
env.enableFeature(fixHookMemoryMissing);
env.close();
}
env(pay(bob, alice, XRP(1)),
M("Test missing memory hook"),
fee(XRP(1)),
ter(tecHOOK_REJECTED));
auto meta = env.meta();
BEAST_REQUIRE(meta);
BEAST_REQUIRE(meta->isFieldPresent(sfHookExecutions));
auto const& hookExecutions = meta->getFieldArray(sfHookExecutions);
BEAST_REQUIRE(hookExecutions.size() == 1);
auto const& e = hookExecutions[0];
auto const expectedExitType = withFix
? hook_api::ExitType::WASM_ERROR
: hook_api::ExitType::UNSET;
BEAST_EXPECT(
e.getFieldU8(sfHookResult) ==
static_cast<uint8_t>(expectedExitType));
BEAST_EXPECT(e.getFieldVL(sfHookReturnString).size() == 0);
BEAST_EXPECT(
e.getFieldU64(sfHookReturnCode) ==
0x8000000000000001 /* INTERNAL_ERROR */);
}
for (auto const& withFix : {false, true})
{
// test if the Hook is created after the Amendment is enabled
auto f = features - fixHookMemoryMissing;
if (withFix)
f = f | fixHookMemoryMissing;
Env env{*this, f};
env.fund(XRP(10000), alice, bob, carol);
auto const expectedTer =
withFix ? TER{temMALFORMED} : TER{tesSUCCESS};
env(ripple::test::jtx::hook(alice, {{hso(missing_memory_wasm)}}, 0),
M("Install missing memory hook"),
HSFEE,
ter(expectedTer));
env.close();
}
}
void
test_accept(FeatureBitset features)
{
@@ -15171,8 +15077,6 @@ public:
void
testWithFeatures(FeatureBitset features)
{
testWasmMissingMemory(features);
return;
testHooksOwnerDir(features);
testHooksDisabled(features);
testTxStructure(features);
@@ -15199,7 +15103,6 @@ public:
testFillCopy(features);
testWasm(features);
testWasmMissingMemory(features);
test_accept(features);
test_rollback(features);

View File

@@ -191,42 +191,6 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
}},
/* ==== WASM: 1 ==== */
{R"[test.hook](
(module
(type $rollback_type
(func (param i32 i32 i64) (result i64)))
(type $guard_type (func (param i32 i32) (result i32)))
(type $hook_type (func (param i32) (result i64)))
(import "env" "rollback"
(func $rollback (type $rollback_type)))
(import "env" "_g" (func $_g (type $guard_type)))
(func $hook (type $hook_type) (param i32) (result i64)
i32.const 1
i32.const 1
i64.const 0
call $rollback
drop
i32.const 1
i32.const 1
call $_g
drop
i64.const 0)
(export "hook" (func $hook)))
)[test.hook]",
{
0x00U, 0x61U, 0x73U, 0x6DU, 0x01U, 0x00U, 0x00U, 0x00U, 0x01U, 0x13U,
0x03U, 0x60U, 0x03U, 0x7FU, 0x7FU, 0x7EU, 0x01U, 0x7EU, 0x60U, 0x02U,
0x7FU, 0x7FU, 0x01U, 0x7FU, 0x60U, 0x01U, 0x7FU, 0x01U, 0x7EU, 0x02U,
0x19U, 0x02U, 0x03U, 0x65U, 0x6EU, 0x76U, 0x08U, 0x72U, 0x6FU, 0x6CU,
0x6CU, 0x62U, 0x61U, 0x63U, 0x6BU, 0x00U, 0x00U, 0x03U, 0x65U, 0x6EU,
0x76U, 0x02U, 0x5FU, 0x67U, 0x00U, 0x01U, 0x03U, 0x02U, 0x01U, 0x02U,
0x07U, 0x08U, 0x01U, 0x04U, 0x68U, 0x6FU, 0x6FU, 0x6BU, 0x00U, 0x02U,
0x0AU, 0x16U, 0x01U, 0x14U, 0x00U, 0x41U, 0x01U, 0x41U, 0x01U, 0x42U,
0x00U, 0x10U, 0x00U, 0x1AU, 0x41U, 0x01U, 0x41U, 0x01U, 0x10U, 0x01U,
0x1AU, 0x42U, 0x00U, 0x0BU,
}},
/* ==== WASM: 2 ==== */
{R"[test.hook](
(module
(type (;0;) (func (param i32 i32) (result i64)))
@@ -276,7 +240,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0BU,
}},
/* ==== WASM: 3 ==== */
/* ==== WASM: 2 ==== */
{R"[test.hook](
(module
(type (;0;) (func (param i32 i32) (result i64)))
@@ -330,7 +294,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x14U, 0x10U, 0x00U, 0x1AU, 0x0CU, 0x00U, 0x0BU, 0x0BU,
}},
/* ==== WASM: 4 ==== */
/* ==== WASM: 3 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -397,7 +361,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x00U, 0x20U, 0x02U, 0x0BU,
}},
/* ==== WASM: 5 ==== */
/* ==== WASM: 4 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -503,7 +467,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x6AU, 0x24U, 0x80U, 0x80U, 0x80U, 0x80U, 0x00U, 0x20U, 0x03U, 0x0BU,
}},
/* ==== WASM: 6 ==== */
/* ==== WASM: 5 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -578,7 +542,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x6AU, 0x24U, 0x80U, 0x80U, 0x80U, 0x80U, 0x00U, 0x20U, 0x05U, 0x0BU,
}},
/* ==== WASM: 7 ==== */
/* ==== WASM: 6 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g(uint32_t, uint32_t);
@@ -1195,7 +1159,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x78U, 0x29U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 8 ==== */
/* ==== WASM: 7 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g(uint32_t, uint32_t);
@@ -1624,7 +1588,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 9 ==== */
/* ==== WASM: 8 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -1830,7 +1794,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x3DU, 0x20U, 0x30U, 0x78U, 0x45U, 0x31U, 0x00U,
}},
/* ==== WASM: 10 ==== */
/* ==== WASM: 9 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -1952,7 +1916,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x58U, 0x4EU, 0x00U,
}},
/* ==== WASM: 11 ==== */
/* ==== WASM: 10 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -2085,7 +2049,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x4FU, 0x4EU, 0x43U, 0x45U, 0x53U, 0x00U,
}},
/* ==== WASM: 12 ==== */
/* ==== WASM: 11 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -2165,7 +2129,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x54U, 0x00U,
}},
/* ==== WASM: 13 ==== */
/* ==== WASM: 12 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -2210,7 +2174,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x00U,
}},
/* ==== WASM: 14 ==== */
/* ==== WASM: 13 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -2529,7 +2493,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 15 ==== */
/* ==== WASM: 14 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -3315,7 +3279,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x37U, 0x36U, 0x33U, 0x4CU, 0x4CU, 0x20U, 0x29U, 0x00U,
}},
/* ==== WASM: 16 ==== */
/* ==== WASM: 15 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -3705,7 +3669,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 17 ==== */
/* ==== WASM: 16 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -3886,7 +3850,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x38U, 0x4CU, 0x4CU, 0x29U, 0x00U,
}},
/* ==== WASM: 18 ==== */
/* ==== WASM: 17 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -4075,7 +4039,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x29U, 0x00U,
}},
/* ==== WASM: 19 ==== */
/* ==== WASM: 18 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -4314,7 +4278,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x42U, 0x00U, 0x10U, 0x85U, 0x80U, 0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 20 ==== */
/* ==== WASM: 19 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -5016,7 +4980,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x38U, 0x35U, 0x35U, 0x32U, 0x55U, 0x29U, 0x00U,
}},
/* ==== WASM: 21 ==== */
/* ==== WASM: 20 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -6361,7 +6325,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x29U, 0x00U,
}},
/* ==== WASM: 22 ==== */
/* ==== WASM: 21 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -6463,7 +6427,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x84U, 0x80U, 0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 23 ==== */
/* ==== WASM: 22 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -6506,7 +6470,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x0BU,
}},
/* ==== WASM: 24 ==== */
/* ==== WASM: 23 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -6654,7 +6618,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x34U, 0x34U, 0x4CU, 0x4CU, 0x2CU, 0x20U, 0x33U, 0x29U, 0x00U,
}},
/* ==== WASM: 25 ==== */
/* ==== WASM: 24 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -6982,7 +6946,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x38U, 0x34U, 0x39U, 0x30U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 26 ==== */
/* ==== WASM: 25 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -7187,7 +7151,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x10U, 0x85U, 0x80U, 0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 27 ==== */
/* ==== WASM: 26 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -7871,7 +7835,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x3DU, 0x3DU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 28 ==== */
/* ==== WASM: 27 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -8166,7 +8130,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x32U, 0x34U, 0x31U, 0x36U, 0x55U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 29 ==== */
/* ==== WASM: 28 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -8879,7 +8843,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x31U, 0x33U, 0x33U, 0x38U, 0x20U, 0x29U, 0x00U,
}},
/* ==== WASM: 30 ==== */
/* ==== WASM: 29 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -8964,7 +8928,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x32U, 0x30U, 0x00U,
}},
/* ==== WASM: 31 ==== */
/* ==== WASM: 30 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9026,7 +8990,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x00U, 0x0BU,
}},
/* ==== WASM: 32 ==== */
/* ==== WASM: 31 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9103,7 +9067,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x31U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 33 ==== */
/* ==== WASM: 32 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9180,7 +9144,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x31U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 34 ==== */
/* ==== WASM: 33 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9437,7 +9401,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x00U,
}},
/* ==== WASM: 35 ==== */
/* ==== WASM: 34 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9595,7 +9559,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x04U, 0x00U, 0x00U,
}},
/* ==== WASM: 36 ==== */
/* ==== WASM: 35 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9948,7 +9912,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x2AU, 0x04U, 0x00U, 0x00U, 0x31U, 0x04U, 0x00U, 0x00U,
}},
/* ==== WASM: 37 ==== */
/* ==== WASM: 36 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -9981,7 +9945,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x82U, 0x80U, 0x80U, 0x80U, 0x00U, 0x1AU, 0x20U, 0x01U, 0x0BU,
}},
/* ==== WASM: 38 ==== */
/* ==== WASM: 37 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10208,7 +10172,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 39 ==== */
/* ==== WASM: 38 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10239,7 +10203,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x00U, 0x1AU, 0x20U, 0x01U, 0x0BU,
}},
/* ==== WASM: 40 ==== */
/* ==== WASM: 39 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10550,7 +10514,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 41 ==== */
/* ==== WASM: 40 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10627,7 +10591,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 42 ==== */
/* ==== WASM: 41 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10661,7 +10625,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x80U, 0x80U, 0x00U, 0x1AU, 0x20U, 0x01U, 0x0BU,
}},
/* ==== WASM: 43 ==== */
/* ==== WASM: 42 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10748,7 +10712,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x32U, 0x00U,
}},
/* ==== WASM: 44 ==== */
/* ==== WASM: 43 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10782,7 +10746,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0BU,
}},
/* ==== WASM: 45 ==== */
/* ==== WASM: 44 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -10922,7 +10886,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x54U, 0x5FU, 0x4DU, 0x45U, 0x54U, 0x00U,
}},
/* ==== WASM: 46 ==== */
/* ==== WASM: 45 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11112,7 +11076,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x31U, 0x34U, 0x00U,
}},
/* ==== WASM: 47 ==== */
/* ==== WASM: 46 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11266,7 +11230,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 48 ==== */
/* ==== WASM: 47 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11427,7 +11391,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 49 ==== */
/* ==== WASM: 48 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11584,7 +11548,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x53U, 0x4CU, 0x4FU, 0x54U, 0x53U, 0x00U,
}},
/* ==== WASM: 50 ==== */
/* ==== WASM: 49 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11669,7 +11633,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x74U, 0x79U, 0x70U, 0x65U, 0x28U, 0x29U, 0x00U,
}},
/* ==== WASM: 51 ==== */
/* ==== WASM: 50 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -11926,7 +11890,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x00U,
}},
/* ==== WASM: 52 ==== */
/* ==== WASM: 51 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12164,7 +12128,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x3EU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 53 ==== */
/* ==== WASM: 52 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12260,7 +12224,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x53U, 0x54U, 0x00U,
}},
/* ==== WASM: 54 ==== */
/* ==== WASM: 53 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12370,7 +12334,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x31U, 0x00U,
}},
/* ==== WASM: 55 ==== */
/* ==== WASM: 54 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12500,7 +12464,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x30U, 0x30U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 56 ==== */
/* ==== WASM: 55 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12774,7 +12738,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x00U,
}},
/* ==== WASM: 57 ==== */
/* ==== WASM: 56 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -12911,7 +12875,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x2CU, 0x20U, 0x73U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x31U, 0x00U,
}},
/* ==== WASM: 58 ==== */
/* ==== WASM: 57 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -13205,7 +13169,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x5FU, 0x53U, 0x4CU, 0x4FU, 0x54U, 0x53U, 0x00U,
}},
/* ==== WASM: 59 ==== */
/* ==== WASM: 58 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -13439,7 +13403,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x5FU, 0x53U, 0x4CU, 0x4FU, 0x54U, 0x53U, 0x00U,
}},
/* ==== WASM: 60 ==== */
/* ==== WASM: 59 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -13735,7 +13699,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x2CU, 0x20U, 0x31U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 61 ==== */
/* ==== WASM: 60 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -13939,7 +13903,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x6EU, 0x74U, 0x32U, 0x22U, 0x20U, 0x2BU, 0x20U, 0x69U, 0x29U, 0x00U,
}},
/* ==== WASM: 62 ==== */
/* ==== WASM: 61 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -14056,7 +14020,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x69U, 0x29U, 0x00U,
}},
/* ==== WASM: 63 ==== */
/* ==== WASM: 62 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -14165,7 +14129,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x6EU, 0x74U, 0x65U, 0x6EU, 0x74U, 0x32U, 0x22U, 0x29U, 0x00U,
}},
/* ==== WASM: 64 ==== */
/* ==== WASM: 63 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -14438,7 +14402,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 65 ==== */
/* ==== WASM: 64 ==== */
{R"[test.hook](
#include <stdint.h>
#define sfInvoiceID ((5U << 16U) + 17U)
@@ -14657,7 +14621,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 66 ==== */
/* ==== WASM: 65 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -14769,7 +14733,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x58U, 0x49U, 0x53U, 0x54U, 0x00U,
}},
/* ==== WASM: 67 ==== */
/* ==== WASM: 66 ==== */
{R"[test.hook](
#include <stdint.h>
#define sfInvoiceID ((5U << 16U) + 17U)
@@ -14905,7 +14869,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x3DU, 0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 68 ==== */
/* ==== WASM: 67 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15041,7 +15005,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x49U, 0x47U, 0x00U,
}},
/* ==== WASM: 69 ==== */
/* ==== WASM: 68 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15180,7 +15144,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x66U, 0x28U, 0x64U, 0x61U, 0x74U, 0x61U, 0x32U, 0x29U, 0x00U,
}},
/* ==== WASM: 70 ==== */
/* ==== WASM: 69 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15292,7 +15256,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 71 ==== */
/* ==== WASM: 70 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15386,7 +15350,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x61U, 0x64U, 0x5BU, 0x69U, 0x5DU, 0x00U,
}},
/* ==== WASM: 72 ==== */
/* ==== WASM: 71 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15519,7 +15483,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x64U, 0x5BU, 0x69U, 0x5DU, 0x00U,
}},
/* ==== WASM: 73 ==== */
/* ==== WASM: 72 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15607,7 +15571,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x61U, 0x74U, 0x61U, 0x29U, 0x00U,
}},
/* ==== WASM: 74 ==== */
/* ==== WASM: 73 ==== */
{R"[test.hook](
#include <stdint.h>
#define sfInvoiceID ((5U << 16U) + 17U)
@@ -15718,7 +15682,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x33U, 0x32U, 0x00U,
}},
/* ==== WASM: 75 ==== */
/* ==== WASM: 74 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -15929,7 +15893,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 76 ==== */
/* ==== WASM: 75 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -16037,7 +16001,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x22U, 0x32U, 0x22U, 0x2CU, 0x20U, 0x31U, 0x29U, 0x00U,
}},
/* ==== WASM: 77 ==== */
/* ==== WASM: 76 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -16649,7 +16613,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 78 ==== */
/* ==== WASM: 77 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -16836,7 +16800,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x63U, 0x65U, 0x29U, 0x20U, 0x3EU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 79 ==== */
/* ==== WASM: 78 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17186,7 +17150,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 80 ==== */
/* ==== WASM: 79 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17322,7 +17286,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U,
}},
/* ==== WASM: 81 ==== */
/* ==== WASM: 80 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17381,7 +17345,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x64U, 0xE1U, 0xF1U,
}},
/* ==== WASM: 82 ==== */
/* ==== WASM: 81 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17554,7 +17518,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x54U, 0x5FU, 0x45U, 0x58U, 0x49U, 0x53U, 0x54U, 0x00U,
}},
/* ==== WASM: 83 ==== */
/* ==== WASM: 82 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17702,7 +17666,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x30U, 0x00U, 0x22U, 0x00U, 0x00U, 0x00U, 0x00U,
}},
/* ==== WASM: 84 ==== */
/* ==== WASM: 83 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17856,7 +17820,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0FU, 0x0BU, 0x02U, 0x56U, 0x00U,
}},
/* ==== WASM: 85 ==== */
/* ==== WASM: 84 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -17953,7 +17917,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x3DU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 86 ==== */
/* ==== WASM: 85 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -18012,7 +17976,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x4FU, 0x46U, 0x5FU, 0x42U, 0x4FU, 0x55U, 0x4EU, 0x44U, 0x53U, 0x00U,
}},
/* ==== WASM: 87 ==== */
/* ==== WASM: 86 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -18071,7 +18035,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x4EU, 0x44U, 0x53U, 0x00U,
}},
/* ==== WASM: 88 ==== */
/* ==== WASM: 87 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -19900,7 +19864,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x53U, 0x4DU, 0x41U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 89 ==== */
/* ==== WASM: 88 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -21519,7 +21483,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x29U, 0x29U, 0x00U,
}},
/* ==== WASM: 90 ==== */
/* ==== WASM: 89 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -24452,7 +24416,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x4FU, 0x4FU, 0x5FU, 0x53U, 0x4DU, 0x41U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 91 ==== */
/* ==== WASM: 90 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -26417,7 +26381,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x54U, 0x4FU, 0x4FU, 0x5FU, 0x53U, 0x4DU, 0x41U, 0x4CU, 0x4CU, 0x00U,
}},
/* ==== WASM: 92 ==== */
/* ==== WASM: 91 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -26702,7 +26666,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x29U, 0x20U, 0x3DU, 0x3DU, 0x20U, 0x30U, 0x00U,
}},
/* ==== WASM: 93 ==== */
/* ==== WASM: 92 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g(uint32_t, uint32_t);
@@ -27289,7 +27253,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x4EU, 0x5FU, 0x46U, 0x41U, 0x49U, 0x4CU, 0x55U, 0x52U, 0x45U, 0x00U,
}},
/* ==== WASM: 94 ==== */
/* ==== WASM: 93 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -27318,7 +27282,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0BU,
}},
/* ==== WASM: 95 ==== */
/* ==== WASM: 94 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -27350,7 +27314,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x20U, 0x52U, 0x65U, 0x6AU, 0x65U, 0x63U, 0x74U, 0x65U, 0x64U, 0x00U,
}},
/* ==== WASM: 96 ==== */
/* ==== WASM: 95 ==== */
{R"[test.hook](
(module
(type (;0;) (func (param i32 i32 i64) (result i64)))
@@ -27377,7 +27341,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x41U, 0x00U, 0x41U, 0x00U, 0x42U, 0x00U, 0x10U, 0x00U, 0x0BU,
}},
/* ==== WASM: 97 ==== */
/* ==== WASM: 96 ==== */
{R"[test.hook](
(module
(type (;0;) (func (param i32 i32) (result i32)))
@@ -27430,7 +27394,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x00U, 0x1AU, 0x0BU,
}},
/* ==== WASM: 98 ==== */
/* ==== WASM: 97 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -34073,7 +34037,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x39U, 0x30U, 0x31U, 0x32U, 0x33U, 0x00U,
}},
/* ==== WASM: 99 ==== */
/* ==== WASM: 98 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -34119,7 +34083,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0BU, 0x06U, 0x76U, 0x61U, 0x6CU, 0x75U, 0x65U, 0x00U,
}},
/* ==== WASM: 100 ==== */
/* ==== WASM: 99 ==== */
{R"[test.hook](
#include <stdint.h>
extern int32_t _g (uint32_t id, uint32_t maxiter);
@@ -34148,7 +34112,7 @@ std::map<std::string, std::vector<uint8_t>> wasm = {
0x0BU,
}},
/* ==== WASM: 101 ==== */
/* ==== WASM: 100 ==== */
{R"[test.hook](
#include <stdint.h>
extern int64_t accept (uint32_t read_ptr, uint32_t read_len, int64_t error_code);

View File

@@ -311,12 +311,28 @@ LedgerMaster::setValidLedger(std::shared_ptr<Ledger const> const& l)
if (auto const first =
app_.getAmendmentTable().firstUnsupportedExpected())
{
JLOG(m_journal.error()) << "One or more unsupported amendments "
"reached majority. Upgrade before "
<< to_string(*first)
<< " to prevent your server from "
"becoming amendment blocked.";
app_.getOPs().setAmendmentWarned();
using namespace std::chrono_literals;
auto const now = app_.timeKeeper().closeTime();
if (*first > now && (*first - now) <= 1min)
{
// Shut down just before the amendment activates to
// avoid processing ledgers with unknown fields.
JLOG(m_journal.error())
<< "Unsupported amendment activating imminently "
"at "
<< to_string(*first) << ". Shutting down.";
app_.getOPs().setAmendmentBlocked();
}
else
{
JLOG(m_journal.error())
<< "One or more unsupported amendments "
"reached majority. Upgrade before "
<< to_string(*first)
<< " to prevent your server from "
"becoming amendment blocked.";
app_.getOPs().setAmendmentWarned();
}
}
else
app_.getOPs().clearAmendmentWarned();

View File

@@ -1634,6 +1634,16 @@ NetworkOPsImp::setAmendmentBlocked()
{
amendmentBlocked_ = true;
setMode(OperatingMode::CONNECTED);
if (!app_.config().standalone())
{
JLOG(m_journal.fatal())
<< "One or more unsupported amendments activated. "
"Shutting down. Upgrade the server to remain "
"compatible with the network.";
app_.signalStop(
"One or more unsupported amendments activated. "
"Server must be upgraded to remain compatible with the network.");
}
}
inline bool
@@ -1789,8 +1799,23 @@ NetworkOPsImp::switchLastClosedLedger(
clearNeedNetworkLedger();
// Update fee computations.
app_.getTxQ().processClosedLedger(app_, *newLCL, true);
// Update fee computations. May throw if the ledger contains
// transactions with fields unknown to this binary (e.g. after an
// unsupported amendment activates). Catch to allow graceful shutdown.
//@@start process-closed-ledger-catch
try
{
app_.getTxQ().processClosedLedger(app_, *newLCL, true);
}
catch (std::runtime_error const& e)
{
if (!amendmentBlocked_)
throw;
JLOG(m_journal.error())
<< "Failed to process closed ledger: " << e.what();
return;
}
//@@end process-closed-ledger-catch
// Caller must own master lock
{
@@ -2449,7 +2474,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters)
"may be incorrectly configured or some [validator_list_sites] "
"may be unreachable.";
}
if (admin && isAmendmentWarned())
if (isAmendmentWarned())
{
Json::Value& w = warnings.append(Json::objectValue);
w[jss::id] = warnRPC_UNSUPPORTED_MAJORITY;
@@ -2893,6 +2918,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
// Ledgers are published only when they acquire sufficient validations
// Holes are filled across connection loss or other catastrophe
//@@start pubLedger-accepted-ledger-construction
std::shared_ptr<AcceptedLedger> alpAccepted =
app_.getAcceptedLedgerCache().fetch(lpAccepted->info().hash);
if (!alpAccepted)
@@ -2901,6 +2927,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
app_.getAcceptedLedgerCache().canonicalize_replace_client(
lpAccepted->info().hash, alpAccepted);
}
//@@end pubLedger-accepted-ledger-construction
XRPL_ASSERT(
alpAccepted->getLedger().get() == lpAccepted.get(),