-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove Peers struct, only supply one peer to each light client instance * Remove fork detector from light client instance * Add Debug instance to LightClient * Require all components and their deps to be clonable * Start work on supervisor and fork detection * Allowing supplying the state to work over to the light client * Remove unnecessary instances of operations traits * Remove unnecessary Clone and DynClone instances * Improve docs * Small refactor in supervisor * Finalize fork detection * Fix wrong uses of internal light client state instead of the supplied one * Remove light client's internal state * Remove outdated comments * Ensure the supervisor can be sent across thread boundaries * Rename Handler to Handle * Update comment * Update example to invoke supervisor * Formatting * Working supervisor example * Remove light store committed by error * Compare headers hashes instead of for equality in fork detector * Bubble up I/O errors that may occur during fork detection * Inject fork detector into supervisor * Deduplicate Handle::verify_to_highest/verify_to_target * Move PeerList and its builder into their own module * Record error which caused peer to be deemed faulty * Remove prelude module in favor of explicit imports * Hoist primary hash computation outside of for loop * Throw an error if there are no witnesses when doing fork detection * Rename leftover secondaries to witnesses * Set clock_drift parameter to 10 seconds to match Go default * Add configurable timeouts to Io component * Add the primary node as a witness in the example CLI * Remove witness from peers when request times out during fork detection * Fix PeerList::swap_primary * Improve PeerListBuilder API * Add doc comments * Use enum instead of 0 to denote latest height
- Loading branch information
Showing
29 changed files
with
989 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::fmt; | ||
|
||
/// A boxed `FnOnce(A) -> () + Send`. | ||
pub struct Callback<A> { | ||
inner: Box<dyn FnOnce(A) -> () + Send>, | ||
} | ||
|
||
impl<A> fmt::Debug for Callback<A> { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
f.debug_struct("Callback").finish() | ||
} | ||
} | ||
|
||
impl<A> Callback<A> { | ||
/// Box the given closure in a `Callback`. | ||
pub fn new(inner: impl FnOnce(A) -> () + Send + 'static) -> Self { | ||
Self { | ||
inner: Box::new(inner), | ||
} | ||
} | ||
|
||
/// Call the underlying closure on `result`. | ||
pub fn call(self, result: A) -> () { | ||
(self.inner)(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
//! Components used by the Light Client. | ||
|
||
pub mod clock; | ||
pub mod fork_detector; | ||
pub mod io; | ||
pub mod scheduler; | ||
pub mod verifier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.