From 1bc2f51f3704369e5205ce4bf00047c811d66383 Mon Sep 17 00:00:00 2001 From: David Himmelstrup Date: Wed, 2 Oct 2024 10:43:46 +0200 Subject: [PATCH] fix: return null in `MinerGetBaseInfo` if miner hasn't been around for 900 epochs (#4820) --- CHANGELOG.md | 2 ++ src/state_manager/mod.rs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da3b10f39246..de5f06aebb86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ - [#4809](https://github.com/ChainSafe/forest/issues/4777) the Mac OS X build on Apple silicons works +- [#4820](https://github.com/ChainSafe/forest/pull/4820) Fix edge-case in + `Filecoin.MinerGetBaseInfo` RPC method. ## Forest 0.20.0 "Brexit" diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 9179cdfa5f0c..cf50250b8118 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -1214,7 +1214,14 @@ where epoch, )?; + // If the miner actor doesn't exist in the current tipset, it is a + // user-error and we must return an error message. If the miner exists + // in the current tipset but not in the lookback tipset, we may not + // error and should instead return None. let actor = self.get_required_actor(&addr, *tipset.parent_state())?; + if self.get_actor(&addr, lb_state_root)?.is_none() { + return Ok(None); + } let miner_state = miner::State::load(self.blockstore(), actor.code, actor.state)?;