From 88d892790b94769eb0e70c27a2fca7094eaab873 Mon Sep 17 00:00:00 2001 From: cryptoAtwill Date: Thu, 21 Dec 2023 17:01:25 +0800 Subject: [PATCH] fix latest changes --- Cargo.lock | 62 ++++++++++----------- ipc/cli/src/commands/subnet/list_subnets.rs | 4 +- ipc/provider/src/lotus/message/ipc.rs | 6 +- ipc/provider/src/lotus/message/tests.rs | 2 - ipc/provider/src/manager/evm/manager.rs | 13 +---- ipc/sdk/src/evm.rs | 17 +++--- ipc/sdk/src/gateway.rs | 9 --- 7 files changed, 46 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecfc7571..e2ce0581 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,9 +131,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" [[package]] name = "argon2" @@ -187,13 +187,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -673,7 +673,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -1369,7 +1369,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.41", + "syn 2.0.42", "toml 0.8.8", "walkdir", ] @@ -1387,7 +1387,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -1413,7 +1413,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.41", + "syn 2.0.42", "tempfile", "thiserror", "tiny-keccak", @@ -1586,7 +1586,7 @@ checksum = "ce8cd46a041ad005ab9c71263f9a0ff5b529eac0fe4cc9b4a20f4f0765d8cf4b" dependencies = [ "execute-command-tokens", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -1981,7 +1981,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2707,7 +2707,7 @@ dependencies = [ [[package]] name = "ipc_actors_abis" version = "0.1.0" -source = "git+https://github.com/consensus-shipyard/ipc-solidity-actors.git?branch=dev#3d2820c87c57f74098215bd2c0778ea5650d3013" +source = "git+https://github.com/consensus-shipyard/ipc-solidity-actors.git?branch=dev#db81df394db860fb339151bfe6b155e478fa8c99" dependencies = [ "anyhow", "ethers", @@ -3225,7 +3225,7 @@ dependencies = [ "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -3297,7 +3297,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -3509,7 +3509,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -3547,7 +3547,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -3574,9 +3574,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "poly1305" @@ -3635,7 +3635,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -4297,7 +4297,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -4331,7 +4331,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -4734,7 +4734,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -4776,9 +4776,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ "proc-macro2", "quote", @@ -4874,7 +4874,7 @@ checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -4966,7 +4966,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -5136,7 +5136,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -5392,7 +5392,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", "wasm-bindgen-shared", ] @@ -5426,7 +5426,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5709,7 +5709,7 @@ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -5729,7 +5729,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] diff --git a/ipc/cli/src/commands/subnet/list_subnets.rs b/ipc/cli/src/commands/subnet/list_subnets.rs index e0c4f208..3363933a 100644 --- a/ipc/cli/src/commands/subnet/list_subnets.rs +++ b/ipc/cli/src/commands/subnet/list_subnets.rs @@ -32,8 +32,8 @@ impl CommandLineHandler for ListSubnets { for (_, s) in ls.iter() { println!( - "{} - status: {:?}, collateral: {} FIL, circ.supply: {} FIL, genesis: {}", - s.id, s.status, s.stake, s.circ_supply, s.genesis_epoch + "{} - collateral: {} FIL, circ.supply: {} FIL, genesis: {}", + s.id, s.stake, s.circ_supply, s.genesis_epoch ); } diff --git a/ipc/provider/src/lotus/message/ipc.rs b/ipc/provider/src/lotus/message/ipc.rs index 0d8ef48b..74e48255 100644 --- a/ipc/provider/src/lotus/message/ipc.rs +++ b/ipc/provider/src/lotus/message/ipc.rs @@ -6,7 +6,6 @@ use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::MethodNum; use ipc_sdk::address::IPCAddress; -use ipc_sdk::gateway::Status; use ipc_sdk::subnet_id::SubnetID; use serde::{Deserialize, Serialize}; @@ -79,9 +78,6 @@ pub struct SubnetInfo { #[serde(deserialize_with = "deserialize_token_amount_from_str")] #[serde(serialize_with = "serialize_token_amount_to_atto")] pub circ_supply: TokenAmount, - /// State of the Subnet (Initialized, Active, Killed) - #[serde(rename(deserialize = "Status"))] - pub status: Status, pub genesis_epoch: ChainEpoch, } @@ -143,7 +139,7 @@ mod tests { #[test] fn deserialize_ipc_subnet_state() { let raw = r#" - {"Name":"test2","ParentID":{"Parent":"/r31415926","Actor":"t00"},"IPCGatewayAddr":"f064","Consensus":3,"MinValidatorStake":"1000000000000000000","TotalStake":"10000000000000000000","Stake":{"/":"bafy2bzacebentzoqaapingrxwknlxqcusl23rqaa7cwb42u76fgvb25nxpmhq"},"Status":1,"Genesis":null,"BottomUpCheckPeriod":10,"TopDownCheckPeriod":10,"GenesisEpoch":0,"CommittedCheckpoints":{"/":"bafy2bzaceamp42wmmgr2g2ymg46euououzfyck7szknvfacqscohrvaikwfay"},"ValidatorSet":{"validators":[{"addr":"t1cp4q4lqsdhob23ysywffg2tvbmar5cshia4rweq","net_addr":"test","weight":"10000000000000000000"}],"configuration_number":1},"MinValidators":1,"PreviousExecutedCheckpoint":{"/":"bafy2bzacedkoa623kvi5gfis2yks7xxjl73vg7xwbojz4tpq63dd5jpfz757i"},"BottomUpCheckpointVoting":{"GenesisEpoch":0,"SubmissionPeriod":10,"LastVotingExecuted":0,"ExecutableEpochQueue":null,"EpochVoteSubmission":{"/":"bafy2bzaceamp42wmmgr2g2ymg46euououzfyck7szknvfacqscohrvaikwfay"},"Ratio":{"Num":2,"Denom":3}}} + {"Name":"test2","ParentID":{"Parent":"/r31415926","Actor":"t00"},"IPCGatewayAddr":"f064","Consensus":3,"MinValidatorStake":"1000000000000000000","TotalStake":"10000000000000000000","Stake":{"/":"bafy2bzacebentzoqaapingrxwknlxqcusl23rqaa7cwb42u76fgvb25nxpmhq"},"Genesis":null,"BottomUpCheckPeriod":10,"TopDownCheckPeriod":10,"GenesisEpoch":0,"CommittedCheckpoints":{"/":"bafy2bzaceamp42wmmgr2g2ymg46euououzfyck7szknvfacqscohrvaikwfay"},"ValidatorSet":{"validators":[{"addr":"t1cp4q4lqsdhob23ysywffg2tvbmar5cshia4rweq","net_addr":"test","weight":"10000000000000000000"}],"configuration_number":1},"MinValidators":1,"PreviousExecutedCheckpoint":{"/":"bafy2bzacedkoa623kvi5gfis2yks7xxjl73vg7xwbojz4tpq63dd5jpfz757i"},"BottomUpCheckpointVoting":{"GenesisEpoch":0,"SubmissionPeriod":10,"LastVotingExecuted":0,"ExecutableEpochQueue":null,"EpochVoteSubmission":{"/":"bafy2bzaceamp42wmmgr2g2ymg46euououzfyck7szknvfacqscohrvaikwfay"},"Ratio":{"Num":2,"Denom":3}}} "#; let r = serde_json::from_str::(raw); diff --git a/ipc/provider/src/lotus/message/tests.rs b/ipc/provider/src/lotus/message/tests.rs index 055d1fab..69071dbb 100644 --- a/ipc/provider/src/lotus/message/tests.rs +++ b/ipc/provider/src/lotus/message/tests.rs @@ -1,7 +1,6 @@ // Copyright 2022-2023 Protocol Labs // SPDX-License-Identifier: MIT use fvm_shared::address::Address; -use ipc_sdk::gateway::Status; use std::str::FromStr; use crate::lotus::message::deserialize::{ @@ -129,7 +128,6 @@ fn test_subnet_info_to_str() { id: Default::default(), stake: Default::default(), circ_supply: Default::default(), - status: Status::Active, genesis_epoch: 0, }; diff --git a/ipc/provider/src/manager/evm/manager.rs b/ipc/provider/src/manager/evm/manager.rs index 81230837..ca454554 100644 --- a/ipc/provider/src/manager/evm/manager.rs +++ b/ipc/provider/src/manager/evm/manager.rs @@ -8,9 +8,9 @@ use std::time::Duration; use ethers_contract::{ContractError, EthLogDecode, LogMeta}; use ipc_actors_abis::{ - gateway_getter_facet, gateway_manager_facet, gateway_messenger_facet, gateway_router_facet, + gateway_getter_facet, gateway_manager_facet, gateway_messenger_facet, lib_gateway, lib_quorum, lib_staking_change_log, register_subnet_facet, - subnet_actor_getter_facet, subnet_actor_manager_facet, + subnet_actor_getter_facet, subnet_actor_manager_facet, bottom_up_router_facet, }; use ipc_sdk::evm::{fil_to_eth_amount, payload_to_evm_address, subnet_id_to_evm_addresses}; use ipc_sdk::validator::from_contract_validators; @@ -41,7 +41,6 @@ use ipc_sdk::checkpoint::{ BottomUpCheckpoint, BottomUpCheckpointBundle, BottomUpMsgBatch, QuorumReachedEvent, Signature, }; use ipc_sdk::cross::CrossMsg; -use ipc_sdk::gateway::Status; use ipc_sdk::staking::{StakingChangeRequest, ValidatorInfo, ValidatorStakingInfo}; use ipc_sdk::subnet::ConstructParams; use ipc_sdk::subnet_id::SubnetID; @@ -1070,7 +1069,7 @@ impl BottomUpCheckpointRelayer for EthSubnetManager { } async fn quorum_reached_events(&self, height: ChainEpoch) -> Result> { - let contract = gateway_router_facet::GatewayRouterFacet::new( + let contract = bottom_up_router_facet::BottomUpRouterFacet::new( self.ipc_contract_info.gateway_addr, Arc::new(self.ipc_contract_info.provider.clone()), ); @@ -1350,12 +1349,6 @@ impl TryFrom for SubnetInfo { stake: eth_to_fil_amount(&value.stake)?, circ_supply: eth_to_fil_amount(&value.circ_supply)?, genesis_epoch: value.genesis_epoch.as_u64() as ChainEpoch, - status: match value.status { - 1 => Status::Active, - 2 => Status::Inactive, - 3 => Status::Killed, - _ => return Err(anyhow!("invalid status: {:}", value.status)), - }, }) } } diff --git a/ipc/sdk/src/evm.rs b/ipc/sdk/src/evm.rs index 3ee8876b..7c178f23 100644 --- a/ipc/sdk/src/evm.rs +++ b/ipc/sdk/src/evm.rs @@ -20,8 +20,9 @@ use fvm_shared::clock::ChainEpoch; use fvm_shared::econ::TokenAmount; use fvm_shared::MethodNum; use ipc_actors_abis::{ - gateway_getter_facet, gateway_manager_facet, gateway_messenger_facet, gateway_router_facet, + gateway_getter_facet, gateway_manager_facet, gateway_messenger_facet, lib_gateway, register_subnet_facet, subnet_actor_getter_facet, subnet_actor_manager_facet, + bottom_up_router_facet, top_down_finality_facet }; /// The type conversion for IPC structs to evm solidity contracts. We need this convenient macro because @@ -201,7 +202,7 @@ macro_rules! bottom_up_type_conversion { }; } -base_type_conversion!(gateway_router_facet); +base_type_conversion!(bottom_up_router_facet); base_type_conversion!(subnet_actor_getter_facet); base_type_conversion!(gateway_manager_facet); base_type_conversion!(subnet_actor_manager_facet); @@ -210,7 +211,7 @@ base_type_conversion!(gateway_messenger_facet); base_type_conversion!(lib_gateway); cross_msg_types!(gateway_getter_facet); -cross_msg_types!(gateway_router_facet); +cross_msg_types!(bottom_up_router_facet); cross_msg_types!(gateway_messenger_facet); cross_msg_types!(subnet_actor_manager_facet); cross_msg_types!(lib_gateway); @@ -276,11 +277,11 @@ pub fn fil_to_eth_amount(amount: &TokenAmount) -> anyhow::Result { Ok(U256::from_dec_str(&str)?) } -impl TryFrom for gateway_router_facet::StakingChange { +impl TryFrom for top_down_finality_facet::StakingChange { type Error = anyhow::Error; fn try_from(value: StakingChange) -> Result { - Ok(gateway_router_facet::StakingChange { + Ok(top_down_finality_facet::StakingChange { op: value.op as u8, payload: ethers::core::types::Bytes::from(value.payload), validator: payload_to_evm_address(value.validator.payload())?, @@ -288,12 +289,12 @@ impl TryFrom for gateway_router_facet::StakingChange { } } -impl TryFrom for gateway_router_facet::StakingChangeRequest { +impl TryFrom for top_down_finality_facet::StakingChangeRequest { type Error = anyhow::Error; fn try_from(value: StakingChangeRequest) -> Result { - Ok(gateway_router_facet::StakingChangeRequest { - change: gateway_router_facet::StakingChange::try_from(value.change)?, + Ok(top_down_finality_facet::StakingChangeRequest { + change: top_down_finality_facet::StakingChange::try_from(value.change)?, configuration_number: value.configuration_number, }) } diff --git a/ipc/sdk/src/gateway.rs b/ipc/sdk/src/gateway.rs index 8eef8c52..14307f67 100644 --- a/ipc/sdk/src/gateway.rs +++ b/ipc/sdk/src/gateway.rs @@ -9,7 +9,6 @@ /// use crate::subnet_id::SubnetID; use cid::Cid; -use fvm_ipld_encoding::repr::{Deserialize_repr, Serialize_repr}; use fvm_ipld_encoding::tuple::{Deserialize_tuple, Serialize_tuple}; use fvm_shared::address::Address; @@ -29,11 +28,3 @@ pub struct PropagateParams { /// The postbox message cid pub postbox_cid: Cid, } - -#[derive(PartialEq, Eq, Clone, Copy, Debug, Deserialize_repr, Serialize_repr)] -#[repr(i32)] -pub enum Status { - Active, - Inactive, - Killed, -}