Skip to content

Conversation

@letypequividelespoubelles
Copy link
Collaborator

@letypequividelespoubelles letypequividelespoubelles commented Dec 2, 2025

Note

Introduces blockdata/bin for block-constant handling (timestamp monotonicity, number increment, chainid constancy; others stubbed) and adds related EVM opcode constants.

  • Blockdata:
    • Add blockdata/blockdata.asm implementing bin to handle block-constant ops:
      • TIMESTAMP: enforce strict increase.
      • NUMBER: verify against BLOCK_NUMBER and increment by 1.
      • CHAINID: enforce constancy across blocks.
      • COINBASE, PREVRANDAO, GASLIMIT, BASEFEE, BLOBBASEFEE: placeholders/TODOs.
  • Constants:
    • Define opcode constants: 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.

Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
@letypequividelespoubelles letypequividelespoubelles linked an issue Dec 2, 2025 that may be closed by this pull request
@letypequividelespoubelles letypequividelespoubelles marked this pull request as draft December 2, 2025 10:30
;; need to prove a (strict) increase of timestamp
var tmp u256
b, tmp = VALUE_NEXT_BLOCK - VALUE - 1
if b == 1 exit_f
Copy link

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)

Fix in Cursor Fix in Web

;; block number increases by 1
b, VALUE_NEXT_BLOCK = VALUE + 1
if b != 0
exit_f
Copy link

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.

Fix in Cursor Fix in Web

;; 7. BASEFEE
;; 8. BLOBBASEFEE

pub fn bin(INST=0x43 u8, BLOCK_NUMBER u32, VALUE u256, ARGUMENT_1 u256) -> (VALUE_NEXT_BLOCK u256) {
Copy link

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZkAsm BlockData

2 participants