Filecoin v16 Network Upgrade: Skyr
The Filecoin v16 Skyr upgrade - the deployment of Milestone 1 of the Filecoin Virtual Machine to the Filecoin network was successfully completed on Wednesday, July 6th at 1400 UTC.
This upgrade represents the most dramatic transformation of the Filecoin network since its inception nearly two years ago. The centerpiece of this upgrade was the introduction of the Filecoin Virtual Machine (FVM), and the migration of chain execution to it. The Filecoin Virtual Machine (FVM) is a polyglot, WASM-based execution environment that will add smart contract deployment capabilities (known as actors) to the Filecoin decentralized storage Network.
The Skyr upgrade is the first of two steps on the path to fully enabling on-chain user programmability on Filecoin, bringing with it the possibility for a boundless number of new use cases and features to be implemented on the already robust network. This upgrade means that the core logic of the Filecoin network - implemented in the built-in actors - is now running atop the FVM M1 (milestone 1) code. And with the next step, users will be able to deploy custom logic to the network, making Filecoin both a storage and computation layer.
What’s in this upgrade?
The Skyr upgrade delivered three FVM-related Filecoin Improvement Proposals (FIPs) to the network — FIP 0030, 0031, and 0032. These FIPs collectively bring us to the first milestone of the FVM roadmap. At the point of the upgrade, the network atomically switched to using the new WASM-based FVM for chain validation - the specification for which is found here. Currently all clients have adopted the reference FVM implementation (ref-fvm), which uses Wasmtime as its Wasm runtime.
The atomic switch also involved the replacement of the Go-based specs-actors with the Rust-based builtin-actors (actors in Filecoin are equivalent to smart contracts in other platforms). These built-in actors give rise to the core features of the Filecoin protocol (storage, proving, power accounting, deals, etc.), and they’re at the heart of the protocol.
Built-in actors are compiled to Wasm bytecode, packaged into a CARv1 file (bundle), and stamped with a manifest, which in turn is placed in the system actor’s state. Filecoin clients (e.g. Lotus, Forest, Venus) load these bundles into their blockstores, and that bytecode becomes available during message execution.
Another significant change resulting from the Skyr upgrade is a reworking of the gas model. The network now charges gas for execution logic, performing accounting at the Wasm instruction level. It also charges for syscalls and externs. This results in higher gas-to-time fidelity, conforming to the baseline of 10 gas units per nanosecond of execution.
In addition, the Skyr upgrade also hardened other aspects of the Filecoin protocol. These changes included a new, more secure, version of the SnarkPack proof aggregation tool, a migration away from non-UTF-8 strings in chain state, and a fix to an off-by-one in Filecoin’s use of Distributed Randomness. A complete list of changes may be found here.
Testing & Auditing
Given the scope of changes in this upgrade, it was necessary to subject it to an extensive testing process. The FVM itself was tested by making it fully backwards-compatible with network versions 14 and 15. This allowed users to run experimental FVM-based canary nodes and report any observed issues. Various kinks were identified and ironed out through this process —so a big thank you to everyone who participated and contributed! Test vectors were also extracted from Filecoin mainnet itself, and used to validate the correctness of the FVM.
The new builtin-actors suite was the target of a 3-month sprint solely dedicated to writing unit and integration tests. The goal was to achieve testing parity with the now-deprecated specs-actors, with this milestone being achieved in May. In addition to checking for correctness of the actors themselves, this effort also crucially unlocked the ability to make changes to the actors without a high-risk of regression. This is a fundamental prerequisite to being able to quickly issue fixes in the future.
For more end-to-end testing, multiple test networks were spun up. During the active development phase, a “caterpillar” test network was created as needed — often several times a day. This network eventually metamorphosed into “butterflynet” - so named because it was a testnet used to catch bugs. After this period of rapid testing & deployment, Filecoin’s primary and long-lived test network, calibrationnet, was updated with the changes in the Skyr upgrade. Members of the community were also invited to participate in these networks, testing their various different node configurations on them, a contribution that was especially valuable for uncovering any platform-specific issues.
In addition to the testing efforts described above, the code itself was subject to multiple auditing efforts. The core team spun up an internal red team audit. Furthermore, two bug bounty programs ran from May 2022 to June 2022 (Gitcoin, Immunefi along with the Filecoin Security bug bounty, open to anyone in the community — thank you to everyone who submitted findings via these programs!
A more formal seven-week audit was conducted by independent contractor Alex Wade. This audit covered the entire scope of the FVM M1, and the audit dashboard can be found here. Potential security risks and minor issues were unearthed (and able to be resolved) thanks to this audit, giving an overall high confidence in the correctness of the changes.
The FVM core team is now fully focused and committed to working on Milestone 2.1 of the FVM: FEVM - which brings EVM smart contract deployments to the Filecoin network. This much anticipated milestone is possible thanks to the hypervisor-inspired, polyglot design of the FVM.
The prioritization of an EVM-compatible FVM was the result of listening to feedback from the talented web3 developer community. This feedback strongly suggested a preference to be able to leverage and reuse existing Ethereum and Solidity expertise to build on Filecoin. It also signaled a desire to be able to deploy battle-tested, standard EVM contracts like tokens, registries and more to the Filecoin network. Contracts with the capability to serve as building blocks for larger solutions like compute over data, Data DAOs, retrieval markets, smart, automated market deals and boundless other use cases..
Keeping to core open source values to meet developers where they are, this means full compatibility with existing EVM tools such as Hardhat, Foundry, Remix, Truffle and MetaMask is now a top priority for the FVM. An upcoming FVM Foundry Program (F/1) will also be open to applications shortly and will focus on bringing together a community of developers with EVM-compatible FVM use cases and skills, who want to take part in building out the future of FVM - so stay tuned if this is you!
Filecoin Virtual Machine native development will also continue in parallel, with core tooling and infrastructure pieces of the future WASM development experience being built out by the amazing developer teams from the FVM Foundry Early Builders Program (FVM Foundry F/0) and funded by an Open RFP Grant. These tools include a high-level Rust SDK, AssemblyScript and TinyGo SDKs, developer toolboxes, testing and debugging tools. The RFP Grant is also open to those wanting to help build the essential and integral rails of the native FVM - it takes a village!
The next phase of the FVM will also be supported by a dedicated FVM Testnet. Called Wallaby, this testnet will be run by dedicated storage providers and enable test transactions and market deals, smoothing the development path on FVM.
As is evident from this post, a lot of teams worked tirelessly to design, build, audit, test, and deploy the Skyr network upgrade. These include development and testing efforts from teams at ChainSafe, IPFS Force, Polyphene, and Protocol Labs EngRes; user (large scale) testing from the SPX group, the 1475 development team, and StorSwift (among others); everyone that participated in the bug bounties hosted on Immunefi and Gitcoin; Alex Wade’s auditing efforts; key ecosystem tooling and stakeholder support from Zondax; and the tireless coordination & planning work of the Filecoin Foundation;. Thanks to all of these individuals and teams, and to the countless passionate members of the community who were part of this milestone in multiple other ways. We hope you’re as excited to unlock full user programmability on Filecoin as we are and will continue on this journey with us!