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

Improve block hashes fetching #297

Closed
Nashtare opened this issue Dec 5, 2023 · 5 comments
Closed

Improve block hashes fetching #297

Nashtare opened this issue Dec 5, 2023 · 5 comments
Assignees
Labels
crate: zero_bin Anything related to the zero-bin subcrates.
Milestone

Comments

@Nashtare
Copy link
Collaborator

Nashtare commented Dec 5, 2023

We currently do around 128 RPC queries to get the list of previous block hashes to pass to the prover.
We may improve on this by persisting the previous block hashes in memory. Upon receiving the next block, we'd just need to rotate the vector and replace the item in position 255 with the parent hash.

Fairly minor improvement vs proving cost though.

@vladimir-trifonov
Copy link
Contributor

in prove_blocks.sh we call

cargo r --release --bin leader -- --runtime in-memory jerigon --rpc-url "$3" --block-number $i --proof-output-path $OUT_PROOF_PATH $PREV_PROOF_EXTRA_ARG > $OUT_LOG_PATH 2>&1

for every block i.
Any ideas on how we can persist it in memory?

@vladimir-trifonov
Copy link
Contributor

maybe we should add a way to call it once with from-block to-block params? @muursh

@Nashtare
Copy link
Collaborator Author

Yeah that wasn't really meant to be used with the helper scripts, but more in production environment when the leader would be most likely be running in the background as a daemon.

Although, kinda orthogonal, but it would be really nice if as you suggested we could tweak prove_blocks.sh to have the entire loop being run in one go, as we currently need to load all the circuits every time which is kinda wasteful (especially as in-memory runs with Monolithic mode by default IIRC?)

@BGluth
Copy link
Contributor

BGluth commented Apr 19, 2024

So I actually started some work that allows Jerrigon mode to take in a range of blocks to prove (#60). This is also pretty useful for benchmarking and looks pretty easy to do. If someone else wants this work let me know and I an push what I currently have.

@Nashtare
Copy link
Collaborator Author

Nashtare commented Jun 27, 2024

Superseded by #325

@github-project-automation github-project-automation bot moved this from Backlog to Done in Zero EVM Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: zero_bin Anything related to the zero-bin subcrates.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants