Skip to content

Commit 752c46e

Browse files
Stebalienshamb0
authored andcommitted
feat: add an embryo actor (filecoin-project#667)
The embryo actor: - Has no constructor (the system is expected to simply "set" the embryo code CID, not construct it). - Immediately aborts when called with a non-zero method. We could, alternatively, use some well-known "id" address. But it's nice to make this actual valid wasm.
1 parent a61bfde commit 752c46e

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

actors/embryo/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "fil_actor_embryo"
3+
description = "Builtin embryo actor for Filecoin"
4+
version = "10.0.0-alpha.1"
5+
license = "MIT OR Apache-2.0"
6+
authors = ["Protocol Labs", "Filecoin Core Devs"]
7+
edition = "2021"
8+
keywords = ["filecoin", "web3", "wasm"]
9+
10+
[lib]
11+
## lib is necessary for integration tests
12+
## cdylib is necessary for Wasm build
13+
crate-type = ["cdylib", "lib"]
14+
15+
[dependencies]
16+
fvm_sdk = { version = "3.0.0-alpha.2", optional = true }
17+
fvm_shared = { version = "3.0.0-alpha.1", optional = true }
18+
19+
[features]
20+
fil-actor = ["fvm_sdk", "fvm_shared"]

actors/embryo/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[cfg(feature = "fil-actor")]
2+
#[no_mangle]
3+
pub extern "C" fn invoke(_: u32) -> u32 {
4+
fvm_sdk::vm::abort(
5+
fvm_shared::error::ExitCode::USR_UNHANDLED_MESSAGE.value(),
6+
Some("embryo actors may only receive messages on method 0"),
7+
)
8+
}

runtime/src/test_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ lazy_static::lazy_static! {
9696
map.insert(*PAYCH_ACTOR_CODE_ID, ());
9797
map.insert(*MULTISIG_ACTOR_CODE_ID, ());
9898
map.insert(*MINER_ACTOR_CODE_ID, ());
99+
map.insert(*EMBRYO_ACTOR_CODE_ID, ());
100+
map.insert(*EVM_ACTOR_CODE_ID, ());
99101
map
100102
};
101103
}

0 commit comments

Comments
 (0)