Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
FIX: Fix lints, update test callers
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Nov 29, 2023
1 parent 5aa5559 commit 3406feb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

23 changes: 8 additions & 15 deletions fendermint/testing/contract-test/src/ipc/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ use anyhow::Context;
use fendermint_vm_actor_interface::eam::EthAddress;
use fendermint_vm_actor_interface::init::builtin_actor_eth_addr;
use fendermint_vm_actor_interface::ipc::SUBNETREGISTRY_ACTOR_ID;
use fendermint_vm_interpreter::fvm::state::fevm::{ContractCaller, MockProvider, NoRevert};
use fendermint_vm_interpreter::fvm::state::fevm::{ContractCaller, MockProvider};
use fendermint_vm_interpreter::fvm::state::FvmExecState;
use fvm_ipld_blockstore::Blockstore;
use fvm_shared::ActorID;
use ipc_actors_abis::subnet_actor_getter_facet::SubnetActorGetterFacet;
use ipc_actors_abis::subnet_actor_manager_facet::{
SubnetActorManagerFacet, SubnetActorManagerFacetErrors,
};
use ipc_actors_abis::subnet_registry::{SubnetRegistry, SubnetRegistryErrors};
use ipc_actors_abis::subnet_registry_diamond::SubnetRegistryDiamondErrors;

pub use ipc_actors_abis::subnet_registry::ConstructorParams as SubnetConstructorParams;
pub use ipc_actors_abis::register_subnet_facet::{
ConstructorParams as SubnetConstructorParams, RegisterSubnetFacet,
};

#[derive(Clone)]
pub struct RegistryCaller<DB> {
addr: EthAddress,
registry: ContractCaller<DB, SubnetRegistry<MockProvider>, SubnetRegistryErrors>,
_getter: ContractCaller<DB, SubnetActorGetterFacet<MockProvider>, NoRevert>,
_manager:
ContractCaller<DB, SubnetActorManagerFacet<MockProvider>, SubnetActorManagerFacetErrors>,
register: ContractCaller<DB, RegisterSubnetFacet<MockProvider>, SubnetRegistryDiamondErrors>,
}

impl<DB> Default for RegistryCaller<DB> {
Expand All @@ -37,9 +32,7 @@ impl<DB> RegistryCaller<DB> {
let addr = builtin_actor_eth_addr(actor_id);
Self {
addr,
registry: ContractCaller::new(addr, SubnetRegistry::new),
_getter: ContractCaller::new(addr, SubnetActorGetterFacet::new),
_manager: ContractCaller::new(addr, SubnetActorManagerFacet::new),
register: ContractCaller::new(addr, RegisterSubnetFacet::new),
}
}

Expand All @@ -58,7 +51,7 @@ impl<DB: Blockstore> RegistryCaller<DB> {
params: SubnetConstructorParams,
) -> anyhow::Result<EthAddress> {
let addr = self
.registry
.register
.call(state, |c| c.new_subnet_actor(params))
.context("failed to create new subnet")?;
Ok(EthAddress(addr.0))
Expand Down
2 changes: 1 addition & 1 deletion fendermint/testing/contract-test/src/ipc/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use fvm_shared::econ::TokenAmount;
use ipc_actors_abis::subnet_actor_getter_facet::{self as getter, SubnetActorGetterFacet};
use ipc_actors_abis::subnet_actor_manager_facet::{self as manager, SubnetActorManagerFacet};

pub use ipc_actors_abis::subnet_registry::ConstructorParams as SubnetConstructorParams;
pub use ipc_actors_abis::register_subnet_facet::ConstructorParams as SubnetConstructorParams;

#[derive(Clone)]
pub struct SubnetCaller<DB> {
Expand Down
2 changes: 1 addition & 1 deletion fendermint/testing/contract-test/tests/staking/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl StateMachine for StakingMachine {

// TODO: Need to add field to specify release queue lock time.
let params = SubnetConstructorParams {
parent_id: ipc_actors_abis::subnet_registry::SubnetID { root, route },
parent_id: ipc_actors_abis::register_subnet_facet::SubnetID { root, route },
ipc_gateway_addr: gateway.addr().into(),
consensus: 0, // TODO: What are the options?
bottom_up_check_period: child_ipc.gateway.bottom_up_check_period,
Expand Down
6 changes: 3 additions & 3 deletions fendermint/vm/actor_interface/src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub mod gateway {

use crate::eam::EthAddress;

pub const CONTRACT_NAME: &'static str = "GatewayDiamond";
pub const CONTRACT_NAME: &str = "GatewayDiamond";
pub const METHOD_INVOKE_CONTRACT: u64 = crate::evm::Method::InvokeContract as u64;

// Constructor parameters aren't generated as part of the Rust bindings.
Expand Down Expand Up @@ -405,7 +405,7 @@ pub mod registry {

type FunctionSelector = [u8; 4];

pub const CONTRACT_NAME: &'static str = "SubnetRegistryDiamond";
pub const CONTRACT_NAME: &str = "SubnetRegistryDiamond";

/// Container type `ConstructorParameters`.
///
Expand All @@ -426,7 +426,7 @@ pub mod subnet {
use ipc_actors_abis::gateway_router_facet::GatewayRouterFacetErrors;
use ipc_actors_abis::subnet_actor_manager_facet::SubnetActorManagerFacetErrors;

pub const CONTRACT_NAME: &'static str = "SubnetActorDiamond";
pub const CONTRACT_NAME: &str = "SubnetActorDiamond";

// The subnet actor has its own errors, but it also invokes the gateway, which might revert for its own reasons.
revert_errors! {
Expand Down

0 comments on commit 3406feb

Please sign in to comment.