-
Notifications
You must be signed in to change notification settings - Fork 21
feat: asm blockdata #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: asm blockdata #844
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| ;; BLOCKDATA module | ||
|
|
||
| ;; The BLOCKDATA module is responsible for storing block-constant values: | ||
| ;; 1. COINBASE | ||
| ;; 2. TIMESTAMP | ||
| ;; 3. NUMBER | ||
| ;; 4. PREVRANDAO | ||
| ;; 5. GASLIMIT | ||
| ;; 6. CHAINID | ||
| ;; 7. BASEFEE | ||
| ;; 8. BLOBBASEFEE | ||
|
|
||
| pub fn bin(INST=0x43 u8, BLOCK_NUMBER u32, VALUE u256, ARGUMENT_1 u256) -> (VALUE_NEXT_BLOCK u256) { | ||
|
|
||
| if INST==EVM_INST_COINBASE goto coinbase | ||
| if INST==EVM_INST_TIMESTAMP goto timestamp ;;TODO | ||
| if INST==EVM_INST_NUMBER goto number | ||
| if INST==EVM_INST_PREVRANDAO goto prevrandao | ||
| if INST==EVM_INST_GASLIMIT goto gaslimit | ||
| if INST==EVM_INST_CHAINID goto chainid | ||
| if INST==EVM_INST_BASEFEE goto basefee | ||
| if INST==EVM_INST_BLOBBASEFEE goto blobbasefee | ||
| goto exit_f | ||
|
|
||
| var b u1 | ||
|
|
||
| exit_f: | ||
| fail | ||
| coinbase: | ||
| ;; nothing to do | ||
| return | ||
| timestamp: | ||
| ;; need to prove a (strict) increase of timestamp | ||
| var tmp u256 | ||
| b, tmp = VALUE_NEXT_BLOCK - VALUE - 1 | ||
| if b == 1 exit_f | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing
|
||
| return | ||
| number: | ||
| ;; prove the value of BLOCK_NUMBER | ||
| if BLOCK_NUMBER != VALUE exit_f | ||
| ;; block number increases by 1 | ||
| b, VALUE_NEXT_BLOCK = VALUE + 1 | ||
| if b != 0 | ||
| exit_f | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Conditional statement incorrectly split across two linesThe conditional statement |
||
| return | ||
| prevrandao: | ||
| ;; nothing to prove | ||
| return | ||
| gaslimit: | ||
| ;; TODO | ||
| return | ||
| chainid: | ||
| ;; prove constancy | ||
| if VALUE_NEXT_BLOCK != VALUE exit_f | ||
| return | ||
| basefee: | ||
| ;; TODO | ||
| return | ||
| blobbasefee: | ||
| ;; TODO | ||
| return | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Duplicate function name
bincauses naming conflictThe function is named
bin, but there's already apub fn bindefined inbin/bin.zkasm. This creates a naming collision that could cause conflicts when both modules are used together. The function in the blockdata module likely intended a different name such asblockdata.