-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
core: 4844 opcode and precompile #27356
core: 4844 opcode and precompile #27356
Conversation
54fae12
to
7fbfdf7
Compare
7fbfdf7
to
3bc9603
Compare
core/vm/contracts.go
Outdated
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, | ||
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, | ||
common.BytesToAddress([]byte{9}): &blake2F{}, | ||
common.BytesToAddress([]byte{20}): &pointEvaluation{}, |
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.
Whaaa.. -- it's at 20
? 👀
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.
Yep, because of the BLS precompiles
core/vm/contracts.go
Outdated
return nil, errors.Join(errBlobVerifyKZGProof, err) | ||
} | ||
|
||
return common.CopyBytes(kzg4844.PrecompileReturnValue[:]), nil |
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.
Wait -- is this using a public global variable in the kzg8444
package to return the response?
Wow, that's dirtier than ..
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.
I mean... what if an rpc call happens to invoke the precompile too, for example?
Or the miner, building a block?
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.
Ahh.. wait.. the return value of this op is not input-dependent??
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 the precompile returns a constant
c42b5d4
to
5e0918a
Compare
@@ -1081,7 +1082,7 @@ func (b *kzgPointEvaluation) RequiredGas(input []byte) uint64 { | |||
|
|||
const ( | |||
blobVerifyInputLength = 192 // Max input length for the point evaluation precompile. | |||
blobVerifyKZGVersion uint8 = 0x01 // Version byte for the point evaluation precompile. | |||
blobCommitmentVersionKZG uint8 = 0x01 // Version byte for the point evaluation precompile. |
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.
This is part of the params package, shouldn't we use that?
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.
SGTM
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.
SGTM
* core: crypto: implement BLOBHASH and pointEval precompile * core: crypto: fixed nitpicks, moved precompile return value * core/vm: fix review comments
This reverts commit 4590721.
This reverts commit 4590721.
This PR implements the pointEvaluation precompile and the DATAHASH opcode both are needed for 4844
Spec: https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile