Skip to content
Merged
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
15 changes: 13 additions & 2 deletions anchor/validator_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ impl<T: SlotClock, E: EthSpec> AnchorValidatorStore<T, E> {

// First, attempt to get the cluster normally
if let Some(cluster) = state.clusters().get_by(&validator.cluster_id) {
if cluster.liquidated {
return Err(Error::SpecificError(SpecificError::ClusterLiquidated));
}
return Ok((validator, cluster.clone()));
}

Expand Down Expand Up @@ -745,6 +748,7 @@ pub enum SpecificError {
cluster_id: ClusterId,
},
KeyShareDecryptionFailed,
ClusterLiquidated,
}

impl From<CollectionError> for SpecificError {
Expand Down Expand Up @@ -792,12 +796,19 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
I: FromIterator<PublicKeyBytes>,
F: Fn(DoppelgangerStatus) -> Option<PublicKeyBytes>,
{
let state = self.database.state();

// Treat all shares as `SigningEnabled`
self.database
.state()
state
.shares()
.values()
.filter_map(|v| filter_func(DoppelgangerStatus::SigningEnabled(v.validator_pubkey)))
.filter(|public_key| {
state
.clusters()
.get_by(public_key)
Comment on lines +808 to +809
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get_by(public_key) call is incorrect. The clusters collection should be accessed using the cluster_id from the validator metadata, not the public key directly. This will likely fail to find clusters since public keys are not cluster identifiers.

Suggested change
.clusters()
.get_by(public_key)
.metadata()
.get_by(public_key)
.and_then(|metadata| metadata.cluster_id)
.and_then(|cluster_id| state.clusters().get_by(&cluster_id))

Copilot uses AI. Check for mistakes.
.is_some_and(|cluster| !cluster.liquidated)
})
.collect()
}

Expand Down