Aggregator for halo2 plonk circuits, including:
- Provide aggregation circuit for target circuit verification.
- Provide solidity code for aggregation circuit verification.
- truffle
cargo test test_solidity_render --release -- --nocapture
In terminal 1:
cd sol
yarn
yarn start
In terminal 2:
cd sol
truffle test
cargo test test_solidity_render --release -- --nocapture
cd sol
yarn
# add INFURA_PROJECT_ID, MNEMONIC in .env file
# NOTICE!!! This command would spend about 0.025 GoerliETH for deployment
# This command is a little bit slow in my test env, please wait for several minutes
truffle test --goerli
The solidity code generation depends on the sol
folder. You can download it from the source code or release it according to the version.
- call
run_circuit_unsafe_full_pass()
for target circuit withTranscriptHash::Poseidon
to get aggregation circuit and its instances. - call
run_circuit_unsafe_full_pass()
for aggregation circuit withTranscriptHash::Sha
orTranscriptHash::Keccak
to create aggregation circuit proof. - call
solidity_render()
withTranscriptHash::Sha
orTranscriptHash::Keccak
to generate solidity code. - call
solidity_aux_gen()
to prepare aux input for solidity verify. It will prepare scalar division results used by the verification to reduce gas.
See test test_solidity_render
for sample.
See test_gnark_render as an example.
cargo test test_gnark_render --release
cd gnark
go build && ./gnark-halo2-verify
mkdir -p sol/contracts
cp gnark_setup/contract_groth16.sol sol/contracts
cd sol
yarn
yarn start
Spawn a terminal under folder gnark/sol
npx truffle test
Notice
- The instance of the gnark circuit is the keccak hash of the shadow instance, so compute it in your contract.
- The transcript hash of the gnark circuit only supports sha256.