Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion node/src/components/block_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,14 @@ impl BlockValidator {

pending_requests
.into_iter()
.flat_map(|request| self.handle_new_request(effect_builder, request))
.flat_map(|request| {
match self.try_handle_as_existing_request(effect_builder, request) {
MaybeHandled::Handled(effects) => effects,
MaybeHandled::NotHandled(request) => {
self.handle_new_request(effect_builder, request)
}
}
})
.collect()
}

Expand Down
24 changes: 17 additions & 7 deletions node/src/reactor/main_reactor/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ impl MainReactor {

let execution_pre_state = self.contract_runtime.execution_pre_state();
let next_consensus_height = self.consensus.next_executed_height();
if next_consensus_height != 0
&& next_consensus_height != execution_pre_state.next_block_height()
{
warn!(
"Validate: misalignment of expected block height between consensus and contract runtime"
);
return ValidateInstruction::CatchUp;
let next_execution_height = execution_pre_state.next_block_height();
if next_consensus_height != 0 {
// A difference of exactly 1 where execution is ahead is expected: execution
// updates execution_pre_state synchronously, but consensus.next_executed_height
// only advances after the BlockAdded event propagates through handle_meta_block.
// Triggering CatchUp on this transient single-block gap causes a self-reinforcing
// loop (refresh_contract_runtime keeps the gap at 1) that takes minutes to escape.
let is_misaligned = next_execution_height < next_consensus_height
|| next_execution_height > next_consensus_height.saturating_add(1);
if is_misaligned {
warn!(
next_consensus_height,
next_execution_height,
"Validate: misalignment of expected block height between consensus and contract runtime"
);
return ValidateInstruction::CatchUp;
}
}

let queue_depth = self.contract_runtime.queue_depth();
Expand Down
Loading