Skip to content
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

Closed
wants to merge 461 commits into from

Conversation

anupsv
Copy link
Contributor

@anupsv anupsv commented Aug 2, 2024

The custom verification equation is implemented which does G1 <-> G2 equivalence.

@anupsv anupsv changed the base branch from develop to epociask--incorporate-osp-fix August 2, 2024 07:48
src/osp/OneStepProverHostIo.sol Outdated Show resolved Hide resolved
src/osp/OneStepProverHostIo.sol Outdated Show resolved Hide resolved
uint256[1] memory result;
assembly {
// Call precompiled contract 0x08 for ECPAIRING
if iszero(staticcall(gas(), 0x08, input, 0x180, result, 0x20)) {
Copy link
Collaborator

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

Copy link
Contributor Author

@anupsv anupsv Aug 2, 2024

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

@anupsv anupsv marked this pull request as ready for review August 5, 2024 18:26
@anupsv anupsv requested a review from bxue-l2 August 5, 2024 22:47
@anupsv anupsv changed the base branch from epociask--incorporate-osp-fix to eigenda-v3.0.3 August 9, 2024 19:06
@@ -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");
Copy link
Collaborator

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

Copy link
Contributor Author

@anupsv anupsv Aug 12, 2024

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.

Copy link
Collaborator

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

@anupsv anupsv changed the base branch from eigenda-v3.0.3 to arch/contract-updates-v3.0.3 August 13, 2024 00:28
@anupsv
Copy link
Contributor Author

anupsv commented Aug 13, 2024

moving changes to #18

@anupsv anupsv closed this Aug 13, 2024
EthenNotEthan pushed a commit that referenced this pull request Sep 4, 2024
Add stylus programSize and programMemoryFootprint precompiles
@EthenNotEthan EthenNotEthan deleted the osp-fixes branch September 12, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.