Skip to content

Commit 775c22c

Browse files
authored
Merge pull request #38 from fjl/beaconroot-jumps
beacon_root: simplify jump syntax
2 parents 2d373c2 + c3b2a07 commit 775c22c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/beacon_root/main.eas

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
caller ;; [caller]
5151
push SYSADDR ;; [sysaddr, caller]
5252
eq ;; [sysaddr == caller]
53-
push @submit ;; [submit_lbl, sysaddr == caller]
54-
jumpi ;; []
53+
jumpi @submit ;; []
5554

5655
;; Fallthrough if addresses don't match -- this means the caller intends
5756
;; to read a root.
@@ -62,8 +61,7 @@
6261
eq ;; [calldatasize == 32]
6362

6463
;; Jump to continue if length-check passed, otherwise revert.
65-
push @loadtime ;; [loadtime_lbl, calldatasize == 32]
66-
jumpi ;; []
64+
jumpi @loadtime ;; []
6765
%do_revert() ;; []
6866

6967
loadtime:
@@ -74,8 +72,7 @@ loadtime:
7472

7573
;; Verify input timestamp is non-zero.
7674
iszero ;; [input_timestamp == 0, input_timestamp]
77-
push @throw ;; [throw_lbl, input_timestamp == 0, input_timestamp]
78-
jumpi ;; [input_timestamp]
75+
jumpi @throw ;; [input_timestamp]
7976

8077
;; Compute the timestamp index and load from storage.
8178
push BUFLEN ;; [buflen, input_timestamp]
@@ -89,8 +86,7 @@ loadtime:
8986
;; don't match if the slot has been overwritten by the ring buffer or if
9087
;; the timestamp input wasn't a valid previous timestamp.
9188
eq ;; [stored_timestamp == input_timestamp, time_index]
92-
push @loadroot ;; [loadroot_lbl, input == timestamp, time_index]
93-
jumpi ;; [time_index]
89+
jumpi @loadroot ;; [time_index]
9490
%do_revert() ;; []
9591

9692
loadroot:

0 commit comments

Comments
 (0)