Fix epoch, slot, and effective balance quoting (#1756)

## Issue Addressed

Resolves #1717

## Proposed Changes

Add quoting for epochs, slots, and `effective_balance`

## Additional Info
This commit is contained in:
realbigsean 2020-10-11 23:58:12 +00:00
parent 99a02fd2ab
commit 83ae12a1b4
3 changed files with 9 additions and 8 deletions

View File

@ -52,7 +52,7 @@ application/json"
"canonical": true,
"header": {
"message": {
"slot": 3199,
"slot": "3199",
"proposer_index": "19077",
"parent_root": "0xf1934973041c5896d0d608e52847c3cd9a5f809c59c64e76f6020e3d7cd0c7cd",
"state_root": "0xe8e468f9f5961655dde91968f66480868dab8d4147de9498111df2b7e4e6fe60",
@ -81,12 +81,12 @@ curl -X GET "http://localhost:5052/eth/v1/beacon/states/head/validators/1" -H "
"validator": {
"pubkey": "0x873e73ee8b3e4fcf1d2fb0f1036ba996ac9910b5b348f6438b5f8ef50857d4da9075d0218a9d1b99a9eae235a39703e1",
"withdrawal_credentials": "0x00b8cdcf79ba7e74300a07e9d8f8121dd0d8dd11dcfd6d3f2807c45b426ac968",
"effective_balance": 32000000000,
"effective_balance": "32000000000",
"slashed": false,
"activation_eligibility_epoch": 0,
"activation_epoch": 0,
"exit_epoch": 18446744073709552000,
"withdrawable_epoch": 18446744073709552000
"activation_eligibility_epoch": "0",
"activation_epoch": "0",
"exit_epoch": "18446744073709551615",
"withdrawable_epoch": "18446744073709551615"
}
}
}

View File

@ -27,12 +27,12 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssi
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Slot(u64);
pub struct Slot(#[serde(with = "serde_utils::quoted_u64")] u64);
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Epoch(u64);
pub struct Epoch(#[serde(with = "serde_utils::quoted_u64")] u64);
impl_common!(Slot);
impl_common!(Epoch);

View File

@ -14,6 +14,7 @@ use tree_hash_derive::TreeHash;
pub struct Validator {
pub pubkey: PublicKeyBytes,
pub withdrawal_credentials: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
pub effective_balance: u64,
pub slashed: bool,
pub activation_eligibility_epoch: Epoch,