-
Notifications
You must be signed in to change notification settings - Fork 9
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
Compact block cache pt3 #170
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some remarks and requests! Pretty exciting step forward!
@@ -54,8 +54,40 @@ impl NonFinalisedState { | |||
config, | |||
}; | |||
|
|||
// If no_db is active wait for server to sync with p2p network. | |||
if non_finalised_state.config.no_db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be factored out to a function of non_finalized_state that has meaningful name? It seems a pretty specific condition that is being described here.
{ | ||
break; | ||
} else { | ||
println!(" - Validator syncing with network. Validator chain height: {}, Estimated Network chain height: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a log entry instead?
@@ -286,8 +274,11 @@ impl NonFinalisedState { | |||
}; | |||
} | |||
|
|||
// Refill from reorg_height[+1]. | |||
for block_height in (reorg_height.0 + 1)..self.fetcher.get_blockchain_info().await?.blocks.0 | |||
// Refill from max(reorg_height[+1], sapling_activation_height). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't you refill the cache from reorg_height - 1?
let validator_height = self.fetcher.get_blockchain_info().await?.blocks.0; | ||
for block_height in ((reorg_height.0 + 1) | ||
.max(self.config.network.sapling_activation_height().0)) | ||
..=validator_height | ||
{ | ||
// Either pop the reorged block or pop the oldest block in non-finalised state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document Reorg Logic outside code as well.
{ | ||
self.status.store(StatusType::CriticalError.into()); | ||
return Err(NonFinalisedStateError::Critical( | ||
"Critical error in database. Closing NonFinalisedState" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the error be more self explanatory given that the conditions of the failure are well-known?
Final integration of the Compact Block Cache.
Height(u32)
(zebra-chain). This is required to search LMDB height keys by order.