-
Notifications
You must be signed in to change notification settings - Fork 224
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
Move config
module out from tendermint
into its own crate
#983
Comments
I totally agree on the |
From my search I see that the only place where Nevertheless, I think it would be better to keep the The |
It seems like tendermint-rs/tendermint/src/node/info.rs Line 85 in 4a6c450
That being said, I would tend to agree with favoring migration over adding feature guards. |
Hmm in that case perhaps using |
One thing leads to another: I just discovered that |
Both |
|
What's the major difference between isolating these modules into separate crates vs just feature-guarding them? The latter seems like less work to me 🙂 |
@thanethomson using features just requires more rigorous testing of various feature combinations in CI At the very least the crate should be build with each feature in isolation to ensure that works, as well as testing various feature combinations that are known to interact with each other. The latter is the hardest part, as there can be a sort of explosion of combination of features to test. That said, I'm a fan of fine-grained features, and don't think it's an insurmountable problem. I'd suggest getting a basic setup, and then adding combinations of features to test to CI as a sort of regression-ish test whenever you find an incompatible combination. Isolating code in crates is a bit easier in that regard, as it's self-contained by definition. |
I suppose I should also note that TMKMS is a user of |
Feature flags are like weaker version of macros, templates, metaprograms or similar program generation methods that generates different version of the code depending on input boolean values. You can think of it as a metaprogram with a signature like:
The problem is when you have multiple feature flags in a crate, there can be exponential different versions of the code that can be generated. For example with just 4 feature flags, there are technically 2^4 = 16 different versions of your program that needs to be tested. If you combine this with the feature flags of the dependencies, there are just unmanageable number of combinations of programs that need to be tested, even just for passing the type-checking phase. Furthermore, the design of feature flags makes it not possible to "instantiate" multiple versions of the program to co-exist at the same time for testing or different purposes.
I feel that feature flags only bring convenience in the short term, but incurs a high cost in the long term for the additional effort required for maintaining the code. A key challenge I have been facing with making changes to tendermint-rs is with managing the feature flags that it currently already have. I would make some changes that seem to pass the compiler, and it is only when submitted to CI then only realize that there are code path that are not covered because the features are disabled by default locally. The unnecessary complexity force me to be dependent on the CI and much longer compilation feedback loop just to find out whether my changes compiles in all possible situation or not. I feel that a better way of managing compile-time dependencies is by making use of the type system, in particular traits, to help ensure that a program can work generically over all possible compile-time input. An example you can refer to is the design I have for the |
How would we apply this to the case of My sense is that part of the equation in determining whether or not we can even break a module out into a separate crate is the dependency graph. So a module can be broken out if and only if nothing else in the existing crate depends on it. This means that breaking |
I have taken a look at the use of The main difference I see of using Note that the other alternative is to just wait for servo/rust-url#717 to get merged and released. |
Part of informalsystems/hermes#1158.
With #980 there are still a few remaining use of
std
in thetendermint
crate, which is mostly consist of filesystem and network operations to retrieve the config files. By movingtendermint::config
,tendermint::net
and their submodules to a separate crate, we are one step closer to no_std support for thetendermint
crate.The text was updated successfully, but these errors were encountered: