Skip to content

Commit

Permalink
feat(collator): store state virtualized cell from block candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Nov 18, 2024
1 parent de0a308 commit 7515760
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions collator/src/collator/do_collate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1671,14 +1671,21 @@ impl CollatorStdImpl {
};
let adapter = self.state_node_adapter.clone();
let labels = labels.clone();
let new_state_root = finalized.new_state_root.clone();

let new_state_root = finalized
.block_candidate
.block
.as_ref()
.load_state_update()?
.new;

async move {
let _histogram = HistogramGuard::begin_with_labels(
"tycho_collator_build_new_state_time",
&labels,
);
adapter
.store_state_root(&block_id, meta, new_state_root)
.store_state_root(&block_id, meta, new_state_root, true)
.await
}
});
Expand Down
4 changes: 3 additions & 1 deletion collator/src/state_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub trait StateNodeAdapter: Send + Sync + 'static {
block_id: &BlockId,
meta: NewBlockMeta,
state_root: Cell,
virtualize: bool,
) -> Result<bool>;
/// Return block by it's id from node local state
async fn load_block(&self, block_id: &BlockId) -> Result<Option<BlockStuff>>;
Expand Down Expand Up @@ -189,6 +190,7 @@ impl StateNodeAdapter for StateNodeAdapterStdImpl {
block_id: &BlockId,
meta: NewBlockMeta,
state_root: Cell,
virtualize: bool,
) -> Result<bool> {
let _histogram = HistogramGuard::begin("tycho_collator_state_store_state_root_time");

Expand All @@ -202,7 +204,7 @@ impl StateNodeAdapter for StateNodeAdapterStdImpl {
let updated = self
.storage
.shard_state_storage()
.store_state_root(&handle, state_root, false)
.store_state_root(&handle, state_root, virtualize)
.await?;

Ok(updated)
Expand Down

0 comments on commit 7515760

Please sign in to comment.