Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/state_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,22 @@ where
.tuple_windows()
.take(DEFAULT_TIPSET_CACHE_SIZE.into())
{
let key = parent.key();
let state_root = child.min_ticket_block().state_root;
let receipt_root = child.min_ticket_block().message_receipts;
self.cache.insert(
parent.key().clone(),
key.clone(),
StateOutputValue {
state_root: child.min_ticket_block().state_root,
receipt_root: child.min_ticket_block().message_receipts,
state_root,
receipt_root,
},
)
);
if let Ok(receipts) = Receipt::get_receipts(self.blockstore(), receipt_root)
&& !receipts.is_empty()
{
self.receipt_event_cache_handler
Copy link
Copy Markdown
Contributor Author

@hanabi1224 hanabi1224 Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, without receipt_event_cache_handler cache being populated, the below function always calls compute_tipset_state to get message receipts

    #[instrument(skip(self))]
    pub async fn tipset_message_receipts(
        self: &Arc<Self>,
        tipset: &Arc<Tipset>,
    ) -> anyhow::Result<Vec<Receipt>> {
        let key = tipset.key();
        let ts = tipset.clone();
        let this = Arc::clone(self);
        self.receipt_event_cache_handler
            .get_receipt_or_else(
                key,
                Box::new(move || {
                    Box::pin(async move {
                        let StateOutput { receipt_root, .. } = this
                            .compute_tipset_state(ts, NO_CALLBACK, VMTrace::NotTraced)
                            .await?;
                        trace!("Completed tipset state calculation");
                        Receipt::get_receipts(this.blockstore(), receipt_root)
                    })
                }),
            )
            .await
    }

.insert_receipt(key, receipts);
}
}
}

Expand Down
Loading