diff --git a/bolt-sidecar/src/driver.rs b/bolt-sidecar/src/driver.rs index 50460c40..75268199 100644 --- a/bolt-sidecar/src/driver.rs +++ b/bolt-sidecar/src/driver.rs @@ -162,9 +162,9 @@ impl SidecarDriver { fetcher: C, ) -> eyre::Result { // Verify the operator and validator keys with the bolt manager - let bolt_manager = - BoltManager::from_chain(opts.execution_api_url.clone(), opts.chain.chain); - if let Some(bolt_manager) = bolt_manager { + if let Some(bolt_manager) = + BoltManager::from_chain(opts.execution_api_url.clone(), opts.chain.chain) + { bolt_manager.verify_operator(commitment_signer.public_key()).await?; bolt_manager .verify_validator_pubkeys(&Vec::from_iter(constraint_signer.available_pubkeys())) diff --git a/bolt-sidecar/src/signer/keystore.rs b/bolt-sidecar/src/signer/keystore.rs index 999e1b4e..413f6951 100644 --- a/bolt-sidecar/src/signer/keystore.rs +++ b/bolt-sidecar/src/signer/keystore.rs @@ -203,8 +203,8 @@ mod tests { const KEYSTORES_DEFAULT_PATH_TEST: &str = "test_data/keys"; const KEYSTORES_SECRETS_DEFAULT_PATH_TEST: &str = "test_data/secrets"; - /// If `path` is `Some`, returns a clone of it. Otherwise, returns the path to the `fallback_relative_path` - /// starting from the root of the cargo project. + /// If `path` is `Some`, returns a clone of it. Otherwise, returns the path to the + /// `fallback_relative_path` starting from the root of the cargo project. fn make_path(relative_path: &str) -> PathBuf { let project_root = env!("CARGO_MANIFEST_DIR"); Path::new(project_root).join(relative_path) @@ -302,7 +302,8 @@ mod tests { let keystore_path = PathBuf::from(keystore_path); for test_keystore_json in tests_keystore_json { - // 1. Write the keystore in a `test-voting-keystore.json` file so we test both scrypt and PBDKF2 + // 1. Write the keystore in a `test-voting-keystore.json` file so we test both scrypt + // and PBDKF2 let mut tmp_keystore_file = File::create(keystore_path.join("test-voting-keystore.json")) diff --git a/bolt-sidecar/src/state/consensus.rs b/bolt-sidecar/src/state/consensus.rs index 7b41c4a2..b4bcae81 100644 --- a/bolt-sidecar/src/state/consensus.rs +++ b/bolt-sidecar/src/state/consensus.rs @@ -117,8 +117,8 @@ impl ConsensusState { } // If the request is for the next slot, check if it's within the commitment deadline - if req.slot == self.latest_slot + 1 - && self.latest_slot_timestamp + self.commitment_deadline_duration < Instant::now() + if req.slot == self.latest_slot + 1 && + self.latest_slot_timestamp + self.commitment_deadline_duration < Instant::now() { return Err(ConsensusError::DeadlineExceeded); } @@ -161,7 +161,8 @@ impl ConsensusState { Ok(()) } - /// Fetch proposer duties for the given epoch and the next one if the unsafe lookahead flag is set + /// Fetch proposer duties for the given epoch and the next one if the unsafe lookahead flag is + /// set async fn fetch_proposer_duties(&mut self, epoch: u64) -> Result<(), ConsensusError> { let duties = if self.unsafe_lookahead_enabled { let two_epoch_duties = join!( @@ -200,9 +201,9 @@ impl ConsensusState { /// Returns the furthest slot for which a commitment request is considered valid, whether in /// the current epoch or next epoch (if unsafe lookahead is enabled) fn furthest_slot(&self) -> u64 { - self.epoch.start_slot - + SLOTS_PER_EPOCH - + if self.unsafe_lookahead_enabled { SLOTS_PER_EPOCH } else { 0 } + self.epoch.start_slot + + SLOTS_PER_EPOCH + + if self.unsafe_lookahead_enabled { SLOTS_PER_EPOCH } else { 0 } } } @@ -324,8 +325,8 @@ mod tests { }; let epoch = - state.beacon_api_client.get_beacon_header(BlockId::Head).await?.header.message.slot - / SLOTS_PER_EPOCH; + state.beacon_api_client.get_beacon_header(BlockId::Head).await?.header.message.slot / + SLOTS_PER_EPOCH; state.fetch_proposer_duties(epoch).await?; assert_eq!(state.epoch.proposer_duties.len(), SLOTS_PER_EPOCH as usize * 2);