Skip to content

Commit 08e032e

Browse files
authored
feat: use a fil-actor feature instead of relying on the wasm target (#175)
This way, the actors can be bundled with other wasm software as libraries. fixes #109
1 parent 3117746 commit 08e032e

File tree

28 files changed

+102
-64
lines changed

28 files changed

+102
-64
lines changed

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ keywords = ["filecoin", "web3", "wasm"]
1010
exclude = ["examples", ".github"]
1111

1212
[target.'cfg(target_arch = "wasm32")'.dependencies]
13-
fil_actor_account = { version = "8.0.0-alpha.1", path = "./actors/account" }
14-
fil_actor_verifreg = { version = "8.0.0-alpha.1", path = "./actors/verifreg" }
15-
fil_actor_cron = { version = "8.0.0-alpha.1", path = "./actors/cron" }
16-
fil_actor_market = { version = "8.0.0-alpha.1", path = "./actors/market" }
17-
fil_actor_multisig = { version = "8.0.0-alpha.1", path = "./actors/multisig" }
18-
fil_actor_paych = { version = "8.0.0-alpha.1", path = "./actors/paych" }
19-
fil_actor_power = { version = "8.0.0-alpha.1", path = "./actors/power" }
20-
fil_actor_miner = { version = "8.0.0-alpha.1", path = "./actors/miner" }
21-
fil_actor_reward = { version = "8.0.0-alpha.1", path = "./actors/reward" }
22-
fil_actor_system = { version = "8.0.0-alpha.1", path = "./actors/system" }
23-
fil_actor_init = { version = "8.0.0-alpha.1", path = "./actors/init" }
24-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "./actors/runtime" }
13+
fil_actor_account = { version = "8.0.0-alpha.1", path = "./actors/account", features = ["fil-actor"] }
14+
fil_actor_verifreg = { version = "8.0.0-alpha.1", path = "./actors/verifreg", features = ["fil-actor"] }
15+
fil_actor_cron = { version = "8.0.0-alpha.1", path = "./actors/cron", features = ["fil-actor"] }
16+
fil_actor_market = { version = "8.0.0-alpha.1", path = "./actors/market", features = ["fil-actor"] }
17+
fil_actor_multisig = { version = "8.0.0-alpha.1", path = "./actors/multisig", features = ["fil-actor"] }
18+
fil_actor_paych = { version = "8.0.0-alpha.1", path = "./actors/paych", features = ["fil-actor"] }
19+
fil_actor_power = { version = "8.0.0-alpha.1", path = "./actors/power", features = ["fil-actor"] }
20+
fil_actor_miner = { version = "8.0.0-alpha.1", path = "./actors/miner", features = ["fil-actor"] }
21+
fil_actor_reward = { version = "8.0.0-alpha.1", path = "./actors/reward", features = ["fil-actor"] }
22+
fil_actor_system = { version = "8.0.0-alpha.1", path = "./actors/system", features = ["fil-actor"] }
23+
fil_actor_init = { version = "8.0.0-alpha.1", path = "./actors/init", features = ["fil-actor"] }
24+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "./actors/runtime", features = ["fil-actor"] }
2525

2626
[build-dependencies]
2727
fil_actor_bundler = { version = "2.0.0" }

actors/account/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["filecoin", "web3", "wasm"]
1313
crate-type = ["cdylib", "lib"]
1414

1515
[dependencies]
16-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime" }
16+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["fil-actor"] }
1717
fvm_shared = { version = "0.3.1", default-features = false }
1818
serde = { version = "1.0.136", features = ["derive"] }
1919
num-traits = "0.2.14"
@@ -22,3 +22,6 @@ num-derive = "0.3.3"
2222
[dev-dependencies]
2323
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["test_utils", "sector-default"] }
2424

25+
[features]
26+
fil-actor = []
27+

actors/account/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ use num_traits::FromPrimitive;
1111
use fil_actors_runtime::builtin::singletons::SYSTEM_ACTOR_ADDR;
1212
use fil_actors_runtime::cbor;
1313
use fil_actors_runtime::runtime::{ActorCode, Runtime};
14-
use fil_actors_runtime::{actor_error, wasm_trampoline, ActorError};
14+
use fil_actors_runtime::{actor_error, ActorError};
1515

1616
pub use self::state::State;
1717

1818
mod state;
1919

20-
wasm_trampoline!(Actor);
20+
#[cfg(feature = "fil-actor")]
21+
fil_actors_runtime::wasm_trampoline!(Actor);
2122

2223
// * Updated to specs-actors commit: 845089a6d2580e46055c24415a6c32ee688e5186 (v3.0.0)
2324

actors/cron/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ keywords = ["filecoin", "web3", "wasm"]
1414
crate-type = ["cdylib", "lib"]
1515

1616
[dependencies]
17-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime" }
17+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["fil-actor"] }
1818
fvm_shared = { version = "0.3.1", default-features = false }
1919
num-traits = "0.2.14"
2020
num-derive = "0.3.3"
@@ -23,3 +23,6 @@ serde = { version = "1.0.136", features = ["derive"] }
2323

2424
[dev-dependencies]
2525
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["test_utils", "sector-default"] }
26+
[features]
27+
fil-actor = []
28+

actors/cron/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0, MIT
33

