Storage Proof Calldata Compression #231
Replies: 5 comments
-
This is great thinking and I really love the direction! The concept is closely related to the desire to read (or even subscribe to) L1 event logs from within the L2 VM. What's awesome is that we understand pretty well how to do both--your intuition here is right, but it turns out it can be done without even providing any proposed values--shifting absolutely everything into the fault proof. You could basically just provide devs with a regular (static) call function into L1. In cannon, we give the L2 VM a function, effectively a " The L2 VM uses this oracle function to unpack the block body from a block hash, then unpack a transaction or state root's children from that, and so on, fetching preimages until it's reached the key at the bottom of the trie. This is already how cannon reads trie state during the fault proof, using just the block root as an input, and there's no reason it can't execute the same strategy for both L1 and L2 state roots alike. In this model, you would be able to expose a new So the main thing preventing this from being implemented is actually not the fault proof, but downstream effects on node software itself. It's nice to be able to run L1 and L2 nodes on different machines. This would mean that we must run L1 and L2 nodes in the same process, or else face a huge number of asyncronous API calls in the middle of EVM execution. How to gas meter is another related problem, especially if asyncronous. Soon^TM, we really want this and are thinking about it a lot! |
Beta Was this translation helpful? Give feedback.
-
@ben-chain this is really cool to hear! Being able to perform an I'm curious if it will support both the super nice abstraction of "call L1 contract from L2 contract" as well as lower level "give me this slot from this block". The latter enables an additional set of uses cases, for example, state snapshots for token voting or accessing L1 state that isn't exposed through a public interface. I wonder if it is interesting to explore how this could interact with EIP-3668. Perhaps it is possible to provide an EIP-3668 interface for performing the L1 calls async, then you might be able to avoid the L1 in same process as L2 requirement? |
Beta Was this translation helpful? Give feedback.
-
@tarrencev We will need an archive node anyway if we want to run historical L2 blocks with the capability to read from the latest L1 block (at the time). Regarding EIP-3668, it's a really interesting notion! Thinking through the implications:
Honestly, I like the original idea a lot also. We could also remove the value if we want to save a little bit of calldata, validators would still be able to prefetch the data from L1. |
Beta Was this translation helpful? Give feedback.
-
@norswap thank you for responding! ah yeah that makes sense re: archive nodes. EIP-3668 could be nice for a standardized interface but, as you suggested, doesn't really add much to the solution here. Glad you like the original idea! Would love to keep chatting to understand if/when something like this could land on Optimism. I feel like it could enable many interesting use cases |
Beta Was this translation helpful? Give feedback.
-
Storage Proofs are a powerful way to incorporate Layer 1 state into Layer 2 execution without having to interact with the base chain. However, storage proofs are quite large, and with the current solution, the entire proof lands on mainnet as calldata.
For example, a full rlp encoded account + storage proof can look like this:
This proposal is for a special case calldata compression for storage proofs. Rather than landing the full storage proof on mainnet, it should be sufficient to land only the
state root
,state key
, andstate value
. With those, a fault prover would still be able to contest an invalid proof executed (by showingprove(root, key, proof) != committed value
) on Optimism and the cost of using storage proofs on Optimism would be significantly less expensive.Heres a quick example of what this could look like as a predeploy that proxies calls to the underlying contract and provides a getter for retrieving the proof value, not sure if it is possible to only land the internal
target.call
's calldata on mainnet + state root/key/valueBeta Was this translation helpful? Give feedback.
All reactions