mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-03 04:44:28 +00:00
Merge remote-tracking branch 'origin/unstable' into tree-states
This commit is contained in:
@@ -8,10 +8,13 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
types = { path = "../types" }
|
||||
state_processing = { path = "../state_processing" }
|
||||
proto_array = { path = "../proto_array" }
|
||||
eth2_ssz = "0.4.1"
|
||||
eth2_ssz_derive = "0.3.0"
|
||||
slog = { version = "2.5.2", features = ["max_level_trace", "release_max_level_trace"] }
|
||||
|
||||
[dev-dependencies]
|
||||
beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
||||
store = { path = "../../beacon_node/store" }
|
||||
tokio = { version = "1.14.0", features = ["rt-multi-thread"] }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
use types::{BeaconBlock, BeaconState, Checkpoint, EthSpec, ExecPayload, Hash256, Slot};
|
||||
use std::collections::BTreeSet;
|
||||
use std::fmt::Debug;
|
||||
use types::{BeaconBlockRef, BeaconState, Checkpoint, EthSpec, ExecPayload, Hash256, Slot};
|
||||
|
||||
/// Approximates the `Store` in "Ethereum 2.0 Phase 0 -- Beacon Chain Fork Choice":
|
||||
///
|
||||
@@ -17,7 +19,7 @@ use types::{BeaconBlock, BeaconState, Checkpoint, EthSpec, ExecPayload, Hash256,
|
||||
/// concrete struct is to allow this crate to be free from "impure" on-disk database logic,
|
||||
/// hopefully making auditing easier.
|
||||
pub trait ForkChoiceStore<T: EthSpec>: Sized {
|
||||
type Error;
|
||||
type Error: Debug;
|
||||
|
||||
/// Returns the last value passed to `Self::set_current_slot`.
|
||||
fn get_current_slot(&self) -> Slot;
|
||||
@@ -33,7 +35,7 @@ pub trait ForkChoiceStore<T: EthSpec>: Sized {
|
||||
/// choice. Allows the implementer to performing caching or other housekeeping duties.
|
||||
fn on_verified_block<Payload: ExecPayload<T>>(
|
||||
&mut self,
|
||||
block: &BeaconBlock<T, Payload>,
|
||||
block: BeaconBlockRef<T, Payload>,
|
||||
block_root: Hash256,
|
||||
state: &BeaconState<T>,
|
||||
) -> Result<(), Self::Error>;
|
||||
@@ -50,6 +52,12 @@ pub trait ForkChoiceStore<T: EthSpec>: Sized {
|
||||
/// Returns the `finalized_checkpoint`.
|
||||
fn finalized_checkpoint(&self) -> &Checkpoint;
|
||||
|
||||
/// Returns the `unrealized_justified_checkpoint`.
|
||||
fn unrealized_justified_checkpoint(&self) -> &Checkpoint;
|
||||
|
||||
/// Returns the `unrealized_finalized_checkpoint`.
|
||||
fn unrealized_finalized_checkpoint(&self) -> &Checkpoint;
|
||||
|
||||
/// Returns the `proposer_boost_root`.
|
||||
fn proposer_boost_root(&self) -> Hash256;
|
||||
|
||||
@@ -62,6 +70,18 @@ pub trait ForkChoiceStore<T: EthSpec>: Sized {
|
||||
/// Sets the `best_justified_checkpoint`.
|
||||
fn set_best_justified_checkpoint(&mut self, checkpoint: Checkpoint);
|
||||
|
||||
/// Sets the `unrealized_justified_checkpoint`.
|
||||
fn set_unrealized_justified_checkpoint(&mut self, checkpoint: Checkpoint);
|
||||
|
||||
/// Sets the `unrealized_finalized_checkpoint`.
|
||||
fn set_unrealized_finalized_checkpoint(&mut self, checkpoint: Checkpoint);
|
||||
|
||||
/// Sets the proposer boost root.
|
||||
fn set_proposer_boost_root(&mut self, proposer_boost_root: Hash256);
|
||||
|
||||
/// Gets the equivocating indices.
|
||||
fn equivocating_indices(&self) -> &BTreeSet<u64>;
|
||||
|
||||
/// Adds to the set of equivocating indices.
|
||||
fn extend_equivocating_indices(&mut self, indices: impl IntoIterator<Item = u64>);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ mod fork_choice;
|
||||
mod fork_choice_store;
|
||||
|
||||
pub use crate::fork_choice::{
|
||||
AttestationFromBlock, Error, ForkChoice, InvalidAttestation, InvalidBlock,
|
||||
PayloadVerificationStatus, PersistedForkChoice, QueuedAttestation,
|
||||
AttestationFromBlock, CountUnrealized, Error, ForkChoice, ForkChoiceView,
|
||||
ForkchoiceUpdateParameters, InvalidAttestation, InvalidBlock, PayloadVerificationStatus,
|
||||
PersistedForkChoice, QueuedAttestation, ResetPayloadStatuses,
|
||||
};
|
||||
pub use fork_choice_store::ForkChoiceStore;
|
||||
pub use proto_array::{Block as ProtoBlock, ExecutionStatus, InvalidationOperation};
|
||||
pub use proto_array::{
|
||||
Block as ProtoBlock, CountUnrealizedFull, ExecutionStatus, InvalidationOperation,
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user