Rename OptimisedLMDGhost to BitwiseLMDGhost.

This commit is contained in:
Age Manning
2019-02-20 11:56:58 +11:00
parent 6f74ffc7e6
commit c7acde4fc2
7 changed files with 28 additions and 28 deletions

View File

@@ -37,7 +37,7 @@ fn power_of_2_below(x: u32) -> u32 {
}
/// Stores the necessary data structures to run the optimised lmd ghost algorithm.
pub struct OptimisedLMDGhost<T: ClientDB + Sized> {
pub struct BitwiseLMDGhost<T: ClientDB + Sized> {
/// A cache of known ancestors at given heights for a specific block.
//TODO: Consider FnvHashMap
cache: HashMap<CacheKey<u32>, Hash256>,
@@ -56,7 +56,7 @@ pub struct OptimisedLMDGhost<T: ClientDB + Sized> {
max_known_height: SlotHeight,
}
impl<T> OptimisedLMDGhost<T>
impl<T> BitwiseLMDGhost<T>
where
T: ClientDB + Sized,
{
@@ -64,7 +64,7 @@ where
block_store: Arc<BeaconBlockStore<T>>,
state_store: Arc<BeaconStateStore<T>>,
) -> Self {
OptimisedLMDGhost {
BitwiseLMDGhost {
cache: HashMap::new(),
ancestors: vec![HashMap::new(); 16],
latest_attestation_targets: HashMap::new(),
@@ -253,7 +253,7 @@ where
}
}
impl<T: ClientDB + Sized> ForkChoice for OptimisedLMDGhost<T> {
impl<T: ClientDB + Sized> ForkChoice for BitwiseLMDGhost<T> {
fn add_block(
&mut self,
block: &BeaconBlock,

View File

@@ -9,12 +9,12 @@
//! production**.
//! - [`slow_lmd_ghost`]: This is a simple and very inefficient implementation given in the ethereum 2.0
//! specifications (https://github.com/ethereum/eth2.0-specs/blob/v0.1/specs/core/0_beacon-chain.md#get_block_root).
//! - [`optimised_lmd_ghost`]: This is an optimised version of bitwise LMD-GHOST as proposed
//! - [`bitwise_lmd_ghost`]: This is an optimised version of bitwise LMD-GHOST as proposed
//! by Vitalik. The reference implementation can be found at: https://github.com/ethereum/research/blob/master/ghost/ghost.py
//!
//! [`longest-chain`]: struct.LongestChain.html
//! [`slow_lmd_ghost`]: struct.SlowLmdGhost.html
//! [`optimised_lmd_ghost`]: struct.OptimisedLmdGhost.html
//! [`bitwise_lmd_ghost`]: struct.OptimisedLmdGhost.html
extern crate db;
extern crate ssz;
@@ -22,16 +22,16 @@ extern crate types;
#[macro_use]
extern crate log;
pub mod bitwise_lmd_ghost;
pub mod longest_chain;
pub mod optimised_lmd_ghost;
pub mod slow_lmd_ghost;
use db::stores::BeaconBlockAtSlotError;
use db::DBError;
use types::{BeaconBlock, ChainSpec, Hash256};
pub use bitwise_lmd_ghost::BitwiseLMDGhost;
pub use longest_chain::LongestChain;
pub use optimised_lmd_ghost::OptimisedLMDGhost;
pub use slow_lmd_ghost::SlowLMDGhost;
/// Defines the interface for Fork Choices. Each Fork choice will define their own data structures
@@ -101,6 +101,6 @@ pub enum ForkChoiceAlgorithm {
LongestChain,
/// A simple and highly inefficient implementation of LMD ghost.
SlowLMDGhost,
/// An optimised version of LMD-GHOST by Vitalik.
OptimisedLMDGhost,
/// An optimised version of bitwise LMD-GHOST by Vitalik.
BitwiseLMDGhost,
}