cd26a19a70
* Renamed fork_choice::process_attestation_from_block * Processing attestation in fork choice * Retrieving state from store and checking signature * Looser check on beacon state validity. * Cleaned up get_attestation_state * Expanded fork choice api to provide latest validator message. * Checking if the an attestation contains a latest message * Correct process_attestation error handling. * Copy paste error in comment fixed. * Tidy ancestor iterators * Getting attestation slot via helper method * Refactored attestation creation in test utils * Revert "Refactored attestation creation in test utils" This reverts commit 4d277fe4239a7194758b18fb5c00dfe0b8231306. * Integration tests for free attestation processing * Implicit conflicts resolved. * formatting * Do first pass on Grants code * Add another attestation processing test * Tidy attestation processing * Remove old code fragment * Add non-compiling half finished changes * Simplify, fix bugs, add tests for chain iters * Remove attestation processing from op pool * Fix bug with fork choice, tidy * Fix overly restrictive check in fork choice. * Ensure committee cache is build during attn proc * Ignore unknown blocks at fork choice * Various minor fixes * Make fork choice write lock in to read lock * Remove unused method * Tidy comments * Fix attestation prod. target roots change * Fix compile error in store iters * Reject any attestation prior to finalization * Fix minor PR comments * Remove duplicated attestation finalization check * Remove awkward `let` statement
50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
mod reduced_tree;
|
|
|
|
use std::sync::Arc;
|
|
use store::Store;
|
|
use types::{BeaconBlock, EthSpec, Hash256, Slot};
|
|
|
|
pub use reduced_tree::ThreadSafeReducedTree;
|
|
|
|
pub type Result<T> = std::result::Result<T, String>;
|
|
|
|
pub trait LmdGhost<S: Store, E: EthSpec>: Send + Sync {
|
|
/// Create a new instance, with the given `store` and `finalized_root`.
|
|
fn new(store: Arc<S>, finalized_block: &BeaconBlock<E>, finalized_root: Hash256) -> Self;
|
|
|
|
/// Process an attestation message from some validator that attests to some `block_hash`
|
|
/// representing a block at some `block_slot`.
|
|
fn process_attestation(
|
|
&self,
|
|
validator_index: usize,
|
|
block_hash: Hash256,
|
|
block_slot: Slot,
|
|
) -> Result<()>;
|
|
|
|
/// Process a block that was seen on the network.
|
|
fn process_block(&self, block: &BeaconBlock<E>, block_hash: Hash256) -> Result<()>;
|
|
|
|
/// Returns the head of the chain, starting the search at `start_block_root` and moving upwards
|
|
/// (in block height).
|
|
fn find_head<F>(
|
|
&self,
|
|
start_block_slot: Slot,
|
|
start_block_root: Hash256,
|
|
weight: F,
|
|
) -> Result<Hash256>
|
|
where
|
|
F: Fn(usize) -> Option<u64> + Copy;
|
|
|
|
/// Provide an indication that the blockchain has been finalized at the given `finalized_block`.
|
|
///
|
|
/// `finalized_block_root` must be the root of `finalized_block`.
|
|
fn update_finalized_root(
|
|
&self,
|
|
finalized_block: &BeaconBlock<E>,
|
|
finalized_block_root: Hash256,
|
|
) -> Result<()>;
|
|
|
|
/// Returns the latest message for a given validator index.
|
|
fn latest_message(&self, validator_index: usize) -> Option<(Hash256, Slot)>;
|
|
}
|