mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 19:34:37 +00:00
Merge branch 'genesis_tests' into spec-updates
This commit is contained in:
@@ -37,12 +37,10 @@ mod tests {
|
||||
genesis_beacon_block(state_root, &spec);
|
||||
}
|
||||
|
||||
// Tests items that are 0 or zero_hash
|
||||
#[test]
|
||||
fn test_zero_items() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
// Note: state_root will not be available without a state (test in beacon_state)
|
||||
let state_root = Hash256::zero();
|
||||
|
||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||
@@ -53,12 +51,10 @@ mod tests {
|
||||
assert!(genesis_block.candidate_pow_receipt_root.is_zero()); // aka deposit_root
|
||||
}
|
||||
|
||||
// Tests the BeaconBlockBody inside BeaconBlock
|
||||
#[test]
|
||||
fn test_beacon_body() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
// Note: state_root will not be available without a state (test in beacon_state)
|
||||
let state_root = Hash256::zero();
|
||||
|
||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||
@@ -76,7 +72,6 @@ mod tests {
|
||||
fn test_signature() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
// Note: state_root will not be available without a state (test in beacon_state)
|
||||
let state_root = Hash256::zero();
|
||||
|
||||
let genesis_block = genesis_beacon_block(state_root, &spec);
|
||||
@@ -86,7 +81,6 @@ mod tests {
|
||||
let raw_sig = genesis_block.signature.as_raw();
|
||||
let raw_sig_bytes = raw_sig.as_bytes();
|
||||
|
||||
assert!(raw_sig_bytes.len() == 97);
|
||||
for item in raw_sig_bytes.iter() {
|
||||
assert!(*item == 0);
|
||||
}
|
||||
|
||||
@@ -93,14 +93,11 @@ impl From<ValidatorAssignmentError> for Error {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
extern crate bls;
|
||||
extern crate validator_induction;
|
||||
|
||||
use super::*;
|
||||
use types::Hash256;
|
||||
|
||||
#[test]
|
||||
fn test_gen_state() {
|
||||
fn test_genesis_state() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -111,9 +108,8 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// Test Misc
|
||||
#[test]
|
||||
fn test_gen_state_misc() {
|
||||
fn test_genesis_state_misc() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -125,9 +121,8 @@ mod tests {
|
||||
assert_eq!(state.fork_data.fork_slot, 0);
|
||||
}
|
||||
|
||||
// Test validators
|
||||
#[test]
|
||||
fn test_gen_state_validators() {
|
||||
fn test_genesis_state_validators() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -139,9 +134,8 @@ mod tests {
|
||||
assert_eq!(state.validator_registry_delta_chain_tip, Hash256::zero());
|
||||
}
|
||||
|
||||
// Test randomness and committees
|
||||
#[test]
|
||||
fn test_gen_state_randomness_committees() {
|
||||
fn test_genesis_state_randomness_committees() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -166,13 +160,11 @@ mod tests {
|
||||
}
|
||||
|
||||
// Custody not implemented until Phase 1
|
||||
// This test will always pass until Phase 1
|
||||
#[test]
|
||||
fn test_gen_state_custody() {}
|
||||
fn test_genesis_state_custody() {}
|
||||
|
||||
// Test finality
|
||||
#[test]
|
||||
fn test_gen_state_finanilty() {
|
||||
fn test_genesis_state_finanilty() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -183,9 +175,8 @@ mod tests {
|
||||
assert_eq!(state.finalized_slot, 0);
|
||||
}
|
||||
|
||||
// Test recent state
|
||||
#[test]
|
||||
fn test_gen_state_recent_state() {
|
||||
fn test_genesis_state_recent_state() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
@@ -216,9 +207,8 @@ mod tests {
|
||||
assert!(state.batched_block_roots.is_empty());
|
||||
}
|
||||
|
||||
// Test PoW Receipts a.k.a. deposits
|
||||
#[test]
|
||||
fn test_gen_state_deposit_root() {
|
||||
fn test_genesis_state_deposit_root() {
|
||||
let spec = ChainSpec::foundation();
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user