-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding custom verification function #13
Conversation
Co-authored-by: gzeon <hng@offchainlabs.com>
Merge nitro v2.3.4 (rc3)
Math Host I/Os
…-private into v2.0.0
src/osp/OneStepProverHostIo.sol
Outdated
uint256[1] memory result; | ||
assembly { | ||
// Call precompiled contract 0x08 for ECPAIRING | ||
if iszero(staticcall(gas(), 0x08, input, 0x180, result, 0x20)) { |
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 call is failing, I added dbug stmts into https://github.com/ethereum/go-ethereum/blob/master/core/vm/contracts.go#L559-L561 to see the exact error being generated by the precompile call, its:
error constructing twist point: <nil>
error constructing twist point: bn256: malformed point
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.
Looks like we're not feeding it properly from the test. Will need to take a look. This is being called from Line 130
@@ -260,57 +311,46 @@ contract OneStepProverHostIo is IOneStepProver { | |||
// [96:224] - g2TauMinusG2z | |||
// [224:288] - kzg commitment (g1 point) | |||
// [288:352] - proof (g1 point) | |||
|
|||
// [352:385] - preimage length | |||
|
|||
// expect first 32 bytes of proof to be the expected version hash | |||
require(bytes32(kzgProof[:32]) == leafContents, "KZG_PROOF_WRONG_HASH"); |
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.
lets update this check to actually compute the hash within the contract versus trusting the msp buffer
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.
Reading through the code since even 4844 ref implementation does it, this is looking more like a sanity check than anything. If the data to the contract can be from malicious entities and can provide things to pass the proof, then passing this check would be trivial cause commitment can change and so does the hash. Might be missing something.
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.
oh wow - this is really bad if true
moving changes to #18 |
Add stylus programSize and programMemoryFootprint precompiles
The custom verification equation is implemented which does G1 <-> G2 equivalence.