Skip to content
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

Finish partial state update with ssz rs (process_block_header) #4

Open
wants to merge 6 commits into
base: partial-update-with-ssz-rs
Choose a base branch
from

Conversation

Vid201
Copy link

@Vid201 Vid201 commented Mar 18, 2025

This PR does the following:

  • finish implementing ssz_rs on consensus container (FixedVector was replaced with array [] )
  • consensus container was split into two crates: consensus/common and consensus/beacon-state. The reason for moving the beacon state into separate crate: crate consensus/common is used in the Risc0 crate (zkVM), which is 32-bit which means that type usize is 32-bit. Beacon state fields contains lists of size 1099511627776 which is too big for 32-bit, resulting in compilation errors.
  • merkle proofs are created in host, and verified in the guest (generalized indices are also checked so we now that the proof is for the correct field)
  • merkle proof for validator cannot be generated due to out-of-memory (OOM) error

@unnawut
Copy link
Collaborator

unnawut commented Mar 19, 2025

consensus container was split into two crates: consensus/common and consensus/beacon-state. The reason for moving the beacon state into separate crate: crate consensus/common is used in the Risc0 crate (zkVM), which is 32-bit which means that type usize is 32-bit. Beacon state fields contains lists of size 1099511627776 which is too big for 32-bit, resulting in compilation errors.

Great find! I was stuck with this earlier

let latest_block_header_proof: Proof = env::read();
// let validator_slashed: bool = env::read();
// let validator_slashed_proof: Proof = env::read();

let proposer_index: u64 = env::read();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing verification for proposer_index

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should this be verified since the next proposer index is not part of the Beacon State?

I guess we have to calculate this in the guest: https://ethereum.github.io/consensus-specs/specs/phase0/beacon-chain/#compute_proposer_index

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.

2 participants