Skip to content

Commit 0e19476

Browse files
committed
fix failing tests and address comments
1 parent b25bab9 commit 0e19476

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

src/rpc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub use methods::*;
4141
/// Protocol or transport-specific error
4242
pub use jsonrpsee::core::ClientError;
4343

44+
/// Sentinel value, indicating no limit on how far back to search in the chain (all the way to genesis epoch).
4445
pub const LOOKBACK_NO_LIMIT: ChainEpoch = -1;
4546

4647
/// The macro `callback` will be passed in each type that implements

src/state_manager/mod.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ where
10461046
&self,
10471047
mut current: Tipset,
10481048
message: &ChainMessage,
1049-
min_epoch: ChainEpoch,
1049+
lookback_max_epoch: ChainEpoch,
10501050
allow_replaced: bool,
10511051
) -> Result<Option<(Tipset, Receipt)>, Error> {
10521052
let message_from_address = message.from();
@@ -1056,7 +1056,7 @@ where
10561056
.map_err(Error::state)?;
10571057
let message_from_id = self.lookup_required_id(&message_from_address, &current)?;
10581058

1059-
while current.epoch() >= min_epoch {
1059+
while current.epoch() >= lookback_max_epoch {
10601060
let parent_tipset = self
10611061
.chain_index()
10621062
.load_required_tipset(current.parents())
@@ -1092,16 +1092,6 @@ where
10921092
}
10931093

10941094
/// Searches backwards through the chain for a message receipt.
1095-
///
1096-
/// # Arguments
1097-
/// * `current` - The tipset to start searching from
1098-
/// * `message` - The message to search for
1099-
/// * `look_back_limit` - Maximum number of epochs to search backwards:
1100-
/// - `None` or `Some(-1)` (LOOKBACK_NO_LIMIT): Search all the way to genesis
1101-
/// - `Some(0)`: No search performed, returns `None` immediately
1102-
/// - `Some(N)` where `N > 0`: Search back at most N epochs
1103-
/// - `Some(N)` where `N >= current.epoch()`: Same as unlimited (to genesis)
1104-
/// * `allow_replaced` - Whether to accept replacement messages (same nonce, different CID)
11051095
fn search_back_for_message(
11061096
&self,
11071097
current: Tipset,
@@ -1112,8 +1102,8 @@ where
11121102
let current_epoch = current.epoch();
11131103
let allow_replaced = allow_replaced.unwrap_or(true);
11141104

1115-
// Calculate the minimum epoch (inclusive lower bound) for the search.
1116-
let min_epoch = match look_back_limit {
1105+
// Calculate the max lookback epoch (inclusive lower bound) for the search.
1106+
let lookback_max_epoch = match look_back_limit {
11171107
// No search: limit = 0 means search 0 epochs
11181108
Some(0) => return Ok(None),
11191109
// Limited search: calculate the inclusive lower bound
@@ -1123,7 +1113,7 @@ where
11231113
_ => 0,
11241114
};
11251115

1126-
self.check_search(current, message, min_epoch, allow_replaced)
1116+
self.check_search(current, message, lookback_max_epoch, allow_replaced)
11271117
}
11281118

11291119
/// Returns a message receipt from a given tipset and message CID.

src/tool/subcommands/api_cmd/test_snapshots.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ filecoin_statereadstate_1748444218790447.rpcsnap.json.zst
286286
filecoin_statereadstate_1748444218790807.rpcsnap.json.zst
287287
filecoin_statereadstate_1749657617007020.rpcsnap.json.zst
288288
filecoin_statereplay_1743504051038215.rpcsnap.json.zst
289-
filecoin_statesearchmsg_1741784596636715.rpcsnap.json.zst
290-
filecoin_statesearchmsglimited_1741784596704877.rpcsnap.json.zst
289+
filecoin_statesearchmsg_1767947430707712.rpcsnap.json.zst
290+
filecoin_statesearchmsglimited_1767936905056090.rpcsnap.json.zst
291291
filecoin_statesectorexpiration_1741784727996672.rpcsnap.json.zst
292292
filecoin_statesectorgetinfo_1743098602783105.rpcsnap.json.zst
293293
filecoin_statesectorpartition_1737546933391247.rpcsnap.json.zst

0 commit comments

Comments
 (0)