From 783bc30b9a01f9f99384d86d98fa96243c4c1ae5 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Fri, 27 Oct 2023 17:05:10 +0300 Subject: [PATCH] Relax validator checks in `Executor` --- node/actors/executor/src/lib.rs | 35 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/node/actors/executor/src/lib.rs b/node/actors/executor/src/lib.rs index e3e8955e..3e04f1a1 100644 --- a/node/actors/executor/src/lib.rs +++ b/node/actors/executor/src/lib.rs @@ -90,20 +90,27 @@ impl Executor { *public == key.public(), "config.consensus.key = {public:?} doesn't match the secret key {key:?}" ); - anyhow::ensure!( - self.executor_config - .validators - .iter() - .any(|validator_key| validator_key == public), - "Key {public:?} is not a validator per validator set {:?}", - self.executor_config.validators - ); - self.validator = Some(ValidatorExecutor { - config, - key, - replica_state_store, - blocks_sender, - }); + + // TODO: this logic must be refactored once dynamic validator sets are implemented + let is_validator = self + .executor_config + .validators + .iter() + .any(|validator_key| validator_key == public); + if is_validator { + self.validator = Some(ValidatorExecutor { + config, + key, + replica_state_store, + blocks_sender, + }); + } else { + tracing::info!( + "Key {public:?} is not a validator per validator set {:?}; the executor will not \ + run consensus", + self.executor_config.validators + ); + } Ok(()) }