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

Move fil_actor_interface to forest shim #5001

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
8 changes: 8 additions & 0 deletions .config/forest.dic
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ codebase
codec
cron
crypto
CurrentEpoch
daemon
daemonize
Datacap
devnet
DB/S
deserialize/D
Expand All @@ -48,6 +50,7 @@ EOF
Ethereum
eth
exa
EVM
F3
FFI
FIL
Expand All @@ -62,6 +65,7 @@ hasher
healthcheck
implementor/SM
IPFS
ip
IPLD
JSON
JWT
Expand All @@ -81,6 +85,7 @@ multiaddr/SM
multihash
multisig
mutex
Open
OpenRPC
overallocation
P2P
Expand All @@ -92,6 +97,7 @@ performant
PoC
pointer/SM
PoSt
precommit
R2
RLP
RPC
Expand Down Expand Up @@ -126,8 +132,10 @@ UUID
validator/S
varint
verifier
verifreg
VM/SM
VRF
WebAssembly
WebSocket
WPoStProvingPeriodDeadlines
zstd
2 changes: 1 addition & 1 deletion .config/spellcheck.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lang = "en_US"
search_dirs = ["."]
skip_os_lookups = true
use_builtin = true
tokenization_splitchars = "\",;:.!?#(){}[]|/_-‒'`&@§¶…"
tokenization_splitchars = "\",;:.!?#(){}[]|/_-‒'`&@§¶…<>="
extra_dictionaries = ["forest.dic", "en_US.dic"]

