-
Notifications
You must be signed in to change notification settings - Fork 3.5k
proofs: Rework blob handling #15354
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
proofs: Rework blob handling #15354
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #15354 +/- ##
===========================================
+ Coverage 46.29% 46.43% +0.14%
===========================================
Files 1227 1227
Lines 102944 103022 +78
===========================================
+ Hits 47659 47841 +182
+ Misses 51925 51805 -120
- Partials 3360 3376 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. s/out to @ImTei for flagging the blob issue in the challenger.
and @protolambda for designing the fix. |
Awesome work, thank you @mbaxter @pauldowman @Inphi for making this happen. |
Description
This PR fixes a medium severity bug in the fault proof system related to EIP-4844 blob data handling. For more context on this issue, see the disclosure of this bug in the technical proposals governance forum.
User assets are not at risk given Optimism’s multi-layered approach to security. Production fault-proof systems are protected by existing safeguards: monitoring, the air gap, the ability to blacklist games, and the ability to fall back to permissioned dispute games. Superchain chain operators currently relying on permissionless fault proofs, and chain servicers running infrastructure for these chains, have been proactively notified of this bug.
Technical Overview
Fix blob preimage handling in the
op-challenger
andop-program
.Blob field element preimage keys are constructed by concatenating a blob commitment with a blob polynomial evaluation point
z
:blobCommitment ++ z
1. Theop-challenger
uses thisz
value in the preimage key to reconstruct the target blob element by evaluating the blob polynomial at this point. Theop-challenger
then collects all of the relevant blob data and pushes it to thePreimageOracle
viaPreimageOracle.loadBlobPreimagePart
.Previously, the
z
value used in this process was set to the index of the target field element in the blob. However, because of the way that EIP-4844 blobs works, evaluating the blob polynomial at this index produces some value that is not our target field element. This causes theop-challenger
to push incorrect blob data to thePreimageOracle
. Further, theop-program
uses the same incorrectz
value to pull data from the preimage oracle. Whenop-program
is run through the off-chain Cannon CLI, it pulls the blob data from the localop-program
host which has correctly stored the blob data. However, when theop-program
executes on-chain, it pulls the invalid data fromPreimageOracle.sol
leading to a divergence in behavior between the on- and off-chain executions of Cannon.This PR reworks the way that we store blob preimage data. We now set
z
to one of the predefined evaluation points2 from EIP-4844. This allows us recover the correct blob field element when evaluating the blob polynomial atz
. We also now perform additional validations to ensure that the result from the blob polynomial evaluation matches our expectation. The updatedop-challenger
will now push the expected blob data to thePreimageOracle
, and theop-program
will retrieve this blob data using the correct keys to retrieve the correct data.Primer on EIP-4844 Blobs
Blobs are used in the OP stack to hold batched transaction data. An EIP-4844 blob is a byte string that represents a polynomial in evaluation form defined over a finite field. The byte string is a concatenations of 4096 32-byte field elements. Each field element represents the value of the polynomial at one of 4096 predefined evaluation points. These predefined points are the 4096th roots of unity in the finite field (in bit-reversed order).
A succinct proof that a field element (or substring of the batch data) is inside a blob consists of the following:
The challenger generates these four values to verifiably load blob preimages, as field elements, into
PreimageOracle.sol
.We previously used$z = i/32$ (the index of a given field element) to generate the blob proof data. However, if we evaluate the polynomial at this $z$ value, we will not retrieve the target blob field element but some other value not present in the blob byte string. We are now using the ith permuted root of unity: $z=s_i$ .
Summary of Changes
Production
Rework blob handling:
PreimageOracleData.BlobFieldIndex
to the more genericPreimageOracleData.ZPoint
op-program
l1 oracle clientop-program
host prefetcher to use new key formatOther changes:
stop-at-preimage
flag to support an optional step constraint. If set, the vm will only stop if it has reached or exceeded the specified step value.preimageParts
data from the PreimageOracle contractTests
op-program-compat
in CI - will need a follow-up PR to re-enable thisprimageParts
dataPreimageOracle
testOutputCannonStepWithPreimage
:step()
as expectedFootnotes
Note that this value is then hashed and the first byte is set to the blob key type in order to construct the final key. ↩
These are the bit-reversed roots of unity defined in the Ethereum consensus specs for EIP-4844. ↩