From 3406feb87dfb470e6a4ff400cfbc2a5e79123a83 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 29 Nov 2023 17:50:42 +0000 Subject: [PATCH] FIX: Fix lints, update test callers --- Cargo.lock | 8 +++---- .../testing/contract-test/src/ipc/registry.rs | 23 +++++++------------ .../testing/contract-test/src/ipc/subnet.rs | 2 +- .../contract-test/tests/staking/machine.rs | 2 +- fendermint/vm/actor_interface/src/ipc.rs | 6 ++--- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58b1aa89..234d9589 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4679,7 +4679,7 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "ipc-identity" version = "0.1.0" -source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#6a0d12b82682e6c289cb8fb2353b30fe2601e51e" +source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#28840fb77c5dc7c9869470962ac1d677754d3fe8" dependencies = [ "ahash 0.8.6", "anyhow", @@ -4706,7 +4706,7 @@ dependencies = [ [[package]] name = "ipc-provider" version = "0.1.0" -source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#6a0d12b82682e6c289cb8fb2353b30fe2601e51e" +source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#28840fb77c5dc7c9869470962ac1d677754d3fe8" dependencies = [ "anyhow", "async-channel", @@ -4746,7 +4746,7 @@ dependencies = [ [[package]] name = "ipc-sdk" version = "0.1.0" -source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#6a0d12b82682e6c289cb8fb2353b30fe2601e51e" +source = "git+https://github.com/consensus-shipyard/ipc.git?branch=dev#28840fb77c5dc7c9869470962ac1d677754d3fe8" dependencies = [ "anyhow", "cid", @@ -4770,7 +4770,7 @@ dependencies = [ [[package]] name = "ipc_actors_abis" version = "0.1.0" -source = "git+https://github.com/consensus-shipyard/ipc-solidity-actors.git?branch=dev#b01a2dffe367745f55111a65536a3f6fea9165f5" +source = "git+https://github.com/consensus-shipyard/ipc-solidity-actors.git?branch=dev#6f812b55a717a8b148c1b1b2b7db12aa330d5d84" dependencies = [ "anyhow", "ethers", diff --git a/fendermint/testing/contract-test/src/ipc/registry.rs b/fendermint/testing/contract-test/src/ipc/registry.rs index f404355b..e37b52f8 100644 --- a/fendermint/testing/contract-test/src/ipc/registry.rs +++ b/fendermint/testing/contract-test/src/ipc/registry.rs @@ -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 { addr: EthAddress, - registry: ContractCaller, SubnetRegistryErrors>, - _getter: ContractCaller, NoRevert>, - _manager: - ContractCaller, SubnetActorManagerFacetErrors>, + register: ContractCaller, SubnetRegistryDiamondErrors>, } impl Default for RegistryCaller { @@ -37,9 +32,7 @@ impl RegistryCaller { 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), } } @@ -58,7 +51,7 @@ impl RegistryCaller { params: SubnetConstructorParams, ) -> anyhow::Result { let addr = self - .registry + .register .call(state, |c| c.new_subnet_actor(params)) .context("failed to create new subnet")?; Ok(EthAddress(addr.0)) diff --git a/fendermint/testing/contract-test/src/ipc/subnet.rs b/fendermint/testing/contract-test/src/ipc/subnet.rs index 9bf8e58e..3c7b4275 100644 --- a/fendermint/testing/contract-test/src/ipc/subnet.rs +++ b/fendermint/testing/contract-test/src/ipc/subnet.rs @@ -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 { diff --git a/fendermint/testing/contract-test/tests/staking/machine.rs b/fendermint/testing/contract-test/tests/staking/machine.rs index d4ae458e..9bc6d63c 100644 --- a/fendermint/testing/contract-test/tests/staking/machine.rs +++ b/fendermint/testing/contract-test/tests/staking/machine.rs @@ -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, diff --git a/fendermint/vm/actor_interface/src/ipc.rs b/fendermint/vm/actor_interface/src/ipc.rs index b8f41f39..ccb3862d 100644 --- a/fendermint/vm/actor_interface/src/ipc.rs +++ b/fendermint/vm/actor_interface/src/ipc.rs @@ -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. @@ -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`. /// @@ -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! {