Skip to content

Commit e920898

Browse files
authored
feat(docs): latest valid ancestor store methods (#2669)
**Motivation** The `Store` methods `set_latest_valid_ancestor` & `get_latest_valid_ancestor` can be confusing without proper documentation. These methods were properly documented on the `StoreEngine` trait, but they were not documented in the `Store` structure where they will be most often called from. This PR adds documentation for these methods on the `Store` implementation while also simplifying it, as the internal trait documentation provides more information on the context and design choices/requirements for the implementation which are not necessary for the top-level methods. <!-- Why does this pull request exist? What are its goals? --> **Description** * Add doc comments for `Store` methods `set_latest_valid_ancestor` & `get_latest_valid_ancestor` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes None
1 parent a44f435 commit e920898

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/storage/store.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1074,13 +1074,16 @@ impl Store {
10741074
self.engine.read_storage_snapshot(account_hash, start).await
10751075
}
10761076

1077+
/// Fetches the latest valid ancestor for a block that was previously marked as invalid
1078+
/// Returns None if the block was never marked as invalid
10771079
pub async fn get_latest_valid_ancestor(
10781080
&self,
10791081
block: BlockHash,
10801082
) -> Result<Option<BlockHash>, StoreError> {
10811083
self.engine.get_latest_valid_ancestor(block).await
10821084
}
10831085

1086+
/// Marks a block as invalid and sets its latest valid ancestor
10841087
pub async fn set_latest_valid_ancestor(
10851088
&self,
10861089
bad_block: BlockHash,

0 commit comments

Comments
 (0)