Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add devnet-wasm and wallaby networks with associated features to build scripts #504

Merged
merged 9 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
strategy:
matrix:
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs' ]
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs', 'wallaby', 'devnet-wasm' ]
steps:
- name: Checking out
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
strategy:
matrix:
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs' ]
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs', 'wallaby', 'devnet-wasm' ]
steps:
- name: Checking out
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ target
*.wasm
.idea/
**/.DS_Store
output/builtin-actors.car
output/*.car
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ members = [
]

[patch.crates-io]
## TODO point this to master
fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm" }
fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }

## Uncomment when working locally on ref-fvm and this repo simultaneously.
## Assumes the ref-fvm checkout is in a sibling directory with the same name.
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ bundle-calibrationnet: deps-build
bundle-devnet: deps-build
BUILD_FIL_NETWORK=devnet cargo run -- -o output/builtin-actors-devnet.car

bundle-wallaby: deps-build
BUILD_FIL_NETWORK=wallaby cargo run -- -o output/builtin-actors-wallaby.car

bundle-devnet-wasm: deps-build
BUILD_FIL_NETWORK=devnet-wasm cargo run -- -o output/builtin-actors-devnet-wasm.car

bundle-testing: deps-build
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
Expand Down
6 changes: 3 additions & 3 deletions actors/init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["filecoin", "web3", "wasm"]
crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime" }
fvm_shared = { version = "0.8.0", default-features = false }
fvm_ipld_hamt = "0.5.1"
serde = { version = "1.0.136", features = ["derive"] }
Expand All @@ -30,5 +30,5 @@ fvm_ipld_encoding = "0.2.2"
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["test_utils", "sector-default"] }

[features]
fil-actor = []
m2-native = []
fil-actor = ["fil_actors_runtime/fil-actor"]
m2-native = ["fil_actors_runtime/m2-native"]
2 changes: 1 addition & 1 deletion actors/init/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ where
}

#[cfg(feature = "m2-native")]
fn can_exec<BS, RT>(rt: &RT, caller: &Cid, exec: &Cid) -> bool
fn can_exec<BS, RT>(_rt: &RT, _caller: &Cid, _exec: &Cid) -> bool
where
BS: Blockstore,
RT: Runtime<BS>,
Expand Down
26 changes: 25 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ const ACTORS: &[(&Package, &ID)] = &[

const WASM_FEATURES: &[&str] = &["+bulk-memory", "+crt-static"];

/// Default Cargo features to activate during the build.
const DEFAULT_CARGO_FEATURES: &[&str] = &["fil-actor"];

/// Extra Cargo-level features to enable per network.
const EXTRA_CARGO_FEATURES: &[(&str, &[&str])] = &[
("devnet-wasm", &["m2-native"]),
/*("devnet-evm", &["m2-fevm"]),*/
("wallaby", &["m2-native"]),
];

const NETWORK_ENV: &str = "BUILD_FIL_NETWORK";

