Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lean_client/fork_choice/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ fn validate_attestation_data(store: &Store, data: &AttestationData) -> Result<()

/// Returns the first block root (source, target, or head) referenced by `attestation_data`
/// that is not yet present in the store, or `None` if all are known.
fn find_unknown_attestation_block(store: &Store, attestation_data: &AttestationData) -> Option<H256> {
fn find_unknown_attestation_block(
store: &Store,
attestation_data: &AttestationData,
) -> Option<H256> {
[
attestation_data.source.root,
attestation_data.target.root,
Expand Down
33 changes: 27 additions & 6 deletions lean_client/networking/src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ where
}

METRICS.get().map(|metrics| {
metrics.register_peer_connection_success(endpoint.is_listener())
metrics.register_peer_connection_success(endpoint.is_listener());
metrics
.lean_connected_peers
.with_label_values(&["unknown"])
.set(connected as i64);
});

None
Expand Down Expand Up @@ -452,7 +456,11 @@ where
Some(ConnectionError::KeepAliveTimeout) => DisconnectReason::Timeout,
};

metrics.register_peer_disconnect(endpoint.is_listener(), reason)
metrics.register_peer_disconnect(endpoint.is_listener(), reason);
metrics
.lean_connected_peers
.with_label_values(&["unknown"])
.set(connected as i64);
});

Some(NetworkEvent::PeerDisconnected(peer_id))
Expand Down Expand Up @@ -644,7 +652,14 @@ where
} => {
use crate::req_resp::{LeanRequest, LeanResponse};

let (response, peer_finalized_slot, peer_head_root, peer_head_slot, our_finalized_slot, our_head_slot) = match request {
let (
response,
peer_finalized_slot,
peer_head_root,
peer_head_slot,
our_finalized_slot,
our_head_slot,
) = match request {
LeanRequest::Status(peer_status) => {
let status = self.status_provider.read().clone();
let our_finalized = status.finalized.slot.0;
Expand All @@ -653,7 +668,14 @@ where
let pf = peer_status.finalized.slot.0;
let ph = peer_status.head.root;
let phs = peer_status.head.slot.0;
(LeanResponse::Status(status), pf, ph, phs, our_finalized, our_head)
(
LeanResponse::Status(status),
pf,
ph,
phs,
our_finalized,
our_head,
)
}
_ => {
warn!(peer = %peer, "Unexpected request type on Status protocol");
Expand Down Expand Up @@ -1063,8 +1085,7 @@ where
let our_finalized = self.status_provider.read().finalized.slot.0;
info!(
num_peers = peers.len(),
our_finalized,
"Periodic sync check: sending status to all connected peers"
our_finalized, "Periodic sync check: sending status to all connected peers"
);
for peer_id in peers {
self.send_status_request(peer_id);
Expand Down
16 changes: 13 additions & 3 deletions lean_client/networking/src/req_resp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ impl LeanCodec {
if declared_len as usize > MAX_PAYLOAD_SIZE {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Declared length too large: {} > {}", declared_len, MAX_PAYLOAD_SIZE),
format!(
"Declared length too large: {} > {}",
declared_len, MAX_PAYLOAD_SIZE
),
));
}

Expand All @@ -336,7 +339,11 @@ impl LeanCodec {
if ssz_bytes.len() != declared_len as usize {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Length mismatch: declared {}, got {}", declared_len, ssz_bytes.len()),
format!(
"Length mismatch: declared {}, got {}",
declared_len,
ssz_bytes.len()
),
));
}

Expand Down Expand Up @@ -377,7 +384,10 @@ impl LeanCodec {
offset += consumed;

if code != RESPONSE_SUCCESS {
warn!(response_code = code, "BlocksByRoot non-success response chunk");
warn!(
response_code = code,
"BlocksByRoot non-success response chunk"
);
continue;
}
if ssz_bytes.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion lean_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ async fn main() -> Result<()> {
});
}

let fork = "devnet3".to_string();
let fork = "devnet0".to_string();
// Subscribe to topics based on validator role:
// - Aggregators: all attestation subnets
// - Non-aggregator validators: only their own subnet
Expand Down
5 changes: 2 additions & 3 deletions lean_client/validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::path::Path;
use anyhow::{Context, Result, anyhow, bail};
use containers::{
AggregatedSignatureProof, AggregationBits, Attestation, AttestationData, AttestationSignatures,
Block, BlockSignatures, BlockWithAttestation,
SignedAggregatedAttestation, SignedAttestation, SignedBlockWithAttestation, Slot,
Block, BlockSignatures, BlockWithAttestation, SignedAggregatedAttestation, SignedAttestation,
SignedBlockWithAttestation, Slot,
};
use fork_choice::store::Store;
use metrics::{METRICS, stop_and_discard, stop_and_record};
Expand Down Expand Up @@ -407,5 +407,4 @@ impl ValidatorService {
})
.collect()
}

}
Loading