-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[EIP-4844] Return Modulus From Precompile #5864
Conversation
All tests passed; auto-merging...(pass) eip-4844.md
|
The idea of the The PointEvaluationPrecompile can be used by both Optimistic Rollups and zkRollups. The former use it by simply evaluating it at a point determined by the fraud proof game, the latter use this trick in order to determine equivalence to an internal representation of the polynomial. However, the evaluation happens inside a finite field, and it is only well defined if the field modulus is known. Smart contracts could contain a table mapping the commitment version to a modulus, but this would not allow smart contract to take into account future upgrades to a modulus that is not known yet. By allowing access to the modulus inside the EVM, the smart contract can be built so that it can use future commitments and proofs, without ever needing an upgrade. In the interest of not adding another precompile, we use the easiest way possible to add this functionality: Just make the PointEvaluationPrecompile return the modulus as well. It can then be used by the caller. It is also "free" in that the caller can just ignore this part of the return value without incurring an extra cost -- systems that remain upgradable for the foreseeable future will likely use this route for now. |
I added a short version of the explanation by @dankrad to the EIP rationale section. The PR is now open and should be ready to be merged. |
Regarding the structuring of return data: The bn128 pairing check
I personally prefer our approach, but there might be value in sticking with precedent? |
I am not qualified to comment on reverting in a precompile (though I can't see why it would be a problem.) That said, it might be best to format the return value according to Solidity ABI encoding?
|
Added padding for the degree value, so the precompile returns 2*32 bytes now. |
Already reviewed by @dankrad and @protolambda, merging now. |
dae771e
to
43f6cda
Compare
@@ -271,7 +271,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: | |||
# Quotient kzg: next 48 bytes | |||
quotient_kzg = input[144:192] | |||
assert verify_kzg_proof(data_kzg, x, y, quotient_kzg) | |||
return Bytes([]) | |||
return Bytes(U256(FIELD_ELEMENTS_PER_BLOB).to_bytes32() + U256(BLS_MODULUS).to_bytes32()) |
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.
Is this little or big endian? Should be clarified.
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.
Should be big endian as the EVM is?
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.
Yes, I will clarify in a quick separate PR
Modifies the point evaluation precompile to return the BLS modulus as a U256 value.
Motivation / rationale to be provided by @dankrad, draft PR until then.