gballet / go-ethereum

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
23 stars 13 forks source link

witness: only include elements if there's enough gas for it #495

Closed jsign closed 3 weeks ago

jsign commented 2 months ago

This PR does changes to satisfy a new requirement when adding elements to the execution witness.

The new requirement involves only adding elements to the witness if there's sufficient gas for it.

Examples:

More generally, if you have X of available gas and include something in the witness cost Y, with Y>X, then we must not include it in the witness. This is made more apparent when we try to include a wide range of code chunks and only have gas for one but are asked to include 15. Before this PR, we were including 15, not only one.

From a stateless client perspective, being this strict is fine. Knowing if you have enough gas to include something in the witness doesn't depend on what you received from the witness (i.e: this PR including less things in the witness doesn't affect it). This is because everything you need to know to be sure that you can add something new to the witness is the access witness state of which branches and code chunks were added.

jsign commented 3 weeks ago

This PR served us well to generate the latest v0.0.6 fixtures, and planting a flag for stable fixtures.

Now closing this since we'll end up using https://github.com/gballet/go-ethereum/pull/502 which that all bugs were fixed to pass the fixtures.