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

EIP-4844: KZG verification acceleration via proof of equivalence #47

Open
mratsim opened this issue Mar 6, 2024 · 1 comment
Open

Comments

@mratsim
Copy link
Contributor

mratsim commented Mar 6, 2024

Describe the feature request

KZG verification is too slow to use without accelerator/coprocessor/precompile/circuit if we just compile https://github.com/ethereum/c-kzg-4844 in a zkVM.

One way to solve this is by using the "proof-of-equivalence" technique mentioned in:

For zkVMs, we should like use Poseidon2 on top of BabyBear (assuming its the prover field) as the hash function for efficiency.

This is accelerated:

zkEVM

In the ZK-EVM, the equivalent circuit is: taikoxyz/zkevm-circuits#106

@mratsim
Copy link
Contributor Author

mratsim commented Mar 6, 2024

Another quick-win we might be able to do is hardcoding the proof for loading the trusted setup since it will never ever change.

See @smtmfft perf report for

    let mut input = [0; 4096*32];
    // env::read_slice(&mut input);
    let (g1, g2) = parse_kzg_trusted_setup(&KZG_TRUST_SETUP).unwrap();
    // TODO: do something with the input

    // uncomment any of following line, you will see the error message
    // undefined symbol: malloc
    let kzg_settings = KzgSettings::load_trusted_setup(&g1.0, &g2.0).unwrap();
    let kzg_commit = KzgCommitment::blob_to_kzg_commitment(&input.into(), &kzg_settings).unwrap();
    let versioned_hash = kzg_to_versioned_hash(

image

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

No branches or pull requests

1 participant