Skip to content

Commit f1c13e2

Browse files
authored
Merge pull request #39 from lightclient/fixup-comments-from-plainshift
all: fixes errors in the system contracts
2 parents 775c22c + e5d1970 commit f1c13e2

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/consolidations/main.eas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ accum_loop:
296296
push 32 ;; [32, offset, slotbase, ..]
297297
add ;; [offset=offset+32, slotbase, ..]
298298

299-
;; Read slot 'spk2_tpk1' from stoarge.
299+
;; Read slot 'spk2_tpk1' from storage.
300300
dup2 ;; [slotbase, offset, slotbase, ..]
301-
push 2 ;; [1, slotbase, offset, slotbase, ..]
301+
push 2 ;; [2, slotbase, offset, slotbase, ..]
302302
add ;; [slot, offset, slotbase, ..]
303303
sload ;; [spk2_tpk1, offset, slotbase, ..]
304304

src/execution_hash/main.eas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
jumpi @throw ;; [input]
5454

5555
;; Check if the input is requesting a block hash before the earliest available
56-
;; hash currently. Since we've verfied that input <= number - 1, it's safe to
56+
;; hash currently. Since we've verified that input <= number - 1, we know
57+
;; there will be no overflow during the subtraction of number - input.
5758
push BUFLEN ;; [buflen, input]
5859
dup2 ;; [input, buflen, input]
5960
number ;; [number, input, buflen, input]

src/withdrawals/main.eas

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

374374
skip_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

Comments
 (0)