From 4fa0ae521e5b65840d60a4d87baa1b0f6ddeee82 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 9 Jul 2025 00:34:17 +0530 Subject: [PATCH] disallow a computation allowance of 0 (#5541) --- src/test/app/Escrow_test.cpp | 7 +++++++ src/xrpld/app/tx/detail/Escrow.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 23b2c29c78..00a5302913 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1970,6 +1970,13 @@ struct Escrow_test : public beast::unit_test::suite ter(tefWASM_FIELD_NOT_INCLUDED)); } + { + // ComputationAllowance value of 0 + env(escrow::finish(carol, alice, seq), + escrow::comp_allowance(0), + ter(temBAD_LIMIT)); + } + { // not enough fees // This function takes 4 gas diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index 7639b4efa0..e9a7c78c7f 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -743,6 +743,10 @@ EscrowFinish::preflight(PreflightContext const& ctx) if (auto const allowance = ctx.tx[~sfComputationAllowance]; allowance) { + if (*allowance == 0) + { + return temBAD_LIMIT; + } if (*allowance > ctx.app.config().FEES.extension_compute_limit) { JLOG(ctx.j.debug())