mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-06 19:12:20 +00:00
Relove formatting and other issues raise in PR
This commit is contained in:
parent
0b47b81a6c
commit
0e3d0848ac
@ -6,7 +6,6 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bls = { path = "../utils/bls" }
|
bls = { path = "../utils/bls" }
|
||||||
bls-aggregates = { git = "https://github.com/sigp/signature-schemes" }
|
|
||||||
spec = { path = "../spec" }
|
spec = { path = "../spec" }
|
||||||
ssz = { path = "../utils/ssz" }
|
ssz = { path = "../utils/ssz" }
|
||||||
types = { path = "../types" }
|
types = { path = "../types" }
|
||||||
|
@ -53,7 +53,6 @@ mod tests {
|
|||||||
fn test_zero_items() {
|
fn test_zero_items() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
// Note: state_root will not be available without a state (test in beacon_state)
|
|
||||||
let state_root = Hash256::zero();
|
let state_root = Hash256::zero();
|
||||||
|
|
||||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||||
@ -69,7 +68,6 @@ mod tests {
|
|||||||
fn test_beacon_body() {
|
fn test_beacon_body() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
// Note: state_root will not be available without a state (test in beacon_state)
|
|
||||||
let state_root = Hash256::zero();
|
let state_root = Hash256::zero();
|
||||||
|
|
||||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||||
@ -87,7 +85,6 @@ mod tests {
|
|||||||
fn test_signature() {
|
fn test_signature() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
// Note: state_root will not be available without a state (test in beacon_state)
|
|
||||||
let state_root = Hash256::zero();
|
let state_root = Hash256::zero();
|
||||||
|
|
||||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||||
@ -97,7 +94,6 @@ mod tests {
|
|||||||
let raw_sig = genesis_block.signature.as_raw();
|
let raw_sig = genesis_block.signature.as_raw();
|
||||||
let raw_sig_bytes = raw_sig.as_bytes();
|
let raw_sig_bytes = raw_sig.as_bytes();
|
||||||
|
|
||||||
assert!(raw_sig_bytes.len() == 97);
|
|
||||||
for item in raw_sig_bytes.iter() {
|
for item in raw_sig_bytes.iter() {
|
||||||
assert!(*item == 0);
|
assert!(*item == 0);
|
||||||
}
|
}
|
||||||
|
@ -88,14 +88,11 @@ impl From<ValidatorAssignmentError> for Error {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
extern crate bls;
|
|
||||||
extern crate validator_induction;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use types::Hash256;
|
use types::Hash256;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state() {
|
fn test_genesis_state() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -106,9 +103,8 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Misc
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_misc() {
|
fn test_genesis_state_misc() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -120,9 +116,8 @@ mod tests {
|
|||||||
assert_eq!(state.fork_data.fork_slot, 0);
|
assert_eq!(state.fork_data.fork_slot, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test validators
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_validators() {
|
fn test_genesis_state_validators() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -134,9 +129,8 @@ mod tests {
|
|||||||
assert_eq!(state.validator_registry_delta_chain_tip, Hash256::zero());
|
assert_eq!(state.validator_registry_delta_chain_tip, Hash256::zero());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test randomness and committees
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_randomness_committees() {
|
fn test_genesis_state_randomness_committees() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -161,13 +155,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custody not implemented until Phase 1
|
// Custody not implemented until Phase 1
|
||||||
// This test will always pass until Phase 1
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_custody() {}
|
fn test_genesis_state_custody() {}
|
||||||
|
|
||||||
// Test finality
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_finanilty() {
|
fn test_genesis_state_finanilty() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -178,9 +170,8 @@ mod tests {
|
|||||||
assert_eq!(state.finalized_slot, 0);
|
assert_eq!(state.finalized_slot, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test recent state
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_recent_state() {
|
fn test_genesis_state_recent_state() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
@ -211,9 +202,8 @@ mod tests {
|
|||||||
assert!(state.batched_block_roots.is_empty());
|
assert!(state.batched_block_roots.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test PoW Receipts a.k.a. deposits
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_state_deposit_root() {
|
fn test_genesis_state_deposit_root() {
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let state = genesis_beacon_state(&spec).unwrap();
|
let state = genesis_beacon_state(&spec).unwrap();
|
||||||
|
@ -10,7 +10,7 @@ use hashing::canonical_hash;
|
|||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use ssz::{ssz_encode, Decodable, DecodeError, Encodable, SszStream};
|
use ssz::{ssz_encode, Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
// Custody will not be added to the specs until Phase 1 (Sharding Phase) so dummay class used.
|
// Custody will not be added to the specs until Phase 1 (Sharding Phase) so dummy class used.
|
||||||
type CustodyChallenge = usize;
|
type CustodyChallenge = usize;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
|
Loading…
Reference in New Issue
Block a user