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
dvdplm
left a comment
There was a problem hiding this comment.
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 |
tomaka
left a comment
There was a problem hiding this comment.
The intent is good, just some minor issues.
| } | ||
|
|
||
| impl Miner { | ||
| #[cfg(feature = "work-notify")] |
There was a problem hiding this comment.
Nit: this line should be under the /// comment.
| let _stratum = stratum; | ||
| } | ||
|
|
||
| Ok(()) |
There was a problem hiding this comment.
IMO, an error should be returned if work-notify is disabled.
There was a problem hiding this comment.
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.
Since the stratum feature is mandatory in the Parity client, I guess it's indeed better to disable the function entirely.
| 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.
Nit: should be under the ///.
| } | ||
|
|
||
| impl GasPricer { | ||
| #[cfg(feature = "price-info")] |
There was a problem hiding this comment.
Nit: should be under the ///.
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.
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 --verbosein./ethcorebefore and after the change.Before:
After: