Skip to content

Contracts with nested loops are acting weird

For e.g. take this contract

function main (const _ : unit; const s : int) : list(operation) * int is block {
  var acc : int := 0;
  for i := 1 to s {
    for j := 1 to s {
      acc := acc + 1;
    }
  }
} with ((list [] : list(operation)), acc)

If I try to evaluate it with ligo run dry-run contract.ligo unit 3 then I would get ( LIST_EMPTY() , 0 ). Imo the final result should be ( LIST_EMPTY() , 9 ).

Can be reproduced in LIGO 0.49.0