Skip to content

Commit

Permalink
chore(sidecar): logs
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 31, 2024
1 parent 1599420 commit 570ac35
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 14 additions & 2 deletions bolt-sidecar/src/chain_io/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use eyre::bail;
use reqwest::{Client, Url};
use serde::Serialize;

use tracing::debug;
use BoltManagerContract::{
BoltManagerContractErrors, BoltManagerContractInstance, ProposerStatus, ValidatorDoesNotExist,
};
Expand All @@ -21,6 +22,8 @@ use crate::config::chain::Chain;

use super::utils::{self, CompressedHash};

const CHUNK_SIZE: usize = 1_000;

/// A wrapper over a BoltManagerContract that exposes various utility methods.
#[derive(Debug, Clone)]
pub struct BoltManager(BoltManagerContractInstance<Http<Client>, RootProvider<Http<Client>>>);
Expand Down Expand Up @@ -57,12 +60,21 @@ impl BoltManager {

let mut proposers_statuses = Vec::with_capacity(hashes.len());

let mut i = 0;
while !hashes.is_empty() {
// No more than 1_000 at a time to avoid EL config limits
i += 1;

// No more than CHUNK_SIZE at a time to avoid EL config limits
//
// TODO: write an unsafe function that splits a vec into owned chunks without
// allocating
let hashes_chunk = hashes.drain(..1_000.min(hashes.len())).collect::<Vec<_>>();
let hashes_chunk = hashes.drain(..CHUNK_SIZE.min(hashes.len())).collect::<Vec<_>>();

debug!(
"fetching proposer statuses for chunk {} of {}",
i,
hashes.len().div_ceil(CHUNK_SIZE)
);

let returndata = self.0.getProposerStatuses(hashes_chunk).call().await;

Expand Down
7 changes: 6 additions & 1 deletion bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,18 @@ impl<C: StateFetcher, ECDSA: SignerECDSA> SidecarDriver<C, ECDSA> {
{
let commitment_signer_pubkey = commitment_signer.public_key();
let validator_public_keys_len = validator_public_keys.len();
info!(
validator_public_keys_len,
commitment_signer_pubkey = ?commitment_signer_pubkey,
"Verifying validators and operator keys with Bolt Manager, this may take a while..."
);
bolt_manager
.verify_validator_pubkeys(validator_public_keys, commitment_signer_pubkey)
.await?;
info!(
validator_public_keys_len,
commitment_signer_pubkey = ?commitment_signer_pubkey,
"Validators and operator keys verified with Bolt Manager successfully"
"Verified validators and operator keys verified with Bolt Manager successfully"
);
} else {
warn!(
Expand Down

0 comments on commit 570ac35

Please sign in to comment.