Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(engine): wire StateRootTask in EngineApiTreeHandler #12639

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Nov 18, 2024

Towards #12053

@fgimenez fgimenez added C-perf A change motivated by improving speed, memory usage or disk footprint A-blockchain-tree Related to sidechains, reorgs and pending blocks A-trie Related to Merkle Patricia Trie implementation labels Nov 18, 2024
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from 5eba0ab to e3149b0 Compare November 19, 2024 12:02
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 70e9ba3 to 8f89fff Compare November 19, 2024 12:02
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from e3149b0 to ffd4c4a Compare November 19, 2024 12:45
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 8f89fff to 20ec32e Compare November 19, 2024 12:46
Comment on lines 2197 to 2240
let consistent_view = ConsistentDbView::new_with_latest_tip(self.provider.clone())?;

let input = self
.compute_trie_input(consistent_view.clone(), block.parent_hash)
.map_err(|e| InsertBlockErrorKindTwo::Other(Box::new(e)))?;
let state_root_config =
StateRootConfig { consistent_view: consistent_view.clone(), input: Arc::new(input) };
let receiver_stream = StdReceiverStream::new(state_root_rx);
let state_root_task = StateRootTask::new(state_root_config, receiver_stream);
let state_root_handle = state_root_task.spawn();
let state_hook = move |result_and_state: &ResultAndState| {
let _ = state_root_tx.send(result_and_state.state.clone());
};
Copy link
Member

Choose a reason for hiding this comment

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

is this expected to instantiate a state root task each time, or is it expected that we spawn it once?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, it is designed to instantiate one task per block. maybe we could get rid of the overhead of creating the task with a background service, similar to what we have for persistence, once everything is working correctly we can measure to compare both approaches

@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from ffd4c4a to fde920f Compare November 20, 2024 14:21
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 4e45271 to 60a90c7 Compare November 20, 2024 15:35
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from 52e1366 to 2ffe7c8 Compare November 21, 2024 09:43
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 2 times, most recently from c373aa2 to 256cd4d Compare November 22, 2024 09:18
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from 8e7f598 to e734d3f Compare November 22, 2024 17:54
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 2 times, most recently from fa4e2d1 to b5f64dc Compare November 24, 2024 16:47
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from f982fa2 to 1665120 Compare November 24, 2024 16:49
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from b5f64dc to a265490 Compare November 25, 2024 12:14
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from 7939f11 to d8dea1f Compare November 25, 2024 15:12
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from a265490 to 885b439 Compare November 25, 2024 16:27
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from 4730fcb to fbc22f5 Compare November 26, 2024 16:09
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 885b439 to 598aa99 Compare November 26, 2024 16:12
@fgimenez fgimenez force-pushed the fgimenez/srt-proof-fetching branch from fbc22f5 to 344a9b8 Compare November 27, 2024 10:01
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 598aa99 to c43f9fa Compare November 27, 2024 14:15
Base automatically changed from fgimenez/srt-proof-fetching to main November 27, 2024 14:30
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 4 times, most recently from 465e211 to c04977e Compare November 29, 2024 12:30
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 3 times, most recently from 34b74d7 to b05a56d Compare December 3, 2024 09:17
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 2 times, most recently from 2fa2c24 to f71d25b Compare December 7, 2024 16:22
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch 2 times, most recently from e6a8af7 to 5b9bd66 Compare December 11, 2024 15:11
@fgimenez fgimenez force-pushed the fgimenez/srt-wiring branch from 4e7256a to 8975416 Compare December 13, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks A-trie Related to Merkle Patricia Trie implementation C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants