Skip to content

Commit acc6d0d

Browse files
committed
Remove legacy error downcasting from miner actor
1 parent b712d1e commit acc6d0d

File tree

14 files changed

+1064
-1487
lines changed

14 files changed

+1064
-1487
lines changed

actors/miner/src/bitfield_queue.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Copyright 2019-2022 ChainSafe Systems
22
// SPDX-License-Identifier: Apache-2.0, MIT
33

4+
use anyhow::Context;
45
use std::convert::TryInto;
56

67
use cid::Cid;
7-
use fil_actors_runtime::{ActorDowncast, Array};
8+
use fil_actors_runtime::Array;
89
use fvm_ipld_amt::Error as AmtError;
910
use fvm_ipld_bitfield::BitField;
1011
use fvm_ipld_blockstore::Blockstore;
@@ -35,13 +36,13 @@ impl<'db, BS: Blockstore> BitFieldQueue<'db, BS> {
3536
let bitfield = self
3637
.amt
3738
.get(epoch)
38-
.map_err(|e| e.downcast_wrap(format!("failed to lookup queue epoch {}", epoch)))?
39+
.with_context(|| format!("failed to lookup queue epoch {}", epoch))?
3940
.cloned()
4041
.unwrap_or_default();
4142

4243
self.amt
4344
.set(epoch, &bitfield | values)
44-
.map_err(|e| e.downcast_wrap(format!("failed to set queue epoch {}", epoch)))?;
45+
.with_context(|| format!("failed to set queue epoch {}", epoch))?;
4546

4647
Ok(())
4748
}
@@ -73,11 +74,11 @@ impl<'db, BS: Blockstore> BitFieldQueue<'db, BS> {
7374

7475
Ok(())
7576
})
76-
.map_err(|e| e.downcast_wrap("failed to cut from bitfield queue"))?;
77+
.context("failed to cut from bitfield queue")?;
7778

7879
self.amt
7980
.batch_delete(epochs_to_remove, true)
80-
.map_err(|e| e.downcast_wrap("failed to remove empty epochs from bitfield queue"))?;
81+
.context("failed to remove empty epochs from bitfield queue")?;
8182

8283
Ok(())
8384
}

0 commit comments

Comments
 (0)