-
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
Conversation
Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
| ;; 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing goto keyword in conditional jump statements
The conditional jump statements are missing the goto keyword. Throughout the codebase, the established pattern is if CONDITION goto TARGET (e.g., in bin/bin.zkasm, euc/euc.zkasm). Lines 36, 40, and 54 use if CONDITION exit_f without goto, which is inconsistent and likely incorrect syntax that may cause parsing errors or unintended behavior.
Additional Locations (2)
| ;; 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Conditional statement incorrectly split across two lines
The conditional statement if b != 0 on line 43 is separated from exit_f on line 44. In this assembly language, conditionals appear on a single line as if CONDITION goto TARGET. The current formatting likely causes exit_f to execute unconditionally (or cause a parse error), meaning the number handler will always fail even when valid, or the if statement has no effect.
| ;; 7. BASEFEE | ||
| ;; 8. BLOBBASEFEE | ||
|
|
||
| pub fn bin(INST=0x43 u8, BLOCK_NUMBER u32, VALUE u256, ARGUMENT_1 u256) -> (VALUE_NEXT_BLOCK u256) { |
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 bin causes naming conflict
The function is named bin, but there's already a pub fn bin defined in bin/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 as blockdata.
Note
Introduces
blockdata/binfor block-constant handling (timestamp monotonicity, number increment, chainid constancy; others stubbed) and adds related EVM opcode constants.blockdata/blockdata.asmimplementingbinto handle block-constant ops:TIMESTAMP: enforce strict increase.NUMBER: verify againstBLOCK_NUMBERand increment by 1.CHAINID: enforce constancy across blocks.COINBASE,PREVRANDAO,GASLIMIT,BASEFEE,BLOBBASEFEE: placeholders/TODOs.EVM_INST_COINBASE (0x41),TIMESTAMP (0x42),NUMBER (0x43),PREVRANDAO (0x44),GASLIMIT (0x45),CHAINID (0x46),BASEFEE (0x48),BLOBBASEFEE (0x4A).Written by Cursor Bugbot for commit a4bd99e. This will update automatically on new commits. Configure here.