From cc652738faa0c8e7d626d474e8e3838912ce0dcc Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Tue, 21 Nov 2023 16:55:35 +0100 Subject: [PATCH 1/7] [Feature] StateMinerFaults RPC. --- src/rpc/state_api.rs | 18 +++++++++++++++++- src/state_manager/mod.rs | 25 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/rpc/state_api.rs b/src/rpc/state_api.rs index 6f73a9e9aefb..e7b747b35d00 100644 --- a/src/rpc/state_api.rs +++ b/src/rpc/state_api.rs @@ -18,8 +18,9 @@ use crate::utils::db::car_stream::{CarBlock, CarWriter}; use ahash::{HashMap, HashMapExt}; use anyhow::Context as _; use cid::Cid; -use fil_actor_interface::market; use fil_actor_interface::miner::MinerPower; +use fil_actor_interface::{market, miner}; +use fil_actors_shared::fvm_ipld_bitfield::BitField; use futures::StreamExt; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::{CborStore, DAG_CBOR}; @@ -159,6 +160,21 @@ pub(in crate::rpc) async fn state_miner_power( + data: Data>, + Params(LotusJson((address, key))): Params>, +) -> Result, JsonRpcError> { + let ts = data + .state_manager + .chain_store() + .load_required_tipset(&key)?; + + data.state_manager + .miner_faults(&address, &ts) + .map_err(|e| e.into()) +} + /// returns the message receipt for the given message pub(in crate::rpc) async fn state_get_receipt( data: Data>, diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 6f8e67a8182b..406a0cd9be5d 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -39,6 +39,7 @@ use cid::Cid; use fil_actor_interface::miner::MinerPower; use fil_actor_interface::*; use fil_actors_shared::fvm_ipld_amt::Amtv0 as Amt; +use fil_actors_shared::fvm_ipld_bitfield::BitField; use fil_actors_shared::v10::runtime::Policy; use futures::{channel::oneshot, select, FutureExt}; use fvm_ipld_blockstore::Blockstore; @@ -979,6 +980,30 @@ where Ok(out) } + /// Retrieves miner faules. + pub fn miner_faults( + self: &Arc, + addr: &Address, + ts: &Arc, + ) -> Result, Error> { + let actor = self + .get_actor(addr, *ts.parent_state())? + .ok_or_else(|| Error::State("Miner actor not found".to_string()))?; + + let state = miner::State::load(self.blockstore(), actor.code, actor.state)?; + + let mut faults = Vec::new(); + + state.for_each_deadline(&self.chain_config.policy, self.blockstore(), |_, part| { + part.for_each(self.blockstore(), |_, dl| { + faults.push(dl.faulty_sectors().clone()); + Ok(()) + }) + })?; + + Ok(faults) + } + /// Retrieves miner power. pub fn miner_power( self: &Arc, From 7343cb981acc0f192aa9b21cff31c6bb3e657765 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Wed, 22 Nov 2023 21:42:35 +0100 Subject: [PATCH 2/7] LotusJson for bitfield --- Cargo.lock | 56 ++++++++++++++++----------------- Cargo.toml | 24 +++++++------- src/lotus_json/mod.rs | 15 +++++++++ src/rpc/mod.rs | 1 + src/rpc/state_api.rs | 3 +- src/rpc_api/mod.rs | 2 ++ src/rpc_client/state_ops.rs | 5 +++ src/tool/subcommands/api_cmd.rs | 4 +++ 8 files changed, 69 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2466ae35757..1d403cf3fb48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2594,9 +2594,9 @@ checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] name = "fil_actor_account_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26758f9bd8fb19d872de75a06995d3c1ad3ed0677c919f5bcd62907b85b9287" +checksum = "b3fe4827aa8f513e7df10f142341246f4d5574fa050a1da1763e7ed173f7b4e1" dependencies = [ "frc42_macros", "fvm_ipld_encoding", @@ -2610,9 +2610,9 @@ dependencies = [ [[package]] name = "fil_actor_cron_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86e30a339541cdd9edd33d7106e32cacddf958413330bd949a96b85e6689ba6" +checksum = "9d57e69fe90132c026a31b71191f4501ac7c3645b83854672dbf3502b5e3983a" dependencies = [ "fvm_ipld_encoding", "fvm_shared 2.6.0", @@ -2625,9 +2625,9 @@ dependencies = [ [[package]] name = "fil_actor_datacap_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d52b366121b061f9ca3995797e8f47a69b33e0d780c37f7a3ef3cf298a7931" +checksum = "6abab42040150c617ea11ce078a022768deb411fc6997948365ac5a71c315839" dependencies = [ "fil_actors_shared", "frc42_macros", @@ -2643,9 +2643,9 @@ dependencies = [ [[package]] name = "fil_actor_evm_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bbca942270477512a9a75d55eb065e9d4eb8b5088b324b7ed063d53f6d310ee" +checksum = "cdca6fdc2958ec10d2df91187040e133c1082e549e76dd48485f3d376fc5fe38" dependencies = [ "cid", "fil_actors_shared", @@ -2663,9 +2663,9 @@ dependencies = [ [[package]] name = "fil_actor_init_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9581482b6b6f10d636442dfaec3b8e7e55752b4000dec2abdbb094c0444be61e" +checksum = "dcb07a69e8592b1a0c0ff3df5861d3e96948889ca5bb7bd8806b53e17cd84ee0" dependencies = [ "anyhow", "cid", @@ -2684,9 +2684,9 @@ dependencies = [ [[package]] name = "fil_actor_interface" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c14f9f27c10e10a5c992d79401c5e64b857cf0e0e3589925dc58240d0671d96" +checksum = "da58b3554350a2d853d7f04d2d4086e0d71f2dd325a65f32a90e793453570284" dependencies = [ "anyhow", "cid", @@ -2720,9 +2720,9 @@ dependencies = [ [[package]] name = "fil_actor_market_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b8c1e3c0806b48160aca82a025818f321e9dab6e55b5fd38e5fee382d470574" +checksum = "761799579c53e74a107288cb1c7874f8da1677fee60a4df2bb5b99b72c0fff95" dependencies = [ "anyhow", "cid", @@ -2745,9 +2745,9 @@ dependencies = [ [[package]] name = "fil_actor_miner_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50edf04f697a61e2b4d578cca54f6e4fdcd5d4643c87bf2b5667fe9c3a4d5a8" +checksum = "e01910375f1a88f1826f84ceca2825b00527fcbb07892f244c28c4b3692463e6" dependencies = [ "anyhow", "bitflags 2.4.1", @@ -2775,9 +2775,9 @@ dependencies = [ [[package]] name = "fil_actor_multisig_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5443f596e3c78c6eb96a333dad78b190c3223caf6b6847cdfb13aac0329052" +checksum = "36fd0ae1ea98c86103ac736d6c490ec5ccaff6183bf21a2c10766c497ab8ed8e" dependencies = [ "anyhow", "cid", @@ -2798,9 +2798,9 @@ dependencies = [ [[package]] name = "fil_actor_power_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ebf5d9559c7c04695e41a33eb08833d62c0ae9348e6aa9af347bd0941a8e7e" +checksum = "3dbc73f2dbcc2551eb8496aea427c8b1b473a0d2188605603d26b9bb03495e02" dependencies = [ "anyhow", "cid", @@ -2821,9 +2821,9 @@ dependencies = [ [[package]] name = "fil_actor_reward_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b0b3db9fdbc9283e5f5515e378bf6d45ee1e7db9ce69c52d7d60e2d984f2b5" +checksum = "7743862635f6ca852803f42e2af55df9a54a719931b359761e05fc0d1d70ec07" dependencies = [ "fvm_ipld_encoding", "fvm_shared 2.6.0", @@ -2837,9 +2837,9 @@ dependencies = [ [[package]] name = "fil_actor_system_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca9a1724270fc87f25afd0a87ff1b1fa6c76af8d6ccf24b0a3bff935c7281ca" +checksum = "fe168e5bfe8edd800932704dc9c140f1e99b90c98f3d4b2a614c0c5d74c203be" dependencies = [ "cid", "fvm_ipld_encoding", @@ -2852,9 +2852,9 @@ dependencies = [ [[package]] name = "fil_actor_verifreg_state" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd089e0bb5abeb7466a674ec4d82b6cdcc4b96723f7e72d067d4b0dcb2c5cf28" +checksum = "f39168d9136f0eba9c36349dd51900ca255d6485f2512f20a0501e8fe25863c3" dependencies = [ "anyhow", "cid", @@ -2872,9 +2872,9 @@ dependencies = [ [[package]] name = "fil_actors_shared" -version = "7.0.0-rc.5" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ac590f3a0ae4c6af4efd4ddc0f98b3150e801beb511e2a1835db2b204b03e3" +checksum = "b41ab92dd8ec5a4b1b5cf4a12946c70c927ac6f7fcca21fb913b4db05d6b90c8" dependencies = [ "anyhow", "cid", diff --git a/Cargo.toml b/Cargo.toml index efa832d3cbee..2a7153742d84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,18 +51,18 @@ derive_more = "0.99.17" dialoguer = "0.11" digest = "0.10.5" directories = "5" -fil_actor_account_state = "7.0.0-rc.5" -fil_actor_cron_state = "7.0.0-rc.5" -fil_actor_datacap_state = "7.0.0-rc.5" -fil_actor_init_state = "7.0.0-rc.5" -fil_actor_interface = "7.0.0-rc.5" -fil_actor_market_state = "7.0.0-rc.5" -fil_actor_miner_state = "7.0.0-rc.5" -fil_actor_power_state = "7.0.0-rc.5" -fil_actor_reward_state = "7.0.0-rc.5" -fil_actor_system_state = "7.0.0-rc.5" -fil_actor_verifreg_state = "7.0.0-rc.5" -fil_actors_shared = "7.0.0-rc.5" +fil_actor_account_state = "7.0.0" +fil_actor_cron_state = "7.0.0" +fil_actor_datacap_state = "7.0.0" +fil_actor_init_state = "7.0.0" +fil_actor_interface = "7.0.0" +fil_actor_market_state = "7.0.0" +fil_actor_miner_state = "7.0.0" +fil_actor_power_state = "7.0.0" +fil_actor_reward_state = "7.0.0" +fil_actor_system_state = "7.0.0" +fil_actor_verifreg_state = "7.0.0" +fil_actors_shared = { version = "7.0.0", features = ["json"]} filecoin-proofs-api = { version = "16.0", default-features = false } flume = "0.11" fs_extra = "1.2" diff --git a/src/lotus_json/mod.rs b/src/lotus_json/mod.rs index 3ecb31c89e6d..85c723d8c693 100644 --- a/src/lotus_json/mod.rs +++ b/src/lotus_json/mod.rs @@ -124,6 +124,8 @@ use crate::ipld::{json::IpldJson, Ipld}; use derive_more::From; use fil_actor_interface::power::Claim; +use fil_actors_shared::fvm_ipld_bitfield::json::BitFieldJson; +use fil_actors_shared::fvm_ipld_bitfield::BitField; use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer}; use serde_json::json; use std::{fmt::Display, str::FromStr}; @@ -503,3 +505,16 @@ impl HasLotusJson for Ipld { lotus_json.0 } } + +impl HasLotusJson for BitField { + type LotusJson = BitFieldJson; + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![] + } + fn into_lotus_json(self) -> Self::LotusJson { + BitFieldJson(self) + } + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + lotus_json.0 + } +} diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs index 0d584d4b1dd7..66df524e7da1 100644 --- a/src/rpc/mod.rs +++ b/src/rpc/mod.rs @@ -113,6 +113,7 @@ where .with_method(STATE_GET_ACTOR, state_get_actor::) .with_method(STATE_MARKET_BALANCE, state_market_balance::) .with_method(STATE_MARKET_DEALS, state_market_deals::) + .with_method(STATE_MINER_FAULTS, state_miner_faults::) .with_method(STATE_MINER_POWER, state_miner_power::) .with_method(STATE_GET_RECEIPT, state_get_receipt::) .with_method(STATE_WAIT_MSG, state_wait_msg::) diff --git a/src/rpc/state_api.rs b/src/rpc/state_api.rs index e7b747b35d00..e007b2c8ac1d 100644 --- a/src/rpc/state_api.rs +++ b/src/rpc/state_api.rs @@ -18,8 +18,8 @@ use crate::utils::db::car_stream::{CarBlock, CarWriter}; use ahash::{HashMap, HashMapExt}; use anyhow::Context as _; use cid::Cid; +use fil_actor_interface::market; use fil_actor_interface::miner::MinerPower; -use fil_actor_interface::{market, miner}; use fil_actors_shared::fvm_ipld_bitfield::BitField; use futures::StreamExt; use fvm_ipld_blockstore::Blockstore; @@ -173,6 +173,7 @@ pub(in crate::rpc) async fn state_miner_faults> = Lazy::new(|| { access.insert(state_api::STATE_GET_ACTOR, Access::Read); access.insert(state_api::STATE_MARKET_BALANCE, Access::Read); access.insert(state_api::STATE_MARKET_DEALS, Access::Read); + access.insert(state_api::STATE_MINER_FAULTS, Access::Read); access.insert(state_api::STATE_MINER_POWER, Access::Read); access.insert(state_api::STATE_GET_RECEIPT, Access::Read); access.insert(state_api::STATE_WAIT_MSG, Access::Read); @@ -230,6 +231,7 @@ pub mod state_api { pub const STATE_GET_ACTOR: &str = "Filecoin.StateGetActor"; pub const STATE_MARKET_BALANCE: &str = "Filecoin.StateMarketBalance"; pub const STATE_MARKET_DEALS: &str = "Filecoin.StateMarketDeals"; + pub const STATE_MINER_FAULTS: &str = "Filecoin.StateMinerFaults"; pub const STATE_MINER_POWER: &str = "Filecoin.StateMinerPower"; pub const STATE_GET_RECEIPT: &str = "Filecoin.StateGetReceipt"; pub const STATE_WAIT_MSG: &str = "Filecoin.StateWaitMsg"; diff --git a/src/rpc_client/state_ops.rs b/src/rpc_client/state_ops.rs index 6dace3406239..255ec7ae1040 100644 --- a/src/rpc_client/state_ops.rs +++ b/src/rpc_client/state_ops.rs @@ -16,6 +16,7 @@ use crate::{ }; use cid::Cid; use fil_actor_interface::miner::MinerPower; +use fil_actors_shared::fvm_ipld_bitfield::BitField; use fil_actors_shared::v10::runtime::DomainSeparationTag; use libipld_core::ipld::Ipld; @@ -57,6 +58,10 @@ impl ApiInfo { RpcRequest::new(STATE_NETWORK_NAME, ()) } + pub fn state_miner_faults_req(miner: Address, tsk: TipsetKeys) -> RpcRequest> { + RpcRequest::new(STATE_MINER_FAULTS, (miner, tsk)) + } + pub fn state_miner_power_req(miner: Address, tsk: TipsetKeys) -> RpcRequest { RpcRequest::new(STATE_MINER_POWER, (miner, tsk)) } diff --git a/src/tool/subcommands/api_cmd.rs b/src/tool/subcommands/api_cmd.rs index 714ea19e3e38..eead186901b4 100644 --- a/src/tool/subcommands/api_cmd.rs +++ b/src/tool/subcommands/api_cmd.rs @@ -322,6 +322,10 @@ fn snapshot_tests(store: &ManyCar) -> anyhow::Result> { tests.push(RpcTest::identity(ApiInfo::state_miner_power_req( *block.miner_address(), tipset.key().clone(), + ))); + tests.push(RpcTest::identity(ApiInfo::state_miner_faults_req( + *block.miner_address(), + tipset.key().clone(), ))) } tests.push(RpcTest::basic(ApiInfo::state_circulating_supply_req( From 40b29ee31d4e913ed875e9e33ff3e2a23c4e213c Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Wed, 22 Nov 2023 21:44:00 +0100 Subject: [PATCH 3/7] fmt --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2df231b7a71..93182dfaf224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ - [#3720](https://github.com/ChainSafe/forest/pull/3720) Implement the `Filecoin.GetParentMessages` lotus-compatible RPC API. +- [#3726](https://github.com/ChainSafe/forest/pull/3726) Implement the + `Filecoin.StateMinerFaults` lotus-compatible RPC API. ### Changed diff --git a/Cargo.toml b/Cargo.toml index 2a7153742d84..a6dba1dfb98f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ fil_actor_power_state = "7.0.0" fil_actor_reward_state = "7.0.0" fil_actor_system_state = "7.0.0" fil_actor_verifreg_state = "7.0.0" -fil_actors_shared = { version = "7.0.0", features = ["json"]} +fil_actors_shared = { version = "7.0.0", features = ["json"] } filecoin-proofs-api = { version = "16.0", default-features = false } flume = "0.11" fs_extra = "1.2" From e29163697f04ced0da4ae18466e5f5ee77cdd1c2 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Wed, 22 Nov 2023 21:54:29 +0100 Subject: [PATCH 4/7] fix --- src/rpc/state_api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/state_api.rs b/src/rpc/state_api.rs index 0f9d2e2d5e47..6b07796760dd 100644 --- a/src/rpc/state_api.rs +++ b/src/rpc/state_api.rs @@ -164,7 +164,7 @@ pub(in crate::rpc) async fn state_miner_power( data: Data>, Params(LotusJson((address, key))): Params>, -) -> Result, JsonRpcError> { +) -> Result>, JsonRpcError> { let ts = data .state_manager .chain_store() From 360a1127fc4b2bc553d10f7b440d50ae505fe7cd Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Wed, 22 Nov 2023 22:02:07 +0100 Subject: [PATCH 5/7] fix typo --- src/state_manager/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 406a0cd9be5d..8f6217b03f53 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -980,7 +980,7 @@ where Ok(out) } - /// Retrieves miner faules. + /// Retrieves miner faults. pub fn miner_faults( self: &Arc, addr: &Address, From 604e58d4beff9844d19cefb107b0aa34b9f45ac7 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 23 Nov 2023 12:49:38 +0100 Subject: [PATCH 6/7] fix bitfield union --- src/rpc/state_api.rs | 2 +- src/rpc_client/state_ops.rs | 2 +- src/state_manager/mod.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc/state_api.rs b/src/rpc/state_api.rs index 6b07796760dd..37987e120c9f 100644 --- a/src/rpc/state_api.rs +++ b/src/rpc/state_api.rs @@ -164,7 +164,7 @@ pub(in crate::rpc) async fn state_miner_power( data: Data>, Params(LotusJson((address, key))): Params>, -) -> Result>, JsonRpcError> { +) -> Result, JsonRpcError> { let ts = data .state_manager .chain_store() diff --git a/src/rpc_client/state_ops.rs b/src/rpc_client/state_ops.rs index 6a6ceb8f502a..137cce7ca9b3 100644 --- a/src/rpc_client/state_ops.rs +++ b/src/rpc_client/state_ops.rs @@ -58,7 +58,7 @@ impl ApiInfo { RpcRequest::new(STATE_NETWORK_NAME, ()) } - pub fn state_miner_faults_req(miner: Address, tsk: TipsetKeys) -> RpcRequest> { + pub fn state_miner_faults_req(miner: Address, tsk: TipsetKeys) -> RpcRequest { RpcRequest::new(STATE_MINER_FAULTS, (miner, tsk)) } diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 8f6217b03f53..7bf2e214d4a7 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -985,7 +985,7 @@ where self: &Arc, addr: &Address, ts: &Arc, - ) -> Result, Error> { + ) -> Result { let actor = self .get_actor(addr, *ts.parent_state())? .ok_or_else(|| Error::State("Miner actor not found".to_string()))?; @@ -1001,7 +1001,7 @@ where }) })?; - Ok(faults) + Ok(BitField::union(faults.iter())) } /// Retrieves miner power. From 4e39776a7924efc0ad76582f8edda18156c9457a Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 23 Nov 2023 14:09:08 +0100 Subject: [PATCH 7/7] fix naming --- src/state_manager/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 5f3d1738de7f..115cf4f1b360 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -994,12 +994,16 @@ where let mut faults = Vec::new(); - state.for_each_deadline(&self.chain_config.policy, self.blockstore(), |_, part| { - part.for_each(self.blockstore(), |_, dl| { - faults.push(dl.faulty_sectors().clone()); - Ok(()) - }) - })?; + state.for_each_deadline( + &self.chain_config.policy, + self.blockstore(), + |_, deadline| { + deadline.for_each(self.blockstore(), |_, partition| { + faults.push(partition.faulty_sectors().clone()); + Ok(()) + }) + }, + )?; Ok(BitField::union(faults.iter())) }