matter-labs / zksync-era

zkSync era
Apache License 2.0
3.1k stars 2.07k forks source link

Groth16 Plonk zkp prove supported #519

Open linyoufa opened 11 months ago

linyoufa commented 11 months ago

🌟 Feature Request

Operations such as bn256 pairing multiplication do not currently have a corresponding precompiled function, but are supported in eth

📝 Description

Provide a clear and concise description of the feature you'd like to see. 1.The following method calls failed

success := staticcall(sub(gas(), 2000000), 6, mIn, 128, pR, 64) success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64) success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)

2.this is pre-compiled Ethereum:

var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{3}): &ripemd160hash{}, common.BytesToAddress([]byte{4}): &dataCopy{}, common.BytesToAddress([]byte{5}): &bigModExp{eip2565: false}, common.BytesToAddress([]byte{6}): &bn256AddIstanbul{}, common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, common.BytesToAddress([]byte{9}): &blake2F{}, }

3.zksync precompiles Ecrecover.yul Keccake256.yul SHA256.yul

🤔 Rationale

Explain why this feature is important and how it benefits the project.

After using zk-snark algorithm to generate zkp proof, users need to perform zkp prove in zksync

📋 Additional Context

Add any other context or information about the feature request here. my email: linyoufa@gmail.com

mateuszmazurek commented 5 months ago

@zk-Lumi we can see following statement in the docs (https://docs.zksync.io/build/support/faq.html#evm-compatibility):

Some EVM’s cryptographic precompiles (notably pairings and RSA) won’t be available in the very first release but will be implemented soon after the launch, with pairing being a priority to allow both ZK Chains and protocols like Aztec/Dark Forest to be deployed without modifications too.

When can we expect it to be done? I haven't decided yet what blockchain my product will be launched on, would love to do it on zkSync, but without this feature it won't be possible :)