feat: add "zkvm" flag that reduces VariableList to a manageable size by zkVMs#567
Merged
unnawut merged 13 commits intoReamLabs:masterfrom Jun 16, 2025
Merged
feat: add "zkvm" flag that reduces VariableList to a manageable size by zkVMs#567unnawut merged 13 commits intoReamLabs:masterfrom
unnawut merged 13 commits intoReamLabs:masterfrom
Conversation
Contributor
|
Having a long standing branch is a pain. Given that Beam chain client itself is a prototype, I think it's okay to merge it. But this is apparently a tech debt. This issue is coming from After we become able to run Ream in 32-bit zkVMs, I think it's a good time to work on a proper solution. |
jihoonsong
reviewed
Jun 16, 2025
KolbyML
approved these changes
Jun 16, 2025
Contributor
KolbyML
left a comment
There was a problem hiding this comment.
I am good with this change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to achieve?
This PR adds "zkvm" feature flag so that external programs can config ream codebase in the way that can be run on zkVMs.
In this PR, the feature flag would drop
VariableListthat are 240 in size down to 229 when enabled, so that 32-bit zkVMs can work with ourBeaconState.See ReamLabs/consenzero-bench#24 for how this feature flag is used.
How was it implemented/fixed?
The BeaconState contains some "zkvm" features where 32-bit zkVMs would fail on constructing a
VariableListlarger than 232 size (i.e. 240). When "zkvm" feature is enabled, it would construct the BeaconState with 229 list instead.To remain conformant with
consensus-specs, this feature needs to be used with the modifiedssz_typescrate at https://github.com/ReamLabs/ssz_types/tree/magic-extended-list where the crate would detect 229 as a magic number when computing the root hash, and it will compute as a 240 list root instead.Tbh I'm not sure I actually want to add this to ream's main codebase, but it's needed to run
ream-consensuson zkVMs with correct results. If it's not ideal to merge, I'm happy to keep it as a long runningzkvmbranch on ream as well. Happy to discuss this and also in case anyone has a better idea to manage these differences.To-Do