From 3aa1e1ef07cf3782e8ee2d3d55669a5eeebd4237 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Fri, 25 Mar 2022 13:49:36 +0000 Subject: [PATCH] fix crash bug tn2 --- src/ripple/app/misc/impl/TxQ.cpp | 4 +++- src/ripple/app/tx/impl/SetHook.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ripple/app/misc/impl/TxQ.cpp b/src/ripple/app/misc/impl/TxQ.cpp index c005b3d43..2e853ac8d 100644 --- a/src/ripple/app/misc/impl/TxQ.cpp +++ b/src/ripple/app/misc/impl/TxQ.cpp @@ -49,7 +49,9 @@ getFeeLevelPaid(ReadView const& view, STTx const& tx) return std::pair{baseFee + ref, feePaid + ref}; }(); - assert(baseFee.signum() > 0); + //RH TODO: check if >= 0 is appropriate for hooks / emitted txn + //this was previously > 0 and a crash bug in tn2 + assert(baseFee.signum() >= 0); if (effectiveFeePaid.signum() <= 0 || baseFee.signum() <= 0) { return FeeLevel64(0); diff --git a/src/ripple/app/tx/impl/SetHook.cpp b/src/ripple/app/tx/impl/SetHook.cpp index 160ba06f2..9f8d59492 100644 --- a/src/ripple/app/tx/impl/SetHook.cpp +++ b/src/ripple/app/tx/impl/SetHook.cpp @@ -47,6 +47,9 @@ #define HS_ACC() ctx.tx.getAccountID(sfAccount) << "-" << ctx.tx.getTransactionID() namespace ripple { +//RH UPTO: sethook needs to correctly compute and charge fee for creating new hooks, updating existing hooks +//and it also needs to account for reserve requirements for namespaces, parameters and grants + // RH TODO test overflow on leb128 detection // web assembly contains a lot of run length encoding in LEB128 format