mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 14:28:37 +00:00
Update constants / types to match specs as of 23.1.19
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use spec::ChainSpec;
|
||||
use types::{BeaconBlock, BeaconBlockBody, Hash256};
|
||||
use types::{BeaconBlock, BeaconBlockBody, Eth1Data, Hash256};
|
||||
|
||||
/// Generate a genesis BeaconBlock.
|
||||
pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBlock {
|
||||
@@ -8,7 +8,10 @@ pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBloc
|
||||
parent_root: spec.zero_hash,
|
||||
state_root,
|
||||
randao_reveal: spec.zero_hash,
|
||||
candidate_pow_receipt_root: spec.zero_hash,
|
||||
eth1_data: Eth1Data {
|
||||
deposit_root: Hash256::zero(),
|
||||
block_hash: Hash256::zero(),
|
||||
},
|
||||
signature: spec.empty_signature.clone(),
|
||||
body: BeaconBlockBody {
|
||||
proposer_slashings: vec![],
|
||||
@@ -48,7 +51,8 @@ mod tests {
|
||||
assert!(genesis_block.slot == 0);
|
||||
assert!(genesis_block.parent_root.is_zero());
|
||||
assert!(genesis_block.randao_reveal.is_zero());
|
||||
assert!(genesis_block.candidate_pow_receipt_root.is_zero()); // aka deposit_root
|
||||
assert!(genesis_block.eth1_data.deposit_root.is_zero());
|
||||
assert!(genesis_block.eth1_data.block_hash.is_zero());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -80,8 +80,8 @@ pub fn genesis_beacon_state(spec: &ChainSpec) -> Result<BeaconState, Error> {
|
||||
/*
|
||||
* PoW receipt root
|
||||
*/
|
||||
processed_pow_receipt_root: spec.processed_pow_receipt_root,
|
||||
candidate_pow_receipt_roots: vec![],
|
||||
latest_eth1_data: spec.intial_eth1_data.clone(),
|
||||
eth1_data_votes: vec![],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -213,10 +213,7 @@ mod tests {
|
||||
|
||||
let state = genesis_beacon_state(&spec).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
state.processed_pow_receipt_root,
|
||||
spec.processed_pow_receipt_root
|
||||
);
|
||||
assert!(state.candidate_pow_receipt_roots.is_empty());
|
||||
assert_eq!(&state.latest_eth1_data, &spec.intial_eth1_data);
|
||||
assert!(state.eth1_data_votes.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user