From 910e70daac970720c947e7dea38ba9da259ce45f Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Thu, 24 Nov 2022 22:43:47 +0100 Subject: [PATCH] SCORU,Node: Fix an off-by-one in fuel consumption To execute N ticks, we need to be able to reach 0 fuel. --- src/proto_alpha/bin_sc_rollup_node/fuel.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/fuel.ml b/src/proto_alpha/bin_sc_rollup_node/fuel.ml index e05b7638f1b1..0ba889d6e61c 100644 --- a/src/proto_alpha/bin_sc_rollup_node/fuel.ml +++ b/src/proto_alpha/bin_sc_rollup_node/fuel.ml @@ -80,7 +80,8 @@ module Accounted : S = struct let one_tick_consumption = 1L let consume consumption fuel = - if Int64.compare fuel consumption > 0 then Some (Int64.sub fuel consumption) + if Int64.compare fuel consumption >= 0 then + Some (Int64.sub fuel consumption) else None let is_empty fuel = Int64.compare fuel 0L <= 0 -- GitLab