@@ -166,7 +166,7 @@ handle_input:
166166 ;; Increment queue tail over last and write to storage.
167167 push 1 ;; [1, tail_idx]
168168 add ;; [tail_idx+1]
169- push QUEUE_TAIL ;; [tail_idx_slot]
169+ push QUEUE_TAIL ;; [tail_idx_slot, tail_idx+1 ]
170170 sstore ;; []
171171
172172 stop
@@ -296,7 +296,7 @@ accum_loop:
296296
297297 ;; Extract pk2 from pk2_am.
298298 dup1 ;; [pk2_am, pk2_am, offset, ..]
299- push pk2_mask ;; [mask, pk2_am, offset, ..]
299+ push pk2_mask ;; [mask, pk2_am, pk2_am, offset, ..]
300300 and ;; [pk2, pk2_am, offset, ..]
301301
302302 ;; Store pk2 at offset = i*RECORD_SIZE + 52.
@@ -361,15 +361,15 @@ update_excess:
361361
362362 ;; Check if excess needs to be reset to 0 for first iteration after
363363 ;; activation.
364- dup1 ;; [excess, excess, count, count ]
365- push EXCESS_INHIBITOR ;; [inhibitor, excess, excess, count, count ]
366- eq ;; [inhibitor == excess, excess, count, count ]
367- iszero ;; [inhibitor != excess, excess, count, count ]
368- jumpi @skip_reset ;; [excess, count, count ]
364+ dup1 ;; [excess, excess, count]
365+ push EXCESS_INHIBITOR ;; [inhibitor, excess, excess, count]
366+ eq ;; [inhibitor == excess, excess, count]
367+ iszero ;; [inhibitor != excess, excess, count]
368+ jumpi @skip_reset ;; [excess, count]
369369
370- ;; Drop the excess from stack and use 0.
371- pop ;; [count, count ]
372- push 0 ;; [reset_excess, count ]
370+ ;; Drop the count from stack and use 0.
371+ pop ;; [count]
372+ push 0 ;; [reset_excess]
373373
374374skip_reset:
375375 push SLOT_COUNT ;; [count_slot, excess, count]
@@ -379,7 +379,7 @@ skip_reset:
379379 ;; current block is greater than the target, subtract the target from the sum
380380 ;; and set it as the new excess withdrawal requests value.
381381 push TARGET_PER_BLOCK ;; [target, count, excess, count]
382- dup3 ;; [excess, target, count, excess]
382+ dup3 ;; [excess, target, count, excess, count ]
383383 dup3 ;; [count, excess, target, count, excess, count]
384384 add ;; [count+excess, target, count, excess, count]
385385 gt ;; [count+excess > target, count, excess, count]
0 commit comments