/// Returns the configured network name, checking both the environment and feature flags.
Expand All @@ -43,6 +53,10 @@ fn network_name() -> String {
Some("calibrationnet")
} else if cfg!(feature = "devnet") {
Some("devnet")
} else if cfg!(feature = "devnet-wasm") {
Some("devnet-wasm")
} else if cfg!(feature = "wallaby") {
Some("wallaby")
} else if cfg!(feature = "testing") {
Some("testing")
} else if cfg!(feature = "testing-fake-proofs") {
Expand Down Expand Up @@ -106,14 +120,24 @@ fn main() -> Result<(), Box<dyn Error>> {
WASM_FEATURES.iter().flat_map(|flag| ["-Ctarget-feature=", *flag, " "]).collect::<String>()
+ "-Clink-arg=--export-table";

// Compute Cargo features to apply.
let features = {
let extra = EXTRA_CARGO_FEATURES
.iter()
.find(|(k, _)| k == &network_name)
.map(|f| f.1)
.unwrap_or_default();
[DEFAULT_CARGO_FEATURES, extra].concat()
};

// Cargo build command for all actors at once.
let mut cmd = Command::new(&cargo);
cmd.arg("build")
.args(packages.iter().map(|pkg| "-p=".to_owned() + pkg))
.arg("--target=wasm32-unknown-unknown")
.arg("--profile=wasm")
.arg("--locked")
.arg("--features=fil-actor")
.arg("--features=".to_owned() + &features.join(","))
.arg("--manifest-path=".to_owned() + manifest_path.to_str().unwrap())
.env("RUSTFLAGS", rustflags)
.env(NETWORK_ENV, network_name)
Expand Down
41 changes: 20 additions & 21 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,33 @@ edition = "2021"
repository = "https://github.com/filecoin-project/builtin-actors"

[dependencies]
fvm_ipld_hamt = "0.5.1"
fvm_ipld_amt = { version = "0.4.2", features = ["go-interop"] }
fvm_shared = { version = "0.8.0", default-features = false }
num-traits = "0.2.14"
num-derive = "0.3.3"
serde = { version = "1.0.136", features = ["derive"] }
lazy_static = "1.4.0"
unsigned-varint = "0.7.1"
integer-encoding = { version = "3.0.3", default-features = false }
byteorder = "1.4.3"
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
base64 = "0.13.0"
log = "0.4.14"
indexmap = { version = "1.8.0", features = ["serde-1"] }
thiserror = "1.0.30"
# enforce wasm compat
getrandom = { version = "0.2.5", features = ["js"] }
hex = { version = "0.4.3", optional = true }
anyhow = "1.0.56"
fvm_sdk = { version = "2.0.0-alpha.1", optional = true }
base64 = "0.13.0"
blake2b_simd = "1.0"
byteorder = "1.4.3"
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
fvm_ipld_amt = { version = "0.4.2", features = ["go-interop"] }
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.2.2"
fvm_ipld_hamt = "0.5.1"
fvm_sdk = { version = "2.0.0-alpha.1", optional = true }
fvm_shared = { version = "0.8.0", default-features = false }
getrandom = { version = "0.2.5", features = ["js"] }
hex = { version = "0.4.3", optional = true }
indexmap = { version = "1.8.0", features = ["serde-1"] }
integer-encoding = { version = "3.0.3", default-features = false }
itertools = "0.10"
lazy_static = "1.4.0"
log = "0.4.14"
multihash = { version = "0.16.1", default-features = false }
num-derive = "0.3.3"
num-traits = "0.2.14"
rand = "0.8.5"
serde_repr = "0.1.8"
regex = "1"
itertools = "0.10"
serde = { version = "1.0.136", features = ["derive"] }
serde_repr = "0.1.8"
thiserror = "1.0.30"
unsigned-varint = "0.7.1"

[dependencies.sha2]
version = "0.10"
Expand Down
31 changes: 22 additions & 9 deletions runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
static NETWORKS: &[(&str, &[&str])] = &[
("mainnet", &["sector-32g", "sector-64g"]),
static NETWORKS: &[(&[&str], &[&str])] = &[
(&["mainnet"], &["sector-32g", "sector-64g"]),
(
"caterpillarnet",
&["caterpillarnet"],
&[
"sector-512m",
"sector-32g",
Expand All @@ -11,11 +11,14 @@ static NETWORKS: &[(&str, &[&str])] = &[
"min-power-2k",
],
),
("butterflynet", &["sector-512m", "sector-32g", "sector-64g", "min-power-2g"]),
("calibrationnet", &["sector-32g", "sector-64g", "min-power-32g"]),
("devnet", &["sector-2k", "sector-8m", "small-deals", "short-precommit", "min-power-2k"]),
(&["butterflynet", "wallaby"], &["sector-512m", "sector-32g", "sector-64g", "min-power-2g"]),
(&["calibrationnet"], &["sector-32g", "sector-64g", "min-power-32g"]),
(
"testing",
&["devnet", "devnet-wasm" /*devnet-fevm*/],
&["sector-2k", "sector-8m", "small-deals", "short-precommit", "min-power-2k"],
),
(
&["testing"],
&[
"sector-2k",
"sector-8m",
Expand All @@ -29,7 +32,7 @@ static NETWORKS: &[(&str, &[&str])] = &[
],
),
(
"testing-fake-proofs",
&["testing-fake-proofs"],
&[
"sector-2k",
"sector-8m",
Expand All @@ -46,12 +49,22 @@ static NETWORKS: &[(&str, &[&str])] = &[
];
const NETWORK_ENV: &str = "BUILD_FIL_NETWORK";

/// This build script enables _local_ compile features. These features do not
/// affect the dependency graph (they are not processed by Cargo). They are only
/// in effect for conditional compilation _in this crate_.
///
/// The reason we can't set these features as Cargo features from the root build
/// is that this crate is only ever used as a _transitive_ dependency from actor
/// crates.
///
/// So the only two options are: (a) actors crates set the features when
/// importing us as a dependency (super repetitive), or (b) this.
fn main() {
let network = std::env::var(NETWORK_ENV).ok();
println!("cargo:rerun-if-env-changed={}", NETWORK_ENV);

let network = network.as_deref().unwrap_or("mainnet");
let features = NETWORKS.iter().find(|(k, _)| k == &network).expect("unknown network").1;
let features = NETWORKS.iter().find(|(k, _)| k.contains(&network)).expect("unknown network").1;
for feature in features {
println!("cargo:rustc-cfg=feature=\"{}\"", feature);
}
Expand Down