Skip to content

Conversation

Boog900
Copy link
Member

@Boog900 Boog900 commented Sep 5, 2025

No description provided.

@github-actions github-actions bot added A-p2p Area: Related to P2P. A-test-utils Area: Related to test-utils. A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-workspace Area: Changes to a root workspace file or general repo file. A-consensus Area: Related to consensus. A-docs Area: Related to documentation. A-storage Area: Related to storage. A-helper Area: Related to cuprate-helper. A-types Area: Related to types. A-books Area: Related to Cuprate's books. A-binaries Area: Related to binaries. A-book-architecture Area: Related to the Architecture book. labels Sep 5, 2025
@github-actions github-actions bot removed A-p2p Area: Related to P2P. A-test-utils Area: Related to test-utils. A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-workspace Area: Changes to a root workspace file or general repo file. A-docs Area: Related to documentation. A-storage Area: Related to storage. A-helper Area: Related to cuprate-helper. A-types Area: Related to types. A-books Area: Related to Cuprate's books. A-book-architecture Area: Related to the Architecture book. labels Sep 6, 2025
Comment on lines +225 to +233
if self.seeds.len() < RX_SEEDS_CACHED {
let seed_heights = get_last_rx_seed_heights(new_height, RX_SEEDS_CACHED)
.split_at(self.seeds.len())
.1
.to_vec();
let seed_hashes = get_block_hashes(seed_heights.clone(), database).await?;

self.seeds.extend(seed_heights.into_iter().zip(seed_hashes));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The RX cache would panic if too many blocks were popped as it would have no seeds, this adds the seeds

Comment on lines 140 to 151
let old_long_term_weights = if let Some(new_long_term_start_height) =
chain_height.checked_sub(self.config.long_term_window + numb_blocks)
{
get_long_term_weight_in_range(
new_long_term_start_height..(new_long_term_start_height + numb_blocks),
database.clone(),
Chain::Main,
)
.await?
} else {
vec![]
};
Copy link
Member Author

Choose a reason for hiding this comment

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

the old way to do this for the weight cache was completely wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

although it was only a problem for reorgs over the short term window

@Boog900 Boog900 marked this pull request as ready for review September 6, 2025 20:59
Copy link
Member

@SyntheticBird45 SyntheticBird45 left a comment

Choose a reason for hiding this comment

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

No comments, no nits. good job

@Boog900 Boog900 merged commit 267c98b into main Sep 10, 2025
20 checks passed
@Boog900 Boog900 deleted the pop_blocks branch September 10, 2025 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-binaries Area: Related to binaries. A-consensus Area: Related to consensus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants