Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/consolidations/main.eas
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ accum_loop:
push 32 ;; [32, offset, slotbase, ..]
add ;; [offset=offset+32, slotbase, ..]

;; Read slot 'spk2_tpk1' from stoarge.
;; Read slot 'spk2_tpk1' from storage.
dup2 ;; [slotbase, offset, slotbase, ..]
push 2 ;; [1, slotbase, offset, slotbase, ..]
push 2 ;; [2, slotbase, offset, slotbase, ..]
add ;; [slot, offset, slotbase, ..]
sload ;; [spk2_tpk1, offset, slotbase, ..]

Expand Down
3 changes: 2 additions & 1 deletion src/execution_hash/main.eas
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
jumpi @throw ;; [input]

;; Check if the input is requesting a block hash before the earliest available
;; hash currently. Since we've verfied that input <= number - 1, it's safe to
;; hash currently. Since we've verified that input <= number - 1, we know
;; there will be no overflow during the subtraction of number - input.
push BUFLEN ;; [buflen, input]
dup2 ;; [input, buflen, input]
number ;; [number, input, buflen, input]
Expand Down
22 changes: 11 additions & 11 deletions src/withdrawals/main.eas
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ handle_input:
;; Increment queue tail over last and write to storage.
push 1 ;; [1, tail_idx]
add ;; [tail_idx+1]
push QUEUE_TAIL ;; [tail_idx_slot]
push QUEUE_TAIL ;; [tail_idx_slot, tail_idx+1]
sstore ;; []

stop
Expand Down Expand Up @@ -296,7 +296,7 @@ accum_loop:

;; Extract pk2 from pk2_am.
dup1 ;; [pk2_am, pk2_am, offset, ..]
push pk2_mask ;; [mask, pk2_am, offset, ..]
push pk2_mask ;; [mask, pk2_am, pk2_am, offset, ..]
and ;; [pk2, pk2_am, offset, ..]

;; Store pk2 at offset = i*RECORD_SIZE + 52.
Expand Down Expand Up @@ -361,15 +361,15 @@ update_excess:

;; Check if excess needs to be reset to 0 for first iteration after
;; activation.
dup1 ;; [excess, excess, count, count]
push EXCESS_INHIBITOR ;; [inhibitor, excess, excess, count, count]
eq ;; [inhibitor == excess, excess, count, count]
iszero ;; [inhibitor != excess, excess, count, count]
jumpi @skip_reset ;; [excess, count, count]
dup1 ;; [excess, excess, count]
push EXCESS_INHIBITOR ;; [inhibitor, excess, excess, count]
eq ;; [inhibitor == excess, excess, count]
iszero ;; [inhibitor != excess, excess, count]
jumpi @skip_reset ;; [excess, count]

;; Drop the excess from stack and use 0.
pop ;; [count, count]
push 0 ;; [reset_excess, count]
;; Drop the count from stack and use 0.
pop ;; [count]
push 0 ;; [reset_excess]
Comment on lines +371 to +372
Copy link
Collaborator

@fjl fjl Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks incorrect. The POP instruction does drop excess, and then a zero is pushed to set it to zero. So the comments should be like this:

  ;; Drop excess from the stack and replace it with zero.
  pop                   ;; [count]
  push 0                ;; [excess, count]


skip_reset:
push SLOT_COUNT ;; [count_slot, excess, count]
Expand All @@ -379,7 +379,7 @@ skip_reset:
;; current block is greater than the target, subtract the target from the sum
;; and set it as the new excess withdrawal requests value.
push TARGET_PER_BLOCK ;; [target, count, excess, count]
dup3 ;; [excess, target, count, excess]
dup3 ;; [excess, target, count, excess, count]
dup3 ;; [count, excess, target, count, excess, count]
add ;; [count+excess, target, count, excess, count]
gt ;; [count+excess > target, count, excess, count]
Expand Down
Loading