44
use fil_actors_runtime::runtime::{ActorCode, Runtime};
5-
use fil_actors_runtime::{actor_error, cbor, wasm_trampoline, ActorError, SYSTEM_ACTOR_ADDR};
5+
use fil_actors_runtime::{actor_error, cbor, ActorError, SYSTEM_ACTOR_ADDR};
66
use fvm_shared::blockstore::Blockstore;
77
use fvm_shared::econ::TokenAmount;
88
use fvm_shared::encoding::tuple::*;
@@ -15,7 +15,8 @@ pub use self::state::{Entry, State};
1515

1616
mod state;
1717

18-
wasm_trampoline!(Actor);
18+
#[cfg(feature = "fil-actor")]
19+
fil_actors_runtime::wasm_trampoline!(Actor);
1920

2021
// * Updated to specs-actors commit: 845089a6d2580e46055c24415a6c32ee688e5186 (v3.0.0)
2122

actors/init/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ keywords = ["filecoin", "web3", "wasm"]
1414
crate-type = ["cdylib", "lib"]
1515

1616
[dependencies]
17-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime" }
17+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["fil-actor"] }
1818
fvm_shared = { version = "0.3.1", default-features = false }
1919
fvm_ipld_hamt = "0.3.0"
2020
serde = { version = "1.0.136", features = ["derive"] }
@@ -26,3 +26,6 @@ log = "0.4.14"
2626

2727
[dev-dependencies]
2828
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["test_utils", "sector-default"] }
29+
[features]
30+
fil-actor = []
31+

actors/init/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
use cid::Cid;
55
use fil_actors_runtime::runtime::{ActorCode, Runtime};
6-
use fil_actors_runtime::{
7-
actor_error, cbor, wasm_trampoline, ActorDowncast, ActorError, SYSTEM_ACTOR_ADDR,
8-
};
6+
use fil_actors_runtime::{actor_error, cbor, ActorDowncast, ActorError, SYSTEM_ACTOR_ADDR};
97
use fvm_shared::actor::builtin::Type;
108
use fvm_shared::address::Address;
119
use fvm_shared::blockstore::Blockstore;
@@ -21,7 +19,8 @@ pub use self::types::*;
2119
mod state;
2220
mod types;
2321

24-
wasm_trampoline!(Actor);
22+
#[cfg(feature = "fil-actor")]
23+
fil_actors_runtime::wasm_trampoline!(Actor);
2524

2625
// * Updated to specs-actors commit: 999e57a151cc7ada020ca2844b651499ab8c0dec (v3.0.1)
2726

actors/market/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ keywords = ["filecoin", "web3", "wasm"]
1414
crate-type = ["cdylib", "lib"]
1515

1616
[dependencies]
17-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime" }
17+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["fil-actor"] }
1818
fvm_ipld_hamt = "0.3.0"
1919
fvm_shared = { version = "0.3.1", default-features = false }
2020
fvm_ipld_bitfield = "0.4.0"
@@ -29,3 +29,6 @@ anyhow = "1.0.56"
2929
[dev-dependencies]
3030
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["test_utils", "sector-default"] }
3131
fvm_ipld_amt = { version = "0.3.0", features = ["go-interop"] }
32+
[features]
33+
fil-actor = []
34+

actors/market/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ use num_traits::{FromPrimitive, Signed, Zero};
2424
use fil_actors_runtime::cbor::serialize_vec;
2525
use fil_actors_runtime::runtime::{ActorCode, Runtime};
2626
use fil_actors_runtime::{
27-
actor_error, cbor, wasm_trampoline, ActorDowncast, ActorError, BURNT_FUNDS_ACTOR_ADDR,
28-
CRON_ACTOR_ADDR, REWARD_ACTOR_ADDR, STORAGE_POWER_ACTOR_ADDR, SYSTEM_ACTOR_ADDR,
29-
VERIFIED_REGISTRY_ACTOR_ADDR,
27+
actor_error, cbor, ActorDowncast, ActorError, BURNT_FUNDS_ACTOR_ADDR, CRON_ACTOR_ADDR,
28+
REWARD_ACTOR_ADDR, STORAGE_POWER_ACTOR_ADDR, SYSTEM_ACTOR_ADDR, VERIFIED_REGISTRY_ACTOR_ADDR,
3029
};
3130

3231
use crate::ext::verifreg::UseBytesParams;
@@ -44,7 +43,8 @@ mod policy;
4443
mod state;
4544
mod types;
4645

47-
wasm_trampoline!(Actor);
46+
#[cfg(feature = "fil-actor")]
47+
fil_actors_runtime::wasm_trampoline!(Actor);
4848

4949
fn request_miner_control_addrs<BS, RT>(
5050
rt: &mut RT,

actors/miner/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ keywords = ["filecoin", "web3", "wasm"]
1414
crate-type = ["cdylib", "lib"]
1515

1616
[dependencies]
17-
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime" }
17+
fil_actors_runtime = { version = "8.0.0-alpha.1", path = "../runtime", features = ["fil-actor"] }
1818
fvm_shared = { version = "0.3.1", default-features = false }
1919
fvm_ipld_bitfield = "0.4.0"
2020
fvm_ipld_amt = { version = "0.3.0", features = ["go-interop"] }
@@ -38,3 +38,6 @@ fil_actor_market = { version = "8.0.0-alpha.1", path = "../market" }
3838
rand = "0.8.5"
3939
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
4040
multihash = { version = "0.16.1", default-features = false }
41+
[features]
42+
fil-actor = []
43+

0 commit comments

Comments
 (0)