Skip to content

Commit

Permalink
Revert "fix: fix incorrect MinerGetBaseInfo (#4617)" (#4627)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs authored Aug 7, 2024
1 parent 948da67 commit b8d5f3b
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 118 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scripts/tests/api_compare/filter-list
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion scripts/tests/api_compare/filter-list-offline
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
2 changes: 0 additions & 2 deletions src/fil_cns/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -392,7 +391,6 @@ fn verify_winning_post_proof<DB: Blockstore>(
&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(
Expand Down
70 changes: 0 additions & 70 deletions src/lotus_json/extended_sector_info.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/lotus_json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/rpc/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -503,8 +503,8 @@ pub struct MiningBaseInfo {
#[schemars(with = "LotusJson<StoragePower>")]
pub network_power: StoragePower,
#[serde(with = "crate::lotus_json")]
#[schemars(with = "LotusJson<Vec<ExtendedSectorInfo>>")]
pub sectors: Vec<ExtendedSectorInfo>,
#[schemars(with = "LotusJson<Vec<SectorInfo>>")]
pub sectors: Vec<SectorInfo>,
#[serde(with = "crate::lotus_json")]
#[schemars(with = "LotusJson<Address>")]
pub worker_key: Address,
Expand Down
30 changes: 0 additions & 30 deletions src/shim/sector.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -154,35 +153,6 @@ impl From<SectorInfo> 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<Cid>,
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::<cid::Cid>::arbitrary(g),
sealed_cid: cid::Cid::arbitrary(g),
}
}
}

#[derive(
serde::Serialize,
serde::Deserialize,
Expand Down
11 changes: 3 additions & 8 deletions src/state_manager/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -33,7 +33,7 @@ where
nv: NetworkVersion,
miner_address: &Address,
rand: Randomness,
) -> Result<Vec<ExtendedSectorInfo>, anyhow::Error> {
) -> Result<Vec<SectorInfo>, anyhow::Error> {
let store = self.blockstore();

let actor = self
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b8d5f3b

Please sign in to comment.