ethereum-optimism / ethereum-optimism/optimism

kona-sp1-proposer: investigate and share preimage cache across witness runs

Open
#22,699 0 comments 0 reactions 0 assignees View on GitHub
proofs: ZK
Dominant language
Go
Stars
6.5k
Forks
4k
Avg merge
2d 15h
Merged PRs (30d)
145

Description

## Summary

Witness generation currently creates a fresh in-memory `InteropHost` preimage cache for every range and consolidation pass. With multiple span chunks, fetched L1/L2 preimages may therefore be fetched repeatedly.

I noticed that witness gen takes quite some time for a 60s span. And I suspect that it's partly due to the fact that every prove chunk refetches common preimages from RPCs. But let's quantify this more precisely: First measure the potential reuse, then introduce a shared cache if the results show meaningful benefit.

## Tasks

- Generate witnesses for representative consecutive spans and compare their preimage keys.
- Record how many preimages and how many bytes are common between the spans.
- If the overlap is meaningful, reuse a shared content-addressed preimage cache across witness-generation invocations.
- Keep per-span local boot inputs isolated.
- Add a focused test proving that common preimages are reused without changing generated witnesses or outputs.

Contributor guide

Open the contributing guide

Research direction

Start by running witness generation for representative consecutive spans and comparing the preimage keys and byte counts across range and consolidation passes. Read the InteropHost preimage cache handling and keep per-span boot inputs isolated while evaluating reuse. Done means a focused test shows common preimages are reused without changing generated witnesses or outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.