diff --git a/Cargo.lock b/Cargo.lock index 4fd9ca204..d181295ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1839,6 +1839,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "serde", + "vm_api", ] [[package]] diff --git a/state/Cargo.toml b/state/Cargo.toml index 58d9a838f..3b90b98b6 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -31,6 +31,8 @@ frc46_token = { workspace = true } fvm_shared = { workspace = true } fvm_ipld_encoding = { workspace = true } fvm_ipld_blockstore = { workspace = true } +vm_api = { workspace = true } + num-traits = { workspace = true } anyhow = { workspace = true } bimap = { workspace = true } diff --git a/state/src/check.rs b/state/src/check.rs index cba3dc325..4e359affc 100644 --- a/state/src/check.rs +++ b/state/src/check.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; use std::collections::HashMap; -use std::fmt::Debug; +use anyhow::anyhow; use anyhow::bail; use cid::Cid; use fil_actor_account::State as AccountState; @@ -20,26 +20,20 @@ use fil_actor_power::testing::MinerCronEvent; use fil_actor_power::State as PowerState; use fil_actor_reward::State as RewardState; use fil_actor_verifreg::{DataCap, State as VerifregState}; - use fil_actors_runtime::runtime::Policy; -use fil_actors_runtime::DEFAULT_HAMT_CONFIG; -use fil_actors_runtime::VERIFIED_REGISTRY_ACTOR_ADDR; - use fil_actors_runtime::Map; use fil_actors_runtime::MessageAccumulator; +use fil_actors_runtime::DEFAULT_HAMT_CONFIG; +use fil_actors_runtime::VERIFIED_REGISTRY_ACTOR_ADDR; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::from_slice; use fvm_ipld_encoding::CborStore; use fvm_shared::address::Address; use fvm_shared::address::Protocol; - use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use num_traits::Zero; -use anyhow::anyhow; -use fvm_ipld_encoding::tuple::*; - use fil_actor_account::testing as account; use fil_actor_cron::testing as cron; use fil_actor_datacap::testing as datacap; @@ -52,31 +46,14 @@ use fil_actor_power::testing as power; use fil_actor_reward::testing as reward; use fil_actor_verifreg::testing as verifreg; use fil_actors_runtime::runtime::builtins::Type; - -/// Value type of the top level of the state tree. -/// Represents the on-chain state of a single actor. -#[derive(Serialize_tuple, Deserialize_tuple, Clone, PartialEq, Eq, Debug)] -pub struct Actor { - /// CID representing the code associated with the actor - pub code: Cid, - /// CID of the head state object for the actor - pub head: Cid, - /// `call_seq_num` for the next message to be received by the actor (non-zero for accounts only) - pub call_seq_num: u64, - /// Token balance of the actor - pub balance: TokenAmount, - /// The actor's "predictable" address, if assigned. - /// - /// This field is set on actor creation and never modified. - pub address: Option
, -} +use vm_api::ActorState; /// A specialization of a map of ID-addresses to actor heads. pub struct Tree<'a, BS> where BS: Blockstore, { - pub map: Map<'a, BS, Actor>, + pub map: Map<'a, BS, ActorState>, pub store: &'a BS, } @@ -90,7 +67,7 @@ impl<'a, BS: Blockstore> Tree<'a, BS> { pub fn for_each