-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Introduce more optional features in ethcore #9020
Conversation
It looks like @udoprog signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
error: Could not compile |
@5chdn Ah, tests are run with |
I'm not sure if I understand your comment correctly. |
@tomaka well... yeah :). That made it click. They should be part of the dependency, not the local |
564d801
to
780a2c8
Compare
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.
While I totally understand the ambition to reduce ethcore
compile times and complexity, I am not sure I agree that this is the right approach. It seems to add a lot of visual clutter and adding a barrier to reason about the code – "is this code compiled for the binary used?" is not something I'd like to ponder while fixing user bugs.
At the very least, the various features need good docs that explain when/why they're used.
For what it's worth, this feature is desirable for #7915 because |
@dvdplm Hey!
Increasing modularization seems to be the right long term approach. Features are more like a way to get it done right now, and they can be removed as things are broken up into more composable traits, types, and crates. But apart from not being as visible as a dependency, a missing feature causes a compile-time error similar to a missing dependency.
Note that the features introduced here are not gated in the binary (thanks due to the comment by @tomaka). You would get a compile time error if you try to use a type or function that is feature-gated in |
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.
The intent is good, just some minor issues.
ethcore/src/miner/miner.rs
Outdated
@@ -211,6 +213,7 @@ pub struct Miner { | |||
} | |||
|
|||
impl Miner { | |||
#[cfg(feature = "work-notify")] |
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.
Nit: this line should be under the ///
comment.
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.
Fixed!
ethcore/src/miner/stratum.rs
Outdated
{ | ||
let _stratum = stratum; | ||
} | ||
|
||
Ok(()) |
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.
IMO, an error should be returned if work-notify
is disabled.
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.
In that case, maybe we should just gate the pub fn register
function for a compile-time error?
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.
Since the stratum
feature is mandatory in the Parity client, I guess it's indeed better to disable the function entirely.
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.
Done, thanks!
miner/src/gas_pricer.rs
Outdated
|
||
/// Struct to look after updating the acceptable gas price of a miner. | ||
#[derive(Debug, PartialEq)] | ||
pub enum GasPricer { | ||
/// A fixed gas price in terms of Wei - always the argument given. | ||
Fixed(U256), | ||
#[cfg(feature = "price-info")] |
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.
Nit: should be under the ///
.
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.
Fixed!
miner/src/gas_pricer.rs
Outdated
/// Gas price is calibrated according to a fixed amount of USD. | ||
Calibrated(GasPriceCalibrator), | ||
} | ||
|
||
impl GasPricer { | ||
#[cfg(feature = "price-info")] |
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.
Nit: should be under the ///
.
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.
Fixed! ... Thanks!
780a2c8
to
ec39246
Compare
@udoprog Ok, I rest my case! :) |
ec39246
to
08d0e6f
Compare
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: Fixes for misbehavior reporting in AuthorityRound (openethereum#8998) A last bunch of txqueue performance optimizations (openethereum#9024) reduce number of constraints for triedb types (openethereum#9043) bump fs-swap to 0.2.3 so it is compatible with osx 10.11 again (openethereum#9050) Recursive test (openethereum#9042) Introduce more optional features in ethcore (openethereum#9020) Update ETSC bootnodes (openethereum#9038) Optimize pending transactions filter (openethereum#9026) eip160/eip161 spec: u64 -> BlockNumber (openethereum#9044)
WorkPoster::new(&cmd.miner_extras.work_notify, fetch.clone(), event_loop.remote()) | ||
)); | ||
|
||
#[cfg(feature = "work-notify")] |
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.
That's never enabled. main Cargo.toml
doesn't have that feature.
This introduces optional features to
ethcore
. If they are not enabled, they leave out the entire hyper/tokio ecosystem which is a lot of dependencies which are not needed when doing things like smart contract testing (e.g. parables).This is
cargo tree --verbose
in./ethcore
before and after the change.Before:
After: