-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abscissify light node #125
Merged
Merged
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5b4562e
Boilerplate: Add lite-node crate
liamsi 73004d8
Added config options & copied code into new app crate
liamsi 85f2bb3
Delete tendermint-lite: replaced by lite-node
liamsi 4ee6dfd
lite -> light
liamsi 7cc055f
minor improvements to comments / docs
liamsi 02cb776
Fix a few merge hicks (catch up with latest changes from master)
liamsi 5cd3724
fix rebasing hicks
liamsi bacca03
Bucky/abscissify adr (#148)
ebuchman 8576487
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi d41487e
Dealing with the merging in master aftermath
liamsi c2864b6
🔀🔀all these merge conflicts 🔀🔀
liamsi 398be33
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi 2b17e28
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi 42ef409
merged in master
liamsi 1da4922
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi 9c4fd2f
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi ba0afe4
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi 43c74a5
Fix merge master fallout (related to #169)
liamsi 1d2d04f
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
liamsi 6150a72
Use `abscissa_tokio` and resolve merge conflicts
liamsi a005ae9
New stable rust -> new clippy errs -> fixed
liamsi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,22 @@ | ||
[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" } | ||
tokio = "0.2" | ||
|
||
[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,109 @@ | ||
//! LightNode Abscissa Application | ||
|
||
use crate::{commands::LightNodeCmd, config::LightNodeConfig}; | ||
use abscissa_core::{ | ||
application::{self, AppCell}, | ||
config, trace, Application, EntryPoint, FrameworkError, StandardPaths, | ||
}; | ||
|
||
/// 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 components = self.framework_components(command)?; | ||
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() | ||
} | ||
} | ||
} |
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,11 @@ | ||
//! Main entry point for LightNode | ||
|
||
#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)] | ||
#![forbid(unsafe_code)] | ||
|
||
use light_node::application::APPLICATION; | ||
|
||
/// Boot LightNode | ||
fn main() { | ||
abscissa_core::boot(&APPLICATION); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be split into it's own PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! It was a separate PR (see #148) but can definitely be broken out again if it makes sense.