Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Testing Reversion Speed on Dispute Concluded Against (#6880)
Browse files Browse the repository at this point in the history
* First pass adding logs

* fmt

* Adjustments
  • Loading branch information
BradleyOlson64 authored Mar 16, 2023
1 parent 177092c commit a23fc42
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions node/core/chain-selection/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ fn apply_ancestor_reversions(
// of unviability is only heavy on the first log.
for revert_number in reversions {
let maybe_block_entry = load_ancestor(backend, block_hash, block_number, revert_number)?;
if let Some(block_entry) = &maybe_block_entry {
gum::trace!(
target: LOG_TARGET,
?revert_number,
revert_hash = ?block_entry.block_hash,
"Block marked as reverted via scraped on-chain reversions"
);
}
revert_single_block_entry_if_present(
backend,
maybe_block_entry,
Expand All @@ -380,6 +388,12 @@ pub(crate) fn apply_single_reversion(
revert_hash: Hash,
revert_number: BlockNumber,
) -> Result<(), Error> {
gum::trace!(
target: LOG_TARGET,
?revert_number,
?revert_hash,
"Block marked as reverted via ChainSelectionMessage::RevertBlocks"
);
let maybe_block_entry = backend.load_block_entry(&revert_hash)?;
revert_single_block_entry_if_present(
backend,
Expand Down
9 changes: 9 additions & 0 deletions node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,15 @@ impl Initialized {
// will need to mark the candidate's relay parent as reverted.
if import_result.is_freshly_concluded_against() {
let blocks_including = self.scraper.get_blocks_including_candidate(&candidate_hash);
for (parent_block_number, parent_block_hash) in &blocks_including {
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
?parent_block_number,
?parent_block_hash,
"Dispute has just concluded against the candidate hash noted. Its parent will be marked as reverted."
);
}
if blocks_including.len() > 0 {
ctx.send_message(ChainSelectionMessage::RevertBlocks(blocks_including)).await;
} else {
Expand Down

0 comments on commit a23fc42

Please sign in to comment.