(
#[allow(unused)] context: &ContextCell<R>,
block: &Block,
new_height: u64,
state: &mut ConsensusState,
protocol_version_digest: Digest,
consts: &ProtocolConsts,
)
| 1461 | .get_active_or_joining_validators() |
| 1462 | .iter() |
| 1463 | .map(|(node_key, _)| node_key.clone()) |
| 1464 | .collect(); |
| 1465 | let joining_node_keys: Vec<_> = active_or_joining_node_keys |
| 1466 | .iter() |
| 1467 | .filter(|key| !active_node_keys.contains(key)) |
| 1468 | .cloned() |
| 1469 | .collect(); |
| 1470 | let observer_keys = derive_observer_keys( |
| 1471 | &active_or_joining_node_keys, |
| 1472 | &self.observer_domain, |
| 1473 | self.canonical_state.get_observers_per_validator(), |
| 1474 | ); |
| 1475 | let secondary_keys: Vec<_> = |
| 1476 | joining_node_keys.into_iter().chain(observer_keys).collect(); |
| 1477 | self.oracle |
| 1478 | .track( |
| 1479 | self.canonical_state.get_epoch(), |
| 1480 | active_node_keys, |
| 1481 | secondary_keys, |
| 1482 | ) |
| 1483 | .await; |
| 1484 | |
| 1485 | // Send the new validator list to the orchestrator and start the Simplex engine |
| 1486 | // for the new epoch |
| 1487 | let active_validators = self.canonical_state.get_active_validators(); |
| 1488 | debug!( |
| 1489 | epoch = self.canonical_state.get_epoch(), |
| 1490 | num_active_validators = active_validators.len(), |
| 1491 | "signaling orchestrator to enter new epoch" |
| 1492 | ); |
| 1493 | |
| 1494 | orchestrator_mailbox |
| 1495 | .report(Message::Enter(EpochTransition { |
| 1496 | epoch: Epoch::new(self.canonical_state.get_epoch()), |
| 1497 | validator_keys: active_validators, |
| 1498 | })) |
| 1499 | .await; |
| 1500 | epoch_change = true; |
| 1501 | } else { |
| 1502 | // Every block needs to be ack'ed. |
| 1503 | // On the last block of an epoch we send the ack before updating the oracle and |
| 1504 | // reporting to the orchestrator, because those calls might be blocking. |
| 1505 | ack_tx.acknowledge(); |
| 1506 | } |
| 1507 | |
| 1508 | info!(new_height, epoch = current_epoch, "executed block"); |
| 1509 | |
| 1510 | if epoch_change { |
| 1511 | // Shut down the Simplex engine for the old epoch |
| 1512 | debug!( |
| 1513 | old_epoch = self.canonical_state.get_epoch() - 1, |
| 1514 | "signaling orchestrator to exit old epoch" |
| 1515 | ); |
| 1516 | orchestrator_mailbox |
| 1517 | .report(Message::Exit(Epoch::new( |
| 1518 | self.canonical_state.get_epoch() - 1, |
| 1519 | ))) |
| 1520 | .await; |
no test coverage detected