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

zkVM: change segment storage behavior #1483

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

zkVM: change segment storage behavior #1483

wants to merge 10 commits into from

Conversation

SchmErik
Copy link
Contributor

@SchmErik SchmErik commented Feb 27, 2024

This PR changes the segment storage behavior. Before this change, the default behavior is to store segments on disk. Change the behavior so that the first 64 segments are stored in memory. Beyond this limit, we will store segments on disk. This limit is configurable through the ExecutorEnv.

Here's my train of thought as I implemented this:
There’s two paths to using the zkVM: using client/server and using -F prove. For both client/server mode and using the -F prove flags, I wanted the default behavior to be “save x amount of segments to memory and save any segment beyond this limit to files”. This means that we need to initialize the segment path in either case so that in case we go over the default limit, we can save them to the tempdir.

-F prove mode:

gives the user the ability to use their own callbacks. So my thought was that calling Executor.run() should trigger the aforementioned default behavior. If they want to customize the behavior and provide their own call backs, they should call Executor.run_with_callback().

client/server mode:

With this mode, we don't support adding custom segment callbacks. So the only behavior that’s supported is the default that I’ve described above. I’ve allowed a way for the developer to configure ExecutorEnv to state how many segments they want stored in RAM. If they want to store only to file, they can set this value to Some(0).

Fixes: #1479

TODO: add support for client/server
From segments less than the limit, they will be stored in memory. For
segments beyond the limit, we will store on disk...
Copy link

vercel bot commented Feb 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-website ✅ Ready (Inspect) Visit Preview May 6, 2024 4:26pm
reports ✅ Ready (Inspect) Visit Preview May 6, 2024 4:26pm
reports-and-benchmarks ✅ Ready (Inspect) Visit Preview May 6, 2024 4:26pm
website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 4:26pm

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1483.d1uc3c4lom8wx5.amplifyapp.com

@SchmErik
Copy link
Contributor Author

converting to draft - need to write tests

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.

[Feature] Executor: configure segment storage
1 participant