disallow a computation allowance of 0 (#5541)

This commit is contained in:
Mayukha Vadari
2025-07-09 00:34:17 +05:30
committed by GitHub
parent 7bdf5fa8b8
commit 4fa0ae521e
2 changed files with 11 additions and 0 deletions

View File

@@ -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

View File

@@ -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())