-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Boilerplate: Add lite-node crate - ran `abscissa new lite-node` - added deps (Cargo.toml) and minimal changes to README.md - add to root workspace * Added config options & copied code into new app crate - copied from tendermint-lite/src/main.rs to lite-node/src/command/start.rs * Delete tendermint-lite: replaced by lite-node * lite -> light * minor improvements to comments / docs minor improvements to comments / docs * Fix a few merge hicks (catch up with latest changes from master) rename some vars and more logical bisection in cmd * fix rebasing hicks * Bucky/abscissify adr (#148) * adr-002 lite client (#54) * adr-002 lite client * finish adr * address Dev's comments * lite -> light * Apply suggestions from code review Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com> * updates from review * Apply suggestions from code review Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com> * update for better abstraction and latest changes * note about detection * update image. manager -> syncer * update image * update image * More detailed diagram of lite client data flow (#106) * refactor * refactor into more adrs * minor fixes from review * sync adr-003 with latest and call it * rust code blocks Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com> Co-authored-by: jibrown <jackie.ilana.brown@gmail.com> * working on adr-004 Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com> Co-authored-by: jibrown <jackie.ilana.brown@gmail.com> * Dealing with the merging in master aftermath * merged in master * Fix merge master fallout (related to #169) * Use `abscissa_tokio` and resolve merge conflicts * New stable rust -> new clippy errs -> fixed Co-authored-by: Ethan Buchman <ethan@coinculture.info> Co-authored-by: jibrown <jackie.ilana.brown@gmail.com>
- Loading branch information
1 parent
911862c
commit 471ac8f
Showing
24 changed files
with
777 additions
and
237 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
members = [ | ||
"tendermint", | ||
"tendermint-lite", | ||
"light-node", | ||
] |
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
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,2 @@ | ||
/target | ||
**/*.rs.bk |
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,24 @@ | ||
[package] | ||
name = "light_node" | ||
authors = ["Ethan Buchman <ethan@coinculture.info>", "Ismail Khoffi <Ismail.Khoffi@gmail.com>"] | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
gumdrop = "0.7" | ||
serde = { version = "1", features = ["serde_derive"] } | ||
tendermint = { version = "0.12.0-rc0", path = "../tendermint" } | ||
async-trait = "0.1" | ||
tokio = { version = "0.2", features = ["full"] } | ||
abscissa_tokio = "0.5" | ||
|
||
[dependencies.abscissa_core] | ||
version = "0.5.0" | ||
# optional: use `gimli` to capture backtraces | ||
# see https://github.com/rust-lang/backtrace-rs/issues/189 | ||
# features = ["gimli-backtrace"] | ||
|
||
[dev-dependencies] | ||
abscissa_core = { version = "0.5.0", features = ["testing"] } | ||
once_cell = "1.2" | ||
|
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,14 @@ | ||
# LightNode | ||
|
||
Tendermint light client node. | ||
|
||
## Getting Started | ||
|
||
This application is authored using [Abscissa], a Rust application framework. | ||
|
||
For more information, see: | ||
|
||
[Documentation] | ||
|
||
[Abscissa]: https://github.com/iqlusioninc/abscissa | ||
[Documentation]: https://docs.rs/abscissa_core/ |
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,111 @@ | ||
//! LightNode Abscissa Application | ||
|
||
use crate::{commands::LightNodeCmd, config::LightNodeConfig}; | ||
use abscissa_core::{ | ||
application::{self, AppCell}, | ||
config, trace, Application, EntryPoint, FrameworkError, StandardPaths, | ||
}; | ||
use abscissa_tokio::TokioComponent; | ||
|
||
/// Application state | ||
pub static APPLICATION: AppCell<LightNodeApp> = AppCell::new(); | ||
|
||
/// Obtain a read-only (multi-reader) lock on the application state. | ||
/// | ||
/// Panics if the application state has not been initialized. | ||
pub fn app_reader() -> application::lock::Reader<LightNodeApp> { | ||
APPLICATION.read() | ||
} | ||
|
||
/// Obtain an exclusive mutable lock on the application state. | ||
pub fn app_writer() -> application::lock::Writer<LightNodeApp> { | ||
APPLICATION.write() | ||
} | ||
|
||
/// Obtain a read-only (multi-reader) lock on the application configuration. | ||
/// | ||
/// Panics if the application configuration has not been loaded. | ||
pub fn app_config() -> config::Reader<LightNodeApp> { | ||
config::Reader::new(&APPLICATION) | ||
} | ||
|
||
/// LightNode Application | ||
#[derive(Debug)] | ||
pub struct LightNodeApp { | ||
/// Application configuration. | ||
config: Option<LightNodeConfig>, | ||
|
||
/// Application state. | ||
state: application::State<Self>, | ||
} | ||
|
||
/// Initialize a new application instance. | ||
/// | ||
/// By default no configuration is loaded, and the framework state is | ||
/// initialized to a default, empty state (no components, threads, etc). | ||
impl Default for LightNodeApp { | ||
fn default() -> Self { | ||
Self { | ||
config: None, | ||
state: application::State::default(), | ||
} | ||
} | ||
} | ||
|
||
impl Application for LightNodeApp { | ||
/// Entrypoint command for this application. | ||
type Cmd = EntryPoint<LightNodeCmd>; | ||
|
||
/// Application configuration. | ||
type Cfg = LightNodeConfig; | ||
|
||
/// Paths to resources within the application. | ||
type Paths = StandardPaths; | ||
|
||
/// Accessor for application configuration. | ||
fn config(&self) -> &LightNodeConfig { | ||
self.config.as_ref().expect("config not loaded") | ||
} | ||
|
||
/// Borrow the application state immutably. | ||
fn state(&self) -> &application::State<Self> { | ||
&self.state | ||
} | ||
|
||
/// Borrow the application state mutably. | ||
fn state_mut(&mut self) -> &mut application::State<Self> { | ||
&mut self.state | ||
} | ||
|
||
/// Register all components used by this application. | ||
/// | ||
/// If you would like to add additional components to your application | ||
/// beyond the default ones provided by the framework, this is the place | ||
/// to do so. | ||
fn register_components(&mut self, command: &Self::Cmd) -> Result<(), FrameworkError> { | ||
let mut components = self.framework_components(command)?; | ||
components.push(Box::new(TokioComponent::new()?)); | ||
self.state.components.register(components) | ||
} | ||
|
||
/// Post-configuration lifecycle callback. | ||
/// | ||
/// Called regardless of whether config is loaded to indicate this is the | ||
/// time in app lifecycle when configuration would be loaded if | ||
/// possible. | ||
fn after_config(&mut self, config: Self::Cfg) -> Result<(), FrameworkError> { | ||
// Configure components | ||
self.state.components.after_config(&config)?; | ||
self.config = Some(config); | ||
Ok(()) | ||
} | ||
|
||
/// Get tracing configuration from command-line options | ||
fn tracing_config(&self, command: &EntryPoint<LightNodeCmd>) -> trace::Config { | ||
if command.verbose { | ||
trace::Config::verbose() | ||
} else { | ||
trace::Config::default() | ||
} | ||
} | ||
} |
Oops, something went wrong.