unionlabs / risczero-poc

Apache License 2.0
3 stars 0 forks source link

Fork `substrate-bn` to use RiscZero accelerated cryptography #6

Open cor opened 1 week ago

cor commented 1 week ago

According to our benchmarks, almost all time is spent on operations performed by the substrate-bn crate. https://github.com/unionlabs/union/blob/8a809a05417df4eedb718404319f256ecb20adb3/lib/cometbls-groth16-verifier/Cargo.toml#L22

RiscZero provides some accelerated crates: https://dev.risczero.com/api/zkvm/acceleration#adding-accelerator-support-to-crates

But judging by substrate-bn's Cargo.toml, this won't be an easy patch: https://github.com/paritytech/bn/blob/master/Cargo.toml

More work needs to be done on investigating how we can accelerate this.

benluelo commented 1 week ago

ideally we can just swap out substrate_bn::arith::U256 for RustCrypto's bigint, but i'm not sure how much of a lift this will be