Skip to content

chore: Split apply_block and improve instrumentation#1896

Open
sergerad wants to merge 3 commits intomainfrom
sergerad-apply-block-trace
Open

chore: Split apply_block and improve instrumentation#1896
sergerad wants to merge 3 commits intomainfrom
sergerad-apply-block-trace

Conversation

@sergerad
Copy link
Copy Markdown
Collaborator

@sergerad sergerad commented Apr 7, 2026

rpc [ 2.63ms | 47.29% / 100.00% ] rpc.service: "store.BlockProducer" | rpc.method: "ApplyBlock" | otel.name: "store.BlockProducer/ApplyBlock"
┕━ apply_block [ 1.38ms | 0.00% / 52.71% ]
   ┝━ validate_block_header [ 416µs | 15.86% ]
   ┝━ compute_tree_mutations [ 257µs | 9.61% / 9.80% ]
   │  ┕━ acquire_inner_read_lock [ 4.96µs | 0.19% ]
   ┝━ store.block_store.save_block [ 40.9µs | 1.56% ] block_num: BlockNumber(15352) | block_size: 357
   ┝━ await_db_readiness [ 8.67µs | 0.33% ]
   ┝━ acquire_inner_write_lock [ 4.88µs | 0.19% ]
   ┝━ apply_block [ 618µs | 8.69% / 23.55% ]
   │  ┝━ insert_block_header [ 85.0µs | 3.24% ]
   │  ┝━ upsert_accounts [ 3.71µs | 0.14% ]
   │  ┝━ insert_scripts [ 15.6µs | 0.59% ]
   │  ┝━ insert_notes [ 17.6µs | 0.67% ]
   │  ┝━ insert_transactions [ 9.12µs | 0.35% ]
   │  ┝━ insert_nullifiers_for_block [ 47.2µs | 1.80% ]
   │  ┝━ acquire_write_lock [ 7.58µs | 0.29% ]
   │  ┝━ prune_history [ 197µs | 1.49% / 7.51% ] cutoff_block: 15302
   │  │  ┝━ prune_account_vault_assets [ 54.6µs | 2.08% ]
   │  │  ┝━ prune_account_storage_map_values [ 35.5µs | 1.35% ]
   │  │  ┕━ prune_account_codes [ 68.1µs | 2.59% ]
   │  ┕━ acquire_done_lock [ 6.92µs | 0.26% ]
   ┝━ acquire_forest_write_lock [ 5.29µs | 0.20% ]
   ┝━ apply_block_updates [ 32.2µs | 0.54% / 1.23% ] block.number: 15352
   │  ┕━ prune [ 18.1µs | 0.69% ] block.number: 15352
   │     ┕━ i [info]:  | return: 0
   ┕━ i [info]: apply_block successful | block_commitment: 0xb7a57cbc8220e82d587dece459bb90ae5f34d60e1ed1888f5c794260228859e2 | block_num: 15352

@sergerad sergerad marked this pull request as ready for review April 7, 2026 01:17
@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Apr 7, 2026
@sergerad sergerad requested a review from bobbinth April 7, 2026 01:17
let peaks = inner.blockchain.peaks();
if peaks.hash_peaks() != header.chain_commitment() {
return Err(InvalidBlockError::NewBlockInvalidChainCommitment.into());
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@bobbinth I know you mentioned this should technically be in validate_block_header but its here because of the inner lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants