Skip to content

Commit

Permalink
Merge pull request #1 from michaelsproul/attestation_rewards
Browse files Browse the repository at this point in the history
Fix deserialization of ValidatorId
  • Loading branch information
kevinbogner authored Feb 6, 2023
2 parents a32aa66 + 6c82ff7 commit 793ad55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions common/eth2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,20 @@ pub struct FinalityCheckpointsData {
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(try_from = "&str")]
pub enum ValidatorId {
PublicKey(PublicKeyBytes),
Index(u64),
}

impl TryFrom<&str> for ValidatorId {
type Error = String;

fn try_from(s: &str) -> Result<Self, Self::Error> {
Self::from_str(s)
}
}

impl FromStr for ValidatorId {
type Err = String;

Expand Down

0 comments on commit 793ad55

Please sign in to comment.