Skip to content

Commit

Permalink
Integration test vm: runtime, testing facilities, first integration t…
Browse files Browse the repository at this point in the history
…est (#267)

* Most Integration test runtime methods implemented
* Invocation tracing
* Invocation expecation type for test matching
* VM constructor with singleton actors and good state
* First complete integration test

Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
  • Loading branch information
ZenGround0 and ZenGround0 committed Apr 28, 2022
1 parent a724a22 commit 5507b93
Show file tree
Hide file tree
Showing 8 changed files with 509 additions and 75 deletions.
1 change: 1 addition & 0 deletions actors/init/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ pub struct ExecReturn {
}

impl Cbor for ExecReturn {}
impl Cbor for ExecParams {}
1 change: 0 additions & 1 deletion actors/power/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ impl Actor {
})?;

let miner_actor_code_cid = rt.get_code_cid_for_type(Type::Miner);

let ext::init::ExecReturn { id_address, robust_address } = rt
.send(
*INIT_ACTOR_ADDR,
Expand Down
2 changes: 1 addition & 1 deletion actors/power/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub const CRON_QUEUE_HAMT_BITWIDTH: u32 = 6;
pub const CRON_QUEUE_AMT_BITWIDTH: u32 = 6;
pub const PROOF_VALIDATION_BATCH_AMT_BITWIDTH: u32 = 4;

#[derive(Serialize_tuple, Deserialize_tuple)]
#[derive(Serialize_tuple, Deserialize_tuple, Clone)]
pub struct CreateMinerParams {
pub owner: Address,
pub worker: Address,
Expand Down
2 changes: 1 addition & 1 deletion actors/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "System actors for the Filecoin protocol"
version = "8.0.0-alpha.1"
license = "MIT OR Apache-2.0"
authors = ["ChainSafe Systems <info@chainsafe.io>", "Protocol Labs", "Filecoin Core Devs"]
edition = "2018"
edition = "2021"
repository = "https://github.com/filecoin-project/builtin-actors"

[dependencies]
Expand Down
16 changes: 15 additions & 1 deletion actors/runtime/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ lazy_static! {
map.insert(*VERIFREG_ACTOR_CODE_ID, Type::VerifiedRegistry);
map
};
pub static ref ACTOR_CODES: BTreeMap<Type, Cid> = [
(Type::System, *SYSTEM_ACTOR_CODE_ID),
(Type::Init, *INIT_ACTOR_CODE_ID),
(Type::Cron, *CRON_ACTOR_CODE_ID),
(Type::Account, *ACCOUNT_ACTOR_CODE_ID),
(Type::Power, *POWER_ACTOR_CODE_ID),
(Type::Miner, *MINER_ACTOR_CODE_ID),
(Type::Market, *MARKET_ACTOR_CODE_ID),
(Type::PaymentChannel, *PAYCH_ACTOR_CODE_ID),
(Type::Multisig, *MULTISIG_ACTOR_CODE_ID),
(Type::Reward, *REWARD_ACTOR_CODE_ID),
(Type::VerifiedRegistry, *VERIFREG_ACTOR_CODE_ID),
]
.into_iter()
.collect();
pub static ref CALLER_TYPES_SIGNABLE: Vec<Cid> =
vec![*ACCOUNT_ACTOR_CODE_ID, *MULTISIG_ACTOR_CODE_ID];
pub static ref NON_SINGLETON_CODES: BTreeMap<Cid, ()> = {
Expand Down Expand Up @@ -1159,7 +1174,6 @@ impl RuntimePolicy for MockRuntime {
}

pub fn blake2b_256(data: &[u8]) -> [u8; 32] {
use std::convert::TryInto;
blake2b_simd::Params::new()
.hash_length(32)
.to_state()
Expand Down
Loading

0 comments on commit 5507b93

Please sign in to comment.