Skip to content

Fix global state root when class root is empty#2

Open
Mohiiit wants to merge 1 commit intokarnotxyz:main-v0.14.1from
Mohiiit:fix/block0-empty-class-root
Open

Fix global state root when class root is empty#2
Mohiiit wants to merge 1 commit intokarnotxyz:main-v0.14.1from
Mohiiit:fix/block0-empty-class-root

Conversation

@Mohiiit
Copy link
Copy Markdown
Collaborator

@Mohiiit Mohiiit commented Mar 17, 2026

Summary

  • return the contract state root directly when the class commitment root is zero
  • align the Cairo implementation with the documented backward-compatibility rule

Why

When the class tree is empty, the global state root should equal the contract state root. The previous Cairo code only short-circuited when both roots were zero, which caused block 0 to hash (GLOBAL_STATE_VERSION, contract_state_root, 0) and produce the wrong final root in SNOS.

Validation

  • reproduced the mismatch from SNOS against block 0
  • verified that before OS execution the RPC root already matched the contract-state root and the class root was zero
  • reran SNOS against this patched sequencer checkout and confirmed the final OS root matched the RPC root: 0x3c538d437670f4c6f72dd799f215a007720ec7d19bc64195c96399145d8746f

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.

1 participant