From fd0a225099a375dc2e8ec44e4370750e1207dee9 Mon Sep 17 00:00:00 2001 From: Zacholme7 Date: Mon, 2 Dec 2024 20:04:34 +0000 Subject: [PATCH] ValidatorIndex newtype --- anchor/common/ssv_types/src/committee.rs | 3 --- anchor/common/ssv_types/src/lib.rs | 2 +- anchor/common/ssv_types/src/share.rs | 5 ++++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/anchor/common/ssv_types/src/committee.rs b/anchor/common/ssv_types/src/committee.rs index 89f95945..5dc323ee 100644 --- a/anchor/common/ssv_types/src/committee.rs +++ b/anchor/common/ssv_types/src/committee.rs @@ -2,9 +2,6 @@ use crate::util::parse_rsa; use crate::{Operator, OperatorId}; use derive_more::{Deref, From}; use rsa::RsaPublicKey; -use std::cmp::Eq; -use std::fmt::Debug; -use std::hash::Hash; use types::Domain; /// Unique identifier for a committee. diff --git a/anchor/common/ssv_types/src/lib.rs b/anchor/common/ssv_types/src/lib.rs index 397e357b..d91c5907 100644 --- a/anchor/common/ssv_types/src/lib.rs +++ b/anchor/common/ssv_types/src/lib.rs @@ -1,6 +1,6 @@ pub use committee::{CommitteeId, CommitteeMember}; pub use operator::{Operator, OperatorId}; -pub use share::SSVShare; +pub use share::{SSVShare, ValidatorIndex}; mod committee; mod operator; mod share; diff --git a/anchor/common/ssv_types/src/share.rs b/anchor/common/ssv_types/src/share.rs index 0c766288..84c949e7 100644 --- a/anchor/common/ssv_types/src/share.rs +++ b/anchor/common/ssv_types/src/share.rs @@ -1,8 +1,11 @@ use crate::CommitteeId; +use derive_more::{Deref, From}; use std::time::SystemTime; use types::{Address, Domain, Graffiti, PublicKey}; -type ValidatorIndex = usize; +// Index of the validator in the validator registry. +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct ValidatorIndex(usize); /// Share of a key that a operator owns and its accompanying metadata. #[derive(Debug, Clone)]