From b8d5f3bb5ee59ac81f06c0a1852ad8a8f0ffe64d Mon Sep 17 00:00:00 2001 From: Hubert Date: Wed, 7 Aug 2024 15:21:13 +0200 Subject: [PATCH] Revert "fix: fix incorrect `MinerGetBaseInfo` (#4617)" (#4627) --- CHANGELOG.md | 3 - scripts/tests/api_compare/filter-list | 1 + scripts/tests/api_compare/filter-list-offline | 3 +- src/fil_cns/validation.rs | 2 - src/lotus_json/extended_sector_info.rs | 70 ------------------- src/lotus_json/mod.rs | 1 - src/rpc/types/mod.rs | 6 +- src/shim/sector.rs | 30 -------- src/state_manager/utils.rs | 11 +-- 9 files changed, 9 insertions(+), 118 deletions(-) delete mode 100644 src/lotus_json/extended_sector_info.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index ef6f208ea9e7..78b48898ac91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,9 +64,6 @@ deserialisation in `Filecoin.EthGetBlockByNumber` and `Filecoin.EthGetBlockByHash` RPC methods. -- [#4610](https://github.com/ChainSafe/forest/issues/4610) Fixed incorrect - structure in the `Filecoin.MinerGetBaseInfo` RPC method. - ## Forest 0.19.2 "Eagle" Non-mandatory release that includes a fix for the Prometheus-incompatible diff --git a/scripts/tests/api_compare/filter-list b/scripts/tests/api_compare/filter-list index 0649721eea2c..22c0d94ad0ae 100644 --- a/scripts/tests/api_compare/filter-list +++ b/scripts/tests/api_compare/filter-list @@ -1,5 +1,6 @@ # This list contains potentially broken methods (or tests) that are ignored. # They should be considered bugged, and not used until the root cause is resolved. +!Filecoin.MinerGetBaseInfo # Internal Server Error on Lotus: https://github.com/ChainSafe/forest/actions/runs/8619017774/job/23623141130?pr=4170 !Filecoin.MpoolGetNonce # CustomCheckFailed in Forest: https://github.com/ChainSafe/forest/actions/runs/9593268587/job/26453560366 diff --git a/scripts/tests/api_compare/filter-list-offline b/scripts/tests/api_compare/filter-list-offline index 95f9f19a5062..122a001aeb72 100644 --- a/scripts/tests/api_compare/filter-list-offline +++ b/scripts/tests/api_compare/filter-list-offline @@ -1,5 +1,6 @@ # This list contains potentially broken methods (or tests) that are ignored. # They should be considered bugged, and not used until the root cause is resolved. +!Filecoin.MinerGetBaseInfo # Internal Server Error on Lotus: https://github.com/ChainSafe/forest/actions/runs/8619314467/job/23624081698 !Filecoin.MpoolGetNonce !Filecoin.EthSyncing @@ -19,4 +20,4 @@ !Filecoin.StateCirculatingSupply # The estimation is inaccurate only for offline RPC server, to be investigated: https://github.com/ChainSafe/forest/issues/4555 !Filecoin.EthEstimateGas -!eth_estimateGas +!eth_estimateGas \ No newline at end of file diff --git a/src/fil_cns/validation.rs b/src/fil_cns/validation.rs index 7b659f886f57..24a6f878e4c9 100644 --- a/src/fil_cns/validation.rs +++ b/src/fil_cns/validation.rs @@ -28,7 +28,6 @@ use fil_actors_shared::v10::runtime::DomainSeparationTag; use futures::stream::FuturesUnordered; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::{bytes_32, to_vec}; -use itertools::Itertools; use nunny::Vec as NonEmpty; use crate::fil_cns::{metrics, FilecoinConsensusError}; @@ -392,7 +391,6 @@ fn verify_winning_post_proof( &header.miner_address, Randomness::new(rand.to_vec()), ) - .map(|sectors| sectors.iter().map(Into::into).collect_vec()) .map_err(|e| FilecoinConsensusError::WinningPoStValidation(e.to_string()))?; verify_winning_post( diff --git a/src/lotus_json/extended_sector_info.rs b/src/lotus_json/extended_sector_info.rs deleted file mode 100644 index 45466578af9c..000000000000 --- a/src/lotus_json/extended_sector_info.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2019-2024 ChainSafe Systems -// SPDX-License-Identifier: Apache-2.0, MIT - -use super::*; -use crate::shim::sector::{ExtendedSectorInfo, RegisteredSealProof}; -use ::cid::Cid; - -#[derive(Serialize, Deserialize, JsonSchema)] -#[serde(rename_all = "PascalCase")] -#[schemars(rename = "ExtendedSectorInfo")] -pub struct ExtendedSectorInfoLotusJson { - #[schemars(with = "LotusJson")] - #[serde(with = "crate::lotus_json")] - seal_proof: RegisteredSealProof, - sector_number: u64, - #[schemars(with = "LotusJson>")] - #[serde(with = "crate::lotus_json")] - sector_key: Option, - #[schemars(with = "LotusJson")] - #[serde(with = "crate::lotus_json")] - sealed_c_i_d: Cid, -} - -impl HasLotusJson for ExtendedSectorInfo { - type LotusJson = ExtendedSectorInfoLotusJson; - - #[cfg(test)] - fn snapshots() -> Vec<(serde_json::Value, Self)> { - vec![( - json!({ - "SealProof": 0, - "SectorNumber": 0, - "SectorKey": null, - "SealedCID": { - "/": "baeaaaaa" - } - }), - Self { - proof: fvm_shared3::sector::RegisteredSealProof::StackedDRG2KiBV1.into(), - sector_number: 0, - sector_key: None, - sealed_cid: ::cid::Cid::default(), - }, - )] - } - - fn into_lotus_json(self) -> Self::LotusJson { - Self::LotusJson { - seal_proof: self.proof, - sector_number: self.sector_number, - sector_key: self.sector_key, - sealed_c_i_d: self.sealed_cid, - } - } - - fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { - let Self::LotusJson { - seal_proof, - sector_number, - sector_key, - sealed_c_i_d, - } = lotus_json; - Self { - proof: seal_proof, - sector_number, - sector_key, - sealed_cid: sealed_c_i_d, - } - } -} diff --git a/src/lotus_json/mod.rs b/src/lotus_json/mod.rs index 373be63e8a25..0107ee666d56 100644 --- a/src/lotus_json/mod.rs +++ b/src/lotus_json/mod.rs @@ -196,7 +196,6 @@ decl_and_test!( block_header for crate::blocks::CachingBlockHeader, cid for ::cid::Cid, election_proof for crate::blocks::ElectionProof, - extended_sector_info for crate::shim::sector::ExtendedSectorInfo, gossip_block for crate::blocks::GossipBlock, key_info for crate::key_management::KeyInfo, message for crate::shim::message::Message, diff --git a/src/rpc/types/mod.rs b/src/rpc/types/mod.rs index 123fac4ecb73..1a080f6a305c 100644 --- a/src/rpc/types/mod.rs +++ b/src/rpc/types/mod.rs @@ -25,7 +25,7 @@ use crate::shim::{ executor::Receipt, fvm_shared_latest::MethodNum, message::Message, - sector::{ExtendedSectorInfo, RegisteredSealProof, SectorNumber, StoragePower}, + sector::{RegisteredSealProof, SectorInfo, SectorNumber, StoragePower}, }; use cid::Cid; use fil_actor_interface::market::AllocationID; @@ -503,8 +503,8 @@ pub struct MiningBaseInfo { #[schemars(with = "LotusJson")] pub network_power: StoragePower, #[serde(with = "crate::lotus_json")] - #[schemars(with = "LotusJson>")] - pub sectors: Vec, + #[schemars(with = "LotusJson>")] + pub sectors: Vec, #[serde(with = "crate::lotus_json")] #[schemars(with = "LotusJson
")] pub worker_key: Address, diff --git a/src/shim/sector.rs b/src/shim/sector.rs index b3a333fcb7b8..794c99f17c16 100644 --- a/src/shim/sector.rs +++ b/src/shim/sector.rs @@ -1,7 +1,6 @@ // Copyright 2019-2024 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT -use cid::Cid; pub use fvm_shared3::sector::StoragePower; pub use fvm_shared3::sector::{ RegisteredPoStProof as RegisteredPoStProofV3, RegisteredSealProof as RegisteredSealProofV3, @@ -154,35 +153,6 @@ impl From for SectorInfoV2 { } } -/// Information about a sector necessary for PoSt verification -#[derive( - Eq, PartialEq, Debug, Clone, derive_more::From, derive_more::Into, Serialize, Deserialize, -)] -pub struct ExtendedSectorInfo { - pub proof: RegisteredSealProof, - pub sector_number: SectorNumber, - pub sector_key: Option, - pub sealed_cid: Cid, -} - -impl From<&ExtendedSectorInfo> for SectorInfo { - fn from(value: &ExtendedSectorInfo) -> SectorInfo { - SectorInfo::new(value.proof.into(), value.sector_number, value.sealed_cid) - } -} - -#[cfg(test)] -impl quickcheck::Arbitrary for ExtendedSectorInfo { - fn arbitrary(g: &mut quickcheck::Gen) -> Self { - Self { - proof: RegisteredSealProof::arbitrary(g), - sector_number: u64::arbitrary(g), - sector_key: Option::::arbitrary(g), - sealed_cid: cid::Cid::arbitrary(g), - } - } -} - #[derive( serde::Serialize, serde::Deserialize, diff --git a/src/state_manager/utils.rs b/src/state_manager/utils.rs index 6e82cfcd96cb..bc9a6b1024a0 100644 --- a/src/state_manager/utils.rs +++ b/src/state_manager/utils.rs @@ -5,7 +5,7 @@ use crate::shim::{ actors::{is_account_actor, is_ethaccount_actor, is_placeholder_actor}, address::{Address, Payload}, randomness::Randomness, - sector::{ExtendedSectorInfo, RegisteredPoStProof, RegisteredSealProof}, + sector::{RegisteredPoStProof, RegisteredSealProof, SectorInfo}, state_tree::ActorState, version::NetworkVersion, }; @@ -33,7 +33,7 @@ where nv: NetworkVersion, miner_address: &Address, rand: Randomness, - ) -> Result, anyhow::Error> { + ) -> Result, anyhow::Error> { let store = self.blockstore(); let actor = self @@ -102,12 +102,7 @@ where let out = sectors .into_iter() - .map(|s_info| ExtendedSectorInfo { - proof: s_info.seal_proof.into(), - sector_number: s_info.sector_number, - sector_key: s_info.sector_key_cid, - sealed_cid: s_info.sealed_cid, - }) + .map(|s_info| SectorInfo::new(*spt, s_info.sector_number, s_info.sealed_cid)) .collect(); Ok(out)