filecoin-project / devgrants

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

Open Grant Proposal: A WasmEdge-based FVM #396

Closed juntao closed 2 years ago

juntao commented 2 years ago

Open Grant Proposal: A WasmEdge-based FVM

Name of Project: A WasmEdge-based FVM

Proposal Category: core-dev

Proposer: juntao

(Optional) Technical Sponsor: David Aronchick

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

Project Description

The FileCoin VM (FVM) is a WebAssembly-based on-chain VM that allows third-party applications and extensions to be safely executed on the FileCoin blockchain and interact with the account system on the blockchain. Since the FVM is a Turing-complete VM, the community could deploy other on-chain VMs, such as the Ethereum Virtual Machine (EVM), to execute smart contracts on top of it.

Since WebAssembly is a standard specification with multiple independent implementations, the FVM could be implemented on top of WebAssembly VM products. The value of the multiple VM approach is to increase FVM’s node client diversity, which leads to a more robust and more decentralized network.

WasmEdge is a leading open-source WebAssembly VM. It is the only WebAssembly VM independently hosted by the Linux Foundation and Cloud Native Computing Foundation (CNCF). It is one of the highest performing and most extensible WebAssembly on the market. It is already widely used by blockchain projects. WasmEdge has been successfully adopted as an on-chain VM to support Ethereum flavored WebAssembly (Ewasm) on Substrate and Oasis networks in the past.

We propose to provide an FVM implementation based on WasmEdge.

Value

The FVM is a major update to the FileCoin network. However, a Turing-complete virtual machine for on-chain smart contracts could also increase complexity and attack surface for the entire network. By increasing the diversity of FVM node software, we could improve FileCoin network security and stability in the face of growing complexity.

We have seen that the Ethereum network benefitted tremendously from two node-client implementations. When GETH nodes are down with a critical bug, ParityEthereum nodes can still sustain the network. For the FVM, the FileCoin team is currently using Wasmtime, an open-source WebAssembly runtime developed in Rust and Cranelift by a team of Fastly (prev Mozilla) engineers, as the underlying runtime. Our proposal is to port the FileCoin team’s FVM work to WasmEdge, a CNCF-hosted open-source WebAssembly runtime developed in C++ and LLVM.

This work will enhance the WasmEdge runtime to support FileCoin specific host functions and data structures. We will also enhance the WasmEdge Rust SDK to work with FVM’s integration points. We will provide node software release packages and documentation for the operator and developer communities to deploy WasmEdge-based FVM nodes.

The technical risk of this work is the compatibility between wasmtime and WasmEdge. While WebAssembly is a formal W3C standard, both wasmtime and WasmEdge have their own extensions. The runtimes’ Rust and C SDKs were never standardized. There could be wasmtime features that are very expensive to support on WasmEdge, and vice versa. However, the team has extensive experience working with wasmtime on other cloud-native projects in the past.

Deliverables

We will deliver the following software and documentation artifacts in the scope of this grant application.

Development Roadmap

The project timeline depends on the FileCoin team’s FVM integration timeline since our work is to port wasmtime-based FVM to WasmEdge.

The first phase of the project is for the team to analyze the current FVM work and create a concrete work plan to port to WasmEdge. We will create the project structure, project management tools, and tracking issues. It will likely take 2 senior developers / project leads x 2-3 weeks. We propose a $15,000 payment for this work.

The second phase is to catch up to FileCoin’s ongoing FVM dev work by forking the FVM working branch. We will work in parallel with the FVM team to do the following.

This work will require 3-4 developers and one product manager. We aim to catch up with FVM releases at the end of this phase within 1-2 months of FVM official release. This will be the bulk of the proposed work. We propose a $75,000 payment for this work.

The third phase is to create documentation and technical engagement materials for developers and node operators for the WasmEdge-based FVM. This phase requires 2 developers to support a writer / DevRel specialist. It should last about 1 month. It will be a collaboration among project software developers, documentation writers, and devrel experts in the WasmEdge community. We propose a $60,000 payment for this work after the whole project is accepted by the foundation.

While the complete project schedule, especially phase 2, depends on the progress of the FVM team, we aim to keep our dev team on a flexible schedule to accommodate the work. We estimate that the complete project will require 12 people x month of full-time development work, and last between 4-6 calendar months.

Total Budget Requested

Due to the amount of work, the need to shuffle engineers in and out of the project to keep the schedule in sync with the upstream FVM progress, and the diverse skills needed (12 person x month of full-time compiler / VM / Rust / blockchain engineers), we request a foundation grant for $150,000 USD. All funds will be used to pay personnel costs including salaries, taxes, insurance, offices, and benefits. We are open to having a portion of the budget paid in FIL.

We can invoice based on completed milestones.

Maintenance and Upgrade Plans

Our team is committed to maintaining the FVM extensions and Rust SDK enhancements to WasmEdge. Future FVM features and enhancements, such as EVM and Ewasm support could be covered by a separate grant, or be implemented and supported by another dev team using the open-source WasmEdge.

Team

Team Members

Michael Yuan is the founder and maintainer of the WasmEdge project. He is the author of Addison-Wesley’s book Building Blockchain Apps. He is also the lead for WasmEdge’s Substrate and Oasis based Ewasm projects.

Hydai Tai is a core developer at the WasmEdge project. He is a compiler and runtime expert. He is responsible for WasmEdge’s extension APIs and language-specific SDKs, such as its C, Go, Rust, and Python SDKs.

Tim McCallum is a blockchain engineer and Rust developer. He worked on Substrate and Oasis integration for WasmEdge.

Vivian Hu is a DevRel expert and product manager for the WasmEdge project. She is responsible for technical documentation and developer engagement.

Team Member LinkedIn Profiles

Team Website

https://wasmedge.org

Relevant Experience

WasmEdge has been successfully adopted as an on-chain VM to support Ethereum flavored WebAssembly (Ewasm) on Substrate and Oasis networks in the past. The team is instrumental in supporting both efforts.

Furthermore, the team sponsors two blockchain smart contract-related compiler toolchain projects.

Team code repositories

https://github.com/wasmedge

realChainLife commented 2 years ago

Hi @juntao thank you for this proposal. We'd like to fund the work outlined here, please email devgrants@fil.org to discuss next steps.