Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/integration/direct-onboarding' i…
Browse files Browse the repository at this point in the history
…nto feat/ddo-actor-events
  • Loading branch information
aarshkshah1992 committed Jan 23, 2024
2 parents c90fafe + e671d69 commit 78ec9f6
Show file tree
Hide file tree
Showing 44 changed files with 492 additions and 701 deletions.
76 changes: 41 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
[package]
name = "fil_builtin_actors_bundle"
description = "Bundle of FVM-compatible Wasm bytecode for Filecoin builtin actors"
[workspace]
resolver = "2"
members = [
"actors/*",
"state",
"runtime",
"test_vm",
"vm_api",
"integration_tests"
]

[workspace.package]
version = "12.0.0"
license = "MIT OR Apache-2.0"
authors = ["Protocol Labs", "Filecoin Core Devs"]
edition = "2021"
repository = "https://github.com/filecoin-project/builtin-actors"

[package]
name = "fil_builtin_actors_bundle"
description = "Bundle of FVM-compatible Wasm bytecode for Filecoin builtin actors"
version.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
authors = ["Protocol Labs", "Filecoin Core Devs"]
keywords = ["filecoin", "web3", "wasm"]
exclude = ["examples", ".github"]

Expand Down Expand Up @@ -49,17 +66,6 @@ devnet = []
testing = []
testing-fake-proofs = []

[workspace]
resolver = "2"
members = [
"actors/*",
"state",
"runtime",
"test_vm",
"vm_api",
"integration_tests"
]

[workspace.dependencies]
# Common
serde = { version = "1.0.136", features = ["derive"] }
Expand Down Expand Up @@ -124,28 +130,28 @@ fvm_ipld_amt = { version = "0.6.2" }
fvm_ipld_bitfield = "0.6.0"

# workspace
fil_actor_account = { version = "12.0.0", path = "actors/account" }
fil_actor_cron = { version = "12.0.0", path = "actors/cron" }
fil_actor_datacap = { version = "12.0.0", path = "actors/datacap" }
fil_actor_eam = { version = "12.0.0", path = "actors/eam" }
fil_actor_ethaccount = { version = "12.0.0", path = "actors/ethaccount" }
fil_actor_evm = { version = "12.0.0", path = "actors/evm" }
fil_actor_init = { version = "12.0.0", path = "actors/init" }
fil_actor_market = { version = "12.0.0", path = "actors/market" }
fil_actor_miner = { version = "12.0.0", path = "actors/miner" }
fil_actor_multisig = { version = "12.0.0", path = "actors/multisig" }
fil_actor_paych = { version = "12.0.0", path = "actors/paych" }
fil_actor_placeholder = { version = "12.0.0", path = "actors/placeholder" }
fil_actor_power = { version = "12.0.0", path = "actors/power" }
fil_actor_reward = { version = "12.0.0", path = "actors/reward" }
fil_actor_system = { version = "12.0.0", path = "actors/system" }
fil_actor_verifreg = { version = "12.0.0", path = "actors/verifreg" }
fil_actors_evm_shared = { version = "12.0.0", path = "actors/evm/shared" }
fil_actors_runtime = { version = "12.0.0", path = "runtime" }
fil_builtin_actors_state = { version = "12.0.0", path = "state"}
fil_actor_account = { path = "actors/account" }
fil_actor_cron = { path = "actors/cron" }
fil_actor_datacap = { path = "actors/datacap" }
fil_actor_eam = { path = "actors/eam" }
fil_actor_ethaccount = { path = "actors/ethaccount" }
fil_actor_evm = { path = "actors/evm" }
fil_actor_init = { path = "actors/init" }
fil_actor_market = { path = "actors/market" }
fil_actor_miner = { path = "actors/miner" }
fil_actor_multisig = { path = "actors/multisig" }
fil_actor_paych = { path = "actors/paych" }
fil_actor_placeholder = { path = "actors/placeholder" }
fil_actor_power = { path = "actors/power" }
fil_actor_reward = { path = "actors/reward" }
fil_actor_system = { path = "actors/system" }
fil_actor_verifreg = { path = "actors/verifreg" }
fil_actors_evm_shared = { path = "actors/evm/shared" }
fil_actors_runtime = { path = "runtime" }
fil_builtin_actors_state = { path = "state"}
fil_actors_integration_tests = { version = "1.0.0", path = "integration_tests" }
vm_api = { version = "1.0.0", path = "vm_api" }
test_vm = { version = "12.0.0", path = "test_vm" }
test_vm = { path = "test_vm" }

[patch.crates-io]
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
Expand Down
35 changes: 2 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
SHELL=/usr/bin/env bash

# How much to "bump" the version by on release.
BUMP ?= patch
VERSION ?= $(error VERSION environment variable must be set)

