filecoin-project / devgrants

👟 Apply for a Filecoin devgrant. Help build the Filecoin ecosystem!
Other
377 stars 308 forks source link

Open Grant Proposal: Lurk-FVM Integration #808

Closed johnchandlerburnham closed 2 years ago

johnchandlerburnham commented 2 years ago

Open Grant Proposal: FVM Integration of Lurk zkSNARK Language and Applications

*Name of Project: Yatima*

Proposal Category: app-dev

Proposer: @johnchandlerburnham

Technical Sponsor: @porcuquine

Do you agree to open source all work you do on behalf of this RFP and dual-license under MIT, APACHE2, or GPL licenses?: Yes

Project Description

We are planning to integrate Lurk, a programming language for Turing-complete recursive zkSNARKs, with the Filecoin Virtual Machine as a user actor. This will enable zero-knowledge proofs written in Lurk to be verified natively on Filecoin, enabling us to then implement simple examples of zero-knowledge applications such as proofs of membership, private tokens, WASM or EVM state rollups.

We will also show a novel application of Lurk based on Yatima's previous Open Grant, called a zero knowledge type certificate (zkTC), which allows for succinct cryptographic verification that a specific program or data value correctly validates against a given type. With the Yatima project, Lurk zkTCs can be used to verify arbitrary formal proofs written in the Lean Theorem Prover. Finally, we will use Lurk zkTCs to create a demonstration of a on-chain marketplace where parties can trustlessly buy and sell verifiably correct typed programs and data.

Given the security requirements of this work, we will additionally use the Lean Theorem Prover to formally model many components of the Lurk and FVM stack. Bugs in the Lurk verifier or the FVM implementation have a high potential cost, and formal verification is a powerful tool for improving software correctness. Furthermore, these Lean security proofs can themselves then be verified via Lurk zkTCs on FVM, allowing the system to self-validate to some degree.

Value

The value of this project will be to allow users of Filecoin to create and interact with actors or smart contracts which can use Lurk to enhance their scalability or their expressiveness. Additionally, Lurk's generality allows for new kinds of applications of zero-knowledge proofs, such as zkTC concept explained above. We believe that zkTCs on FVM will make Filecoin the platform of choice for many formal verification use-cases, particularly involving the Lean Theorem Prover.

Deliverables

The deliverables for this project will be:

The final capstone deliverable will be the demonstration of a trustless proof marketplace (described further in Milestone 5)

Development Roadmap

Milestone 1: Lurk Verifier as an FVM Actor

Duration: 10 weeks, 4 people

The goal of this Milestone is to produce a proof-of-concept that shows Lurk may be integrated with FVM as a user actor. The FVM roadmap has user-actor deployment scheduled for Q1 '23, but likely this feature will be available on the Wallaby testnet much earlier.

Milestone 2: Formal Modeling of Lurk in Lean

Duration: 10 weeks, 4 people

The goal of this milestone is to begin to build infrastructure in Lean which matches the functionality of lurk-verify and lurk-rs to lay the groundwork for formal proofs in Lean 4 about Lurk. This milestone does not aim to fully formally verify the entirety of Lurk, but does intend to write proofs where practicable, and to lay a solid foundation for more comprehensive verification in future.

Milestone 3: Formal Modeling of FVM in Lean

Duration: 10 weeks, 4 people

The goal of this milestone is to facilitate writing formally verified Filecoin actors in Lean.

Milestone 4: Filecoin User Actors using Lurk

Duration: 10 weeks, 6 people

Using the tools developed in the previous milestones, we will write several example contracts showcasing the use cases of the Lurk-FVM stack. In particular, we would like to demonstrate a minimal example of how Lurk can be used to implement state-machine roll-ups, which could greatly enhance FVM's scalability.

Milestone 5: A Trustless Proof Marketplace

Duration: 10 weeks, 6 people.

Implement a minimum viable proof marketplace on FVM. As a rough sketch, this marketplace will have the following features:

These features may change substantially based on technical requirements, but the essential principle is a notion of incorporating Filecoin as an economic incentive layer on top of the kinds of contracts outlined in Milestone 4.

Total Budget Requested

Communicated to the team via Google Doc.

Maintenance and Upgrade Plans

Yatima Inc. is a well-funded seed-stage startup building a verifiable computing platform on top of Filecoin. The trustless proof marketplace, described above, is a key piece of infrastructure required by our platform. We also expect a varied ecosystems of data marketplaces to spring up on Filecoin, similar to how, for example, Uniswap catalyzed an entire industry of decentralized exchanges on the Ethereum platform.

Team Members

CVs provided via email

Team Website

https://github.com/yatima-inc/

Relevant Experience

Our team has extensive experience at the intersection of formal proofs, zero-knowledge cryptography, and blockchain technologies. We have contributed to the Lean Theorem Prover, the Lurk Language, as well as to Filecoin infrastructure such as the IPLD and Multiformats libraries. Our previous Filecoin Open Grant is here: https://github.com/filecoin-project/devgrants/issues/369, and our previous W3F grant is here: https://github.com/w3f/Grants-Program/blob/master/applications/yatima.md

Team code repositories

ErinOCon commented 2 years ago

Hi @johnchandlerburnham, thank you for your proposal! This grant has been approved. We will continue discussing next steps by email.

Stebalien commented 2 years ago

What features would you need to improve SNARK verification performance?

samuelburnham commented 2 years ago

At this stage, we're not sure what would be needed to improve performance on the FVM side. The plan is to create a minimal Lurk/Nova verifier compiled to wasm32-unknown-unknown without focusing on optimization yet, so there shouldn't be any need for SIMD support, floats, I/O, or syscalls. Definitely worth thinking about in the long term though!

ineffectualproperty commented 2 years ago

Hey @Stebalien - Based off recent profiling of the Nova compressedSNARK verify method, ~70-80% off the time is spent in multi-scalar multiplication (MSM) over the Pasta curves. A first target for improved verification performance would be a MSM precompile for the Pasta curves. Other elliptic curve operations (e.g. Add, Mul) may also be useful, and perhaps even hashing precompiles, but I don't have great insight today into the next bottleneck after MSM. The Ethereum EIP for the BLS12-381 precompiles (https://eips.ethereum.org/EIPS/eip-2537#proposed-addresses-table) may be a good starting point for a future FIP if this seems like a good direction to go.

oberstet commented 1 year ago

+1 for MSM as a hard wired performance primitive. using EIPs for precompiles to steal from: yeah, makes sense - if only rgd the attention to detail eg specifying behavior (a precompile MUST behave exactly the same under all inputs, conditions and in all client implementations .. the Filecoin FVM, any other FVM, any hardware implementation ..) and ABI (the EVM precompiles are via a VM bytecode and addresses etc, and this stuff must again be precise down to the single bit) ...