[hunspell.quirks]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
- [#4704](https://github.com/ChainSafe/forest/issues/4704) Add support for the
`Filecoin.EthGetTransactionReceiptLimited` RPC method.

- [#4875](https://github.com/ChainSafe/forest/issues/4875) Move
fil-actor-interface crate from fil-actor-states repo.

### Changed

### Removed
Expand Down
37 changes: 3 additions & 34 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ ez-jsonrpc-types = "0.3"
fil_actor_account_state = { version = "17.0.3" }
fil_actor_cron_state = { version = "17.0.3" }
fil_actor_datacap_state = { version = "17.0.3" }
fil_actor_evm_state = { version = "17.0.3" }
fil_actor_init_state = { version = "17.0.3" }
fil_actor_interface = { version = "17.0.3" }
fil_actor_market_state = { version = "17.0.3" }
fil_actor_miner_state = { version = "17.0.3" }
fil_actor_multisig_state = { version = "17.0.3" }
fil_actor_power_state = { version = "17.0.3" }
fil_actor_reward_state = { version = "17.0.3" }
fil_actor_system_state = { version = "17.0.3" }
Expand Down Expand Up @@ -121,6 +122,7 @@ lru = "0.12"
memmap2 = "0.9"
memory-stats = "1"
multiaddr = "0.18"
multihash = { version = "0.18", features = ["identity"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multihash is re-exported from cid and can be accessed by cid::multihash, let's not add it to the deps

multimap = "0.10"
nom = "7"
nonzero_ext = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion src/fil_cns/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::chain_sync::collect_errs;
use crate::metrics::HistogramTimerExt;
use crate::networks::{ChainConfig, Height};
use crate::shim::actors::PowerActorStateLoad as _;
use crate::shim::actors_interface::power;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_iterface looks redundant when it's under shim, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll require a bit of reorg, but makes total sense. One less "abstraction" will hopefully lead to flattening the learning curve a bit.

use crate::shim::crypto::{
cid_to_replica_commitment_v1, verify_bls_sig, TICKET_RANDOMNESS_LOOKBACK,
};
Expand All @@ -23,7 +24,6 @@ use crate::shim::{
use crate::state_manager::StateManager;
use crate::utils::encoding::prover_id_from_u64;
use cid::Cid;
use fil_actor_interface::power;
use fil_actors_shared::filecoin_proofs_api::{post, PublicReplicaInfo, SectorId};
use fil_actors_shared::v10::runtime::DomainSeparationTag;
use futures::stream::FuturesUnordered;
Expand Down
2 changes: 1 addition & 1 deletion src/fil_cns/weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0, MIT

use crate::blocks::Tipset;
use crate::shim::actors_interface::power;
use crate::shim::state_tree::StateTree;
use fil_actor_interface::power;
use fvm_ipld_blockstore::Blockstore;
use num::{BigInt, Integer};
use num_traits::Zero;
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/fvm2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::chain::{index::ChainIndex, store::ChainStore};
use crate::interpreter::errors::Error;
use crate::interpreter::resolve_to_key_addr;
use crate::networks::ChainConfig;
use crate::shim::actors_interface::miner;
use crate::shim::{
actors::MinerActorStateLoad as _,
gas::{price_list_by_network_version, Gas, GasTracker},
Expand All @@ -18,7 +19,6 @@ use crate::shim::{
use crate::utils::encoding::from_slice_with_fallback;
use anyhow::bail;
use cid::Cid;
use fil_actor_interface::miner;
use fvm2::externs::{Consensus, Externs, Rand};
use fvm_ipld_blockstore::{
tracking::{BSStats, TrackingBlockstore},
Expand Down
3 changes: 2 additions & 1 deletion src/interpreter/fvm3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::chain::{
use crate::interpreter::errors::Error;
use crate::networks::ChainConfig;
use crate::shim::actors::MinerActorStateLoad as _;
use crate::shim::actors_interface::miner;
use crate::shim::{
address::Address, gas::price_list_by_network_version, state_tree::StateTree,
version::NetworkVersion,
Expand Down Expand Up @@ -97,7 +98,7 @@ impl<DB: Blockstore + Send + Sync + 'static> ForestExterns<DB> {

let tbs = TrackingBlockstore::new(&self.chain_index.db);

let ms = fil_actor_interface::miner::State::load(&tbs, actor.code, actor.state)?;
let ms = miner::State::load(&tbs, actor.code, actor.state)?;

let worker = ms.info(&tbs)?.worker.into();

Expand Down
3 changes: 2 additions & 1 deletion src/interpreter/fvm4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::chain::{
use crate::interpreter::errors::Error;
use crate::networks::{ChainConfig, Height, NetworkChain};
use crate::shim::actors::MinerActorStateLoad as _;
use crate::shim::actors_interface::miner;
use crate::shim::{
address::Address, gas::price_list_by_network_version, state_tree::StateTree,
version::NetworkVersion,
Expand Down Expand Up @@ -97,7 +98,7 @@ impl<DB: Blockstore + Send + Sync + 'static> ForestExterns<DB> {

let tbs = TrackingBlockstore::new(&self.chain_index.db);

let ms = fil_actor_interface::miner::State::load(&tbs, actor.code, actor.state)?;
let ms = miner::State::load(&tbs, actor.code, actor.state)?;

let worker = ms.info(&tbs)?.worker.into();

Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ mod fvm4;
mod vm;

use crate::shim::actors::AccountActorStateLoad as _;
use crate::shim::actors_interface::account;
use crate::shim::{
address::{Address, Protocol},
state_tree::StateTree,
};
use fil_actor_interface::account;
use fvm_ipld_blockstore::Blockstore;

pub use self::vm::*;
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::interpreter::{
use crate::message::ChainMessage;
use crate::message::Message as MessageTrait;
use crate::networks::{ChainConfig, NetworkChain};
use crate::shim::actors_interface::{cron, reward, AwardBlockRewardParams};
use crate::shim::{
address::Address,
econ::TokenAmount,
Expand All @@ -27,7 +28,6 @@ use crate::shim::{
use ahash::{HashMap, HashMapExt, HashSet};
use anyhow::bail;
use cid::Cid;
use fil_actor_interface::{cron, reward, AwardBlockRewardParams};
use fvm2::{
executor::{DefaultExecutor as DefaultExecutor_v2, Executor as Executor_v2},
machine::{
Expand Down
2 changes: 1 addition & 1 deletion src/lotus_json/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0, MIT

use super::*;
use crate::shim::actors_interface::verifreg::Allocation;
use ::cid::Cid;
use fil_actor_interface::verifreg::Allocation;
use fvm_shared4::clock::ChainEpoch;
use fvm_shared4::piece::PaddedPieceSize;
use fvm_shared4::ActorID;
Expand Down
2 changes: 1 addition & 1 deletion src/lotus_json/miner_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

use super::*;

use crate::shim::actors_interface::miner::MinerInfo;
use crate::{
rpc::types::AddressOrEmpty,
shim::{address::Address, clock::ChainEpoch, sector::SectorSize},
};
use fil_actor_interface::miner::MinerInfo;
use fil_actor_miner_state::v12::{BeneficiaryTerm, PendingBeneficiaryChange};
use fvm_ipld_encoding::BytesDe;
use libp2p::PeerId;
Expand Down
4 changes: 2 additions & 2 deletions src/lotus_json/miner_power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0, MIT

use super::*;
use fil_actor_interface::miner::MinerPower;
use fil_actor_interface::power::Claim;
use crate::shim::actors_interface::miner::MinerPower;
use crate::shim::actors_interface::power::Claim;

#[derive(Clone, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "PascalCase")]
Expand Down
6 changes: 3 additions & 3 deletions src/lotus_json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
//! - use [`proptest`](https://docs.rs/proptest/) to test the parser pipeline
//! - use a derive macro for simple compound structs

use crate::shim::actors_interface::miner::DeadlineInfo;
use derive_more::From;
use fil_actor_interface::miner::DeadlineInfo;
use fvm_shared4::piece::PaddedPieceSize;
use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema};
use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer};
Expand Down Expand Up @@ -225,11 +225,11 @@ mod bit_field; // fil_actors_shared::fvm_ipld_bitfield::BitField: !quickcheck::
mod hash_map;
mod ipld; // NaN != NaN
mod miner_info; // fil_actor_miner_state::v12::MinerInfo: !quickcheck::Arbitrary
mod miner_power; // fil_actor_interface::miner::MinerInfo: !quickcheck::Arbitrary
mod miner_power; // actors_interface::miner::MinerInfo: !quickcheck::Arbitrary
mod nonempty; // can't make snapshots of generic type
mod opt; // can't make snapshots of generic type
mod pending_beneficiary_change; // fil_actor_miner_state::v12::PendingBeneficiaryChange: !quickcheck::Arbitrary
mod power_claim; // fil_actor_interface::power::Claim: !quickcheck::Arbitrary
mod power_claim; // actors_interface::power::Claim: !quickcheck::Arbitrary
mod raw_bytes; // fvm_ipld_encoding::RawBytes: !quickcheck::Arbitrary
mod receipt; // shim type roundtrip is wrong - see module
mod vec; // can't make snapshots of generic type
Expand Down
2 changes: 1 addition & 1 deletion src/lotus_json/power_claim.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2019-2024 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fil_actor_interface::power::Claim;
use crate::shim::actors_interface::power::Claim;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion src/lotus_json/verifreg_claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::lotus_json::HasLotusJson;
use crate::rpc::types::ClaimLotusJson;
use fil_actor_interface::verifreg::Claim;
use crate::shim::actors_interface::verifreg::Claim;

impl HasLotusJson for Claim {
type LotusJson = ClaimLotusJson;
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::rpc::{ApiPaths, Ctx, Permission, RpcMethod};
use crate::shim::actors::eam;
use crate::shim::actors::is_evm_actor;
use crate::shim::actors::EVMActorStateLoad as _;
use crate::shim::actors_interface::evm;
use crate::shim::address::{Address as FilecoinAddress, Protocol};
use crate::shim::crypto::Signature;
use crate::shim::econ::{TokenAmount, BLOCK_GAS_LIMIT};
Expand Down Expand Up @@ -1924,8 +1925,7 @@ impl RpcMethod<2> for EthGetTransactionCount {
let state = StateTree::new_from_root(ctx.store_owned(), ts.parent_state())?;
let actor = state.get_required_actor(&addr)?;
if is_evm_actor(&actor.code) {
let evm_state =
fil_actor_interface::evm::State::load(ctx.store(), actor.code, actor.state)?;
let evm_state = evm::State::load(ctx.store(), actor.code, actor.state)?;
if !evm_state.is_alive() {
return Ok(EthUint64(0));
}
Expand Down
14 changes: 7 additions & 7 deletions src/rpc/methods/f3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ mod util;
pub use self::types::{F3Instant, F3LeaseManager, F3Manifest, F3PowerEntry, FinalityCertificate};
use self::{types::*, util::*};
use super::wallet::WalletSign;
use crate::shim::actors_interface::{
convert::{
from_policy_v13_to_v10, from_policy_v13_to_v11, from_policy_v13_to_v12,
from_policy_v13_to_v14, from_policy_v13_to_v15, from_policy_v13_to_v9,
},
miner, power,
};
use crate::{
blocks::Tipset,
chain::index::ResolveNullTipset,
Expand All @@ -29,13 +36,6 @@ use crate::{
};
use ahash::{HashMap, HashSet};
use anyhow::Context;
use fil_actor_interface::{
convert::{
from_policy_v13_to_v10, from_policy_v13_to_v11, from_policy_v13_to_v12,
from_policy_v13_to_v14, from_policy_v13_to_v15, from_policy_v13_to_v9,
},
miner, power,
};
use fvm_ipld_blockstore::Blockstore;
use jsonrpsee::core::{client::ClientT as _, params::ArrayParams};
use libp2p::PeerId;
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/methods/msig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::rpc::types::*;
use crate::rpc::{ApiPaths, Ctx, Permission, RpcMethod};
use crate::shim::actors::multisig::MultisigExt;
use crate::shim::actors::MultisigActorStateLoad as _;
use crate::shim::actors_interface::multisig;
use crate::shim::{address::Address, econ::TokenAmount};
use fil_actor_interface::multisig;
use fvm_ipld_blockstore::Blockstore;
use num_bigint::BigInt;

Expand Down
Loading
Loading