# Run cargo fmt
rustfmt:
cargo fmt --all --check
Expand All @@ -20,21 +16,6 @@ check:
test:
cargo test --workspace

# Release a new version. Specify the version "bump" with BUMP
bump-version: check-clean deps-release check
cargo set-version --workspace --bump $(BUMP)
cargo update --workspace
@echo "Bumped actors to version $$($(MAKE) --quiet version)"

set-version: check-clean deps-release check
cargo set-version --workspace $(VERSION)
cargo update --workspace
@echo "Set actors to version $(VERSION)"

# Publish the current version to crates.io
publish:
cargo workspaces publish --from-git

# Create a bundle in a deterministic location
bundle:
cargo run -- -o output/builtin-actors.car
Expand All @@ -61,24 +42,12 @@ bundle-testing:
BUILD_FIL_NETWORK=testing cargo run -- -o output/builtin-actors-testing.car
BUILD_FIL_NETWORK=testing-fake-proofs cargo run -- -o output/builtin-actors-testing-fake-proofs.car

.PHONY: all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing

# Check if the working tree is clean.
check-clean:
@git diff --quiet || { \
echo "Working tree dirty, please commit any changes first."; \
exit 1; \
}

# Check if we have the required deps.
deps-release:
@which cargo-set-version >/dev/null 2>&1 || { \
echo "Please install cargo-edit: 'cargo install cargo-edit'."; \
exit 1; \
}
@which cargo-workspaces >/dev/null 2>&1 || { \
echo "Please install cargo-workspaces: 'cargo install cargo-workspaces'."; \
exit 1; \
}

.PHONY: check check-clean deps deps-release deps-release test publish bump-version set-version bundle
.PHONY: rustfmt check check-clean test bundle
.PHONY: all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing
153 changes: 60 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Built-in Filecoin actors

This repo contains the code for the on-chain built-in actors that power the
Filecoin network starting from network version 16.
Filecoin network starting from network version 16, epoch 1960320 on 2022-07-06.

These actors are written in Rust and are designed to operate inside the
[Filecoin Virtual Machine](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0030.md).
Expand All @@ -12,15 +12,17 @@ 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](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0031.md).
As a result, this actor implementation will be the only one recognized by the network.
This codebase was canonicalized in [FIP-0031](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0031.md).
As a result, this actor implementation is the only one recognized by the network
from network version 16 onwards.

## Pre-FVM actors

Actors for the following network versions are provided as well:
Actors for the following network versions prior to nv16 are implemented here as
well:

- nv14 actors are provided to facilitate testing.
- nv15 actors are provided to enable the eventual nv15=>nv16 upgrade.
- nv14 actors to facilitate testing.
- nv15 actors to enable the nv15=>nv16 upgrade.

## Importable bundle

Expand All @@ -29,102 +31,65 @@ bundling all Wasm bytecode for all actors into a single file, with the following
characteristics:

