mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-05 01:00:59 +00:00
Add untested attestation validation logic
This commit is contained in:
@@ -37,6 +37,12 @@ impl AttestationData {
|
||||
justified_block_hash: Hash256::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Implement this as a merkle root, once tree_ssz is implemented.
|
||||
// https://github.com/sigp/lighthouse/issues/92
|
||||
pub fn canonical_root(&self) -> Hash256 {
|
||||
Hash256::zero()
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for AttestationData {
|
||||
|
||||
@@ -2,6 +2,7 @@ use super::ValidatorRegistration;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ChainConfig {
|
||||
// Old, potentially outdated constants
|
||||
pub cycle_length: u8,
|
||||
pub deposit_size_gwei: u64,
|
||||
pub shard_count: u16,
|
||||
@@ -10,6 +11,10 @@ pub struct ChainConfig {
|
||||
pub genesis_time: u64,
|
||||
pub slot_duration_millis: u64,
|
||||
pub initial_validators: Vec<ValidatorRegistration>,
|
||||
|
||||
// New constants
|
||||
pub epoch_length: u64,
|
||||
pub min_attestation_inclusion_delay: u64,
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -28,6 +33,10 @@ impl ChainConfig {
|
||||
genesis_time: TEST_GENESIS_TIME,
|
||||
slot_duration_millis: 16 * 1000,
|
||||
initial_validators: vec![],
|
||||
|
||||
// New
|
||||
epoch_length: 64,
|
||||
min_attestation_inclusion_delay: 4,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +63,10 @@ impl ChainConfig {
|
||||
genesis_time: TEST_GENESIS_TIME, // arbitrary
|
||||
slot_duration_millis: 16 * 1000,
|
||||
initial_validators: vec![],
|
||||
|
||||
// New constants
|
||||
epoch_length: 64,
|
||||
min_attestation_inclusion_delay: 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,31 +2,16 @@ use super::Hash256;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct CrosslinkRecord {
|
||||
pub recently_changed: bool,
|
||||
pub slot: u64,
|
||||
pub hash: Hash256,
|
||||
pub shard_block_hash: Hash256,
|
||||
}
|
||||
|
||||
impl CrosslinkRecord {
|
||||
/// Generates a new instance where `dynasty` and `hash` are both zero.
|
||||
pub fn zero() -> Self {
|
||||
Self {
|
||||
recently_changed: false,
|
||||
slot: 0,
|
||||
hash: Hash256::zero(),
|
||||
shard_block_hash: Hash256::zero(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_crosslink_record_zero() {
|
||||
let c = CrosslinkRecord::zero();
|
||||
assert_eq!(c.recently_changed, false);
|
||||
assert_eq!(c.slot, 0);
|
||||
assert!(c.hash.is_zero());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user