This repo contains the code for the on-chain built-in actors that power the Filecoin network starting from network version 16.
These actors are written in Rust and are designed to operate inside the Filecoin Virtual Machine. A reference implementation of the latter exists at filecoin-project/ref-fvm.
The build process of this repo compiles every actor into Wasm bytecode and generates an aggregate bundle to be imported by all clients. The structure of this bundle is standardized. Read below for details.
This codebase is on track to be canonicalized in FIP-0031. As a result, this actor implementation will be the only one recognized by the network.
Actors for the following network versions are provided as well:
The main output of this repo is a CARv1 archive bundling all Wasm bytecode for all actors into a single file, with the following characteristics:
Map<Cid, i32>
. Every
entry represents a built-in actor.fvm_shared::actor::builtin::Type
enum:
The CARv1 is embedded as a byte slice at the root of the library, and exported
under the BUNDLE_CAR
public const, for easier consumption by Rust code.
Precompiled actor bundles may also be provided as release binaries in this repo, if requested by implementors.
First install jq
(with your favorite package manager) and cargo-edit
(with cargo install
cargo-edit
).
To cut a new patch version, run:
bash
make release
To cut a major version, append BUMP=major
bash
make release BUMP=major
These commands will:
When you're happy, commit the version bump changes.
Run make publish
to publish all packages to crates.io. This will likely take a while as
it re-builds everything from scratch for validation (multiple times).
Finally, repeat the "release" step with make release BUMP=alpha
, and commit that.
There are two options:
Instructions to build from source (option 1):
cargo build
from the workspace root.
warning: bundle=/path/to/repo/target/debug/build/filecoin_canonical_actors_bundle-aef13b28a60e195b/out/bundle/bundle.car
All output is printed as a warning only due to limitations in the Cargo build
script mechanisms.Both options are compatible with automation via scripts or CI pipelines.
This part is implementation-specific. Options include:
Once the implementation has validated the authenticity of the bundle, it is expected to do the following:
Because every network version may be backed by different actor code, implementations should be ready to load multiple actor bundles and index them by network version.
When instantiating the ref-fvm Machine, both the network version and the corresponding Manifest root CID must be passed.
A fair question is how crate versioning relates to the protocol concept of
ActorVersion
. We adopt a policy similar to specs-actors:
ActorVersion
.0
.Development versions will use qualifiers such as -rc (release candidate).
As an example of application of this policy to a v10 actor version lineage:
This repo supersedes specs-actors, and fulfils two roles: - executable specification of built-in actors. - canonical, portable implementation of built-in actors.
This codebase was originally forked from the actors v6 implementation of the Forest client, and was adapted to the FVM environment.
Because this codebase is a common good across all Filecoin client implementations, it serves as a convergence area for all Core Devs regardless of the implementation or project they identify with.
Dual-licensed: MIT, Apache Software License v2, by way of the Permissive License Stack.