Start working on u64 json issue
This commit is contained in:
parent
d4bf1390c9
commit
d05c2d4110
@ -31,3 +31,4 @@ tree_hash_derive = "0.2"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.6.0"
|
env_logger = "0.6.0"
|
||||||
|
serde_json = "^1.0"
|
||||||
|
@ -9,7 +9,7 @@ fn default_values() {
|
|||||||
let cache = CommitteeCache::default();
|
let cache = CommitteeCache::default();
|
||||||
|
|
||||||
assert_eq!(cache.is_initialized_at(Epoch::new(0)), false);
|
assert_eq!(cache.is_initialized_at(Epoch::new(0)), false);
|
||||||
assert_eq!(cache.active_validator_indices(), &[]);
|
assert!(&cache.active_validator_indices().is_empty());
|
||||||
assert_eq!(cache.get_crosslink_committee_for_shard(0), None);
|
assert_eq!(cache.get_crosslink_committee_for_shard(0), None);
|
||||||
assert_eq!(cache.get_attestation_duties(0), None);
|
assert_eq!(cache.get_attestation_duties(0), None);
|
||||||
assert_eq!(cache.active_validator_count(), 0);
|
assert_eq!(cache.active_validator_count(), 0);
|
||||||
|
@ -191,4 +191,16 @@ mod epoch_tests {
|
|||||||
Epoch::from_ssz_bytes(&max_epoch.as_ssz_bytes()).unwrap()
|
Epoch::from_ssz_bytes(&max_epoch.as_ssz_bytes()).unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epoch_max_value_json() {
|
||||||
|
let x: Epoch = Epoch::from(u64::max_value());
|
||||||
|
let json = serde_json::to_string(&x).expect("should json encode");
|
||||||
|
|
||||||
|
assert_eq!(&json, "18446744073709552000");
|
||||||
|
assert_eq!(
|
||||||
|
serde_json::from_str::<Epoch>(&json).expect("should json decode"),
|
||||||
|
x
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,15 @@ impl TestingProposerSlashingBuilder {
|
|||||||
..header_1.clone()
|
..header_1.clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let epoch = slot.epoch(T::slots_per_epoch());
|
||||||
|
|
||||||
header_1.signature = {
|
header_1.signature = {
|
||||||
let message = header_1.signed_root();
|
let message = header_1.signed_root();
|
||||||
let epoch = slot.epoch(T::slots_per_epoch());
|
|
||||||
signer(proposer_index, &message[..], epoch, Domain::BeaconProposer)
|
signer(proposer_index, &message[..], epoch, Domain::BeaconProposer)
|
||||||
};
|
};
|
||||||
|
|
||||||
header_2.signature = {
|
header_2.signature = {
|
||||||
let message = header_2.signed_root();
|
let message = header_2.signed_root();
|
||||||
let epoch = slot.epoch(T::slots_per_epoch());
|
|
||||||
signer(proposer_index, &message[..], epoch, Domain::BeaconProposer)
|
signer(proposer_index, &message[..], epoch, Domain::BeaconProposer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user