- The CARv1 header points to a single root CID.
- The CID resolves to a Manifest data structure that associates code CIDs with
their corresponding built-in actor types.
- The Manifest payload should be interpreted as an IPLD `Map<Cid, i32>`. Every
entry represents a built-in actor.
- Manifest keys (CID) point to the Wasm bytecode of an actor as a single block.
- Manifest values (i32) identify the actor type, to be parsed as the
`runtime::builtins::Type` enum.
- The root CID resolves to a [DAG-CBOR](https://ipld.io/specs/codecs/dag-cbor/spec/)
encoded block defining a `Manifest` type (defined below) containing a version
number for the bundle format (currently always `1`) and a CID for a
`ManifestPayload`.
- The `ManifestPayload` (defined below) is contained within a DAG-CBOR encoded
block and defines a type that associates actor type names with their
corresponding CIDs.
- The CIDs for all actors are contained within the same CARv1 archive as
compiled Wasm bytecode contained within RAW blocks.

### Manifest [schema](https://ipld.io/docs/schemas/)

```ipldsch
# Manifest is encoded as: [version, CID]
type Manifest struct {
version Int
payload &ManifestPayload
} representation tuple
# ManifestPayload is encoded as: [ ["actorkey", CID], ["actorkey", CID], ... ]
#
# It alternatively may be interpreted as:
# type ManifestPayload {String : &ActorBytecode} representation listpairs
# Or simply as a list of tuples.
type ManifestPayload struct {
system &ActorBytecode
init &ActorBytecode
cron &ActorBytecode
account &ActorBytecode
storagepower &ActorBytecode
storageminer &ActorBytecode
storagemarket &ActorBytecode
paymentchannel &ActorBytecode
multisig &ActorBytecode
reward &ActorBytecode
verifiedregistry &ActorBytecode
datacap &ActorBytecode
placeholder &ActorBytecode
evm &ActorBytecode
eam &ActorBytecode
ethaccount &ActorBytecode
} representation listpairs
# RAW block
type ActorBytecode bytes
```

Precompiled actor bundles are provided as [release binaries][releases] in this repo. The
[`fil_builtin_actors_bundle`](https://crates.io/crates/fil_builtin_actors_bundle) crate on
[crates.io](https://crates.io) will not be updated.

[releases]: https://github.com/filecoin-project/builtin-actors/releases

## Releasing

We usually release all actors, the runtime, and the state abstraction at the same time. That means releasing:

- `fil_actors_runtime`
- `fil_actor_account`
- `fil_actor_cron`
- `fil_actor_init`
- `fil_actor_market`
- `fil_actor_miner`
- `fil_actor_multisig`
- `fil_actor_paych`
- `fil_actor_power`
- `fil_actor_reward`
- `fil_actor_system`
- `fil_actor_verifreg`
- `fil_builtin_actors_state`

We do not publish the "bundle" _crate_, but instead build it in CI and publish the bundle itself as a [release][releases].

To make this easier, we've added some helper scripts to the Makefile. Instructions follow.

### 1: Install Dependencies

Install:
We release all actors, the runtime, and the state abstraction at the same time by:

- `jq` (with your favorite package manager)
- `cargo-edit` (with `cargo install cargo-edit`).
1. Changing the `workspace.package.version` in the top-level `Cargo.toml` file.
2. Creating a [release][releases] in GitHub.

### 2: Bump Versions (Release)

You can bump the runtime, actors, and bundle versions with the `bump-version` target. See [Versioning](#versioning) to determine the correct version bump.

```bash
make bump-version
```

By default, this bumps the patch version. To bump to a different version, append, e.g. `BUMP=major`. Valid options are:

- `patch`
- `minor`
- `major`
- `alpha`
- `beta`
- `rc`

You can also _set_ a specific version with the `set-version` target.

```bash
make set-version VERSION=7.1.1
```

Commit the version changes:

```bash
git commit -a -m "Release $(make --quiet version)"
```

Finally, create a PR to commit your changes, make sure your PR is approved and merged before move to the next step!

### 3: Publish Crates

**NOTE:** If you're a not a member of the core FVM team, you'll need help with this step. Please
make a PR at this point and ask the core team to publish a release.

Run `make publish` to publish all crates to crates.io. This will likely take a while as it re-builds
everything from scratch for validation (multiple times).

**NOTE**: To do this, you'll need to:

1. Register an account with `https://crates.io` and confirm your email address (if you haven't already).
2. Login locally with `cargo login`.
3. Get yourself added to the [fvm-crate-owners](https://github.com/orgs/filecoin-project/teams/fvm-crate-owners) team.

### 4: Bump Versions (Alpha)

Finally, bump the versions to the next alpha and commit the changes:

```bash
make bump-version BUMP=alpha
git commit -a -m "Release $(make --quiet version)"
```
This will trigger an automatic bundle-build by GitHub CI, and the generated bundles will be attached to the GitHub release.

## Instructions for client implementations

Expand Down Expand Up @@ -222,3 +187,5 @@ Dual-licensed: [MIT](./LICENSE-MIT), [Apache Software License v2](./LICENSE-APAC

Except the EVM precompile [test data](actors/evm/precompile-testdata), which is licensed under the
LGPL v3 and not included in crates or build artifacts.

[releases]: https://github.com/filecoin-project/builtin-actors/releases
7 changes: 4 additions & 3 deletions actors/account/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "fil_actor_account"
description = "Builtin account actor for Filecoin"
version = "12.0.0"
license = "MIT OR Apache-2.0"
version.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
authors = ["ChainSafe Systems <info@chainsafe.io>", "Protocol Labs", "Filecoin Core Devs"]
edition = "2021"
keywords = ["filecoin", "web3", "wasm"]

[lib]
Expand Down
8 changes: 4 additions & 4 deletions actors/cron/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "fil_actor_cron"
description = "Builtin cron actor for Filecoin"
version = "12.0.0"
license = "MIT OR Apache-2.0"
version.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
authors = ["ChainSafe Systems <info@chainsafe.io>", "Protocol Labs", "Filecoin Core Devs"]
edition = "2021"
repository = "https://github.com/filecoin-project/builtin-actors"
keywords = ["filecoin", "web3", "wasm"]

[lib]
Expand Down
8 changes: 4 additions & 4 deletions actors/datacap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "fil_actor_datacap"
description = "Builtin data cap actor for Filecoin"
version = "12.0.0"
license = "MIT OR Apache-2.0"
version.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
authors = ["Protocol Labs", "Filecoin Core Devs"]
edition = "2018"
repository = "https://github.com/filecoin-project/builtin-actors"
keywords = ["filecoin", "web3", "wasm"]

[lib]
Expand Down
Loading

0 comments on commit 78ec9f6

Please sign in to comment.