From e2ffe061d794c41c9748bce51d77303b1f46ac51 Mon Sep 17 00:00:00 2001 From: Erwan Date: Tue, 20 Feb 2024 11:28:58 -0500 Subject: [PATCH] staking: specify MUST on evidence processing --- crates/core/component/stake/src/component/epoch_handler.rs | 4 ++-- .../src/component/validator_handler/validator_manager.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/core/component/stake/src/component/epoch_handler.rs b/crates/core/component/stake/src/component/epoch_handler.rs index 9337b743ba..bead8b4c2a 100644 --- a/crates/core/component/stake/src/component/epoch_handler.rs +++ b/crates/core/component/stake/src/component/epoch_handler.rs @@ -165,8 +165,8 @@ pub trait EpochHandler: StateWriteExt + ConsensusIndexRead { // record them for the funding component to process. self.queue_staking_rewards(funding_queue); - // Now that all the voting power has been calculated, we can select the - // top `limit` validators to be active for the next epoch. + // Now that the consensus set voting power has been calculated, we can select the + // top N validators to be active for the next epoch. self.set_active_and_inactive_validators().await?; Ok(()) } diff --git a/crates/core/component/stake/src/component/validator_handler/validator_manager.rs b/crates/core/component/stake/src/component/validator_handler/validator_manager.rs index e8679c0813..62e4d1155a 100644 --- a/crates/core/component/stake/src/component/validator_handler/validator_manager.rs +++ b/crates/core/component/stake/src/component/validator_handler/validator_manager.rs @@ -680,6 +680,10 @@ pub trait ValidatorManager: StateWrite { /// Process evidence of byzantine behavior from CometBFT. /// + /// Evidence *MUST* be processed before `end_block` is called, because + /// the evidence may trigger a validator state transition requiring + /// an early epoch change. + /// /// # Errors /// Returns an error if the validator is not found in the JMT. async fn process_evidence(&mut self, evidence: &Misbehavior) -> Result<()> {