Noir verifier smart contract written using Stylus SDK for cheaper onchain verification
Verification of ZK proofs onchain can sometimes be relatively expensive which limits their usecases. For example, a Uniswap V4 hook could perform compliance checks utilising ZK proofs but the gas costs necessary for these proof verifications impose extra fees on swappers, making the pools less attractive.
Arbitrum's Stylus SDK promises orders of magnitudes of speedup with large gas reductions relative to solidity contracts, so a ZK proof verifier written using stylus would help avoid the extra costs imposed on swappers due to these hooks.
At the start of the hackathon, I planned on tackling this through linking barretenberg into the stylus project as a static lib with a thin Rust wrapper around it to inject the verification key, etc. I ended up running into a couple of issues at this stage:
Because of these I went down the route of doing a straight port of our solidity verifier into Rust to use the Stylus SDK directly. This would be guaranteed to fit within the size limit and sidestep any debugging of barretenberg.
I've made a certain amount of progress on this but I've also been splitting time on supporting other teams hacking on Noir so the verifier is about half written and in a seriously hacky state at the minute.
This hack was mainly motivated by wanting to explore Arbitrum's Stylus Rust SDK and as an added bonus to the cost reductions, it was nice to see the readability improvements relative to the original contract (even despite me writing it in a super hacky way due to time constraints).