-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
EPEE Cleanup Reorganized #8211
EPEE Cleanup Reorganized #8211
Conversation
I would review this if the commits were separated into individual PRs. The reasons behind this are, that this reduces the risk of merge conflicts and that it's a lot of work to do in one go. For these 2 reasons you will typically not get a 2nd opinion, so in effect the PR will not be merged, which would lead to a lot of time waste from your and my side. The 3rd reason for the split, that I personally have, is that some code can possibly still be useful in the future, even if it's unused for now. I'd like to have a possibility to express my opinion about it. The larger the PR, the harder it will be to reach a consensus on this, since the decision is basically binary (to merge or not to merge). |
@mj-xmr I initially said to keep it in one PR and I think it's fine if we discuss everything here, otherwise we will have 10 open PRs about epee cleanup. Most of these changes should be quite uncontroversial anyway. |
See? We have the 1st disagreement already :) |
@mj-xmr What @selsta said about the old PR #8175 is correct. The old PR shows more of my thought process, has much finer changes, and more comments about each change. The problem is that it is lengthy and hard to digest. This PR I focused on ease of review.
I considered this for sure, but I tend to fall under the camp of YAGNI. Many of the deletions are files/functions that were inherited from some botnet that predates the project itself and were never used. EPEE is very daunting for new developers and it doesn't help that ~25% of it is red herring code. Also I figured that the less cruft that you all have to deal with the better.
If you have an issue with a specific part of this PR I'd be happy to hear it, and I think I have it fairly well organized under the old PR, so I can rebase it if needed. Thanks for your time btw! |
@jeffro256 I will conform to how it was expected from you from @selsta , since this was the 1st suggestion in the row, while mine was only the 2nd one. Otherwise we'd be going in circles. I'll have a look then. I just wish that the PR isn't left hanging after being reviewed. |
@selsta I think the vast majority of this PR should be uncontroversial but I'll try to point out a couple of things that might not be:
|
why would there merge conflicts in files untouched for 5+ years? |
I touched some of them myself not so long ago. Somebody else might be right now modifying some of them and starting a PR. But even if not, it's kind of a bad habit and it might bite back if continued this way. And after all, if in meantime somebody were to merge a change to just one of the files and create a conflict, this whole PR has to be updated, rather than a given smaller PR from the whole group. But anyway, I'll just get my hands dirty and start reviewing. |
I agree. Especially since I saw, that with removal of some code from the templates, you took out some heavy boost headers along. I'm just saying that there still might be some nice code from the deletions that you did (like 5%?). Let me have a look and I'll just share my opinion based on my experience of what still could be needed regardless of YAGNI. These opinions can be also safely ignored. |
} | ||
|
||
|
||
bool set_file_time(const std::string& path_to_file, const time_t& ft) |
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.
I think it could be useful and nicely wraps boost::filesystem's heavy headers.
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.
On the other hand, boost::filesystem
functions are already mentioned 245 times in 9 files throughout the project, and I believe boost already has functions for get_file_time
and set_file_time
: https://www.boost.org/doc/libs/1_58_0/libs/filesystem/doc/reference.html#last_write_time
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.
You have to start from somewhere and lead by a good example, even if at the beginning it appears to make no sense, because it's already much worse somewhere else. Bit by bit the better solutions can purge the worse :)
#define AUTO_VAL_INIT(v) boost::value_initialized<decltype(v)>() | ||
|
||
namespace misc_utils | ||
{ | ||
template<typename t_type> | ||
t_type get_max_t_val(t_type t) |
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.
I'd leave it.
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.
Why use get_max_t_val
instead of std::numeric_limits<t_type>::max()
directly? std::numeric_limits
is already used 148 times throughout the project and IMO its confusing to pass in a raw value and receive a static limit unrelated to the value passed to the function.
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.
As far as I see it evaluates to the same type and value.
It's not a state of the art function though anyway.
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.
Yeah it should evaluate to to the same value, but it feels clunkier to use IMO because you pass a raw value of the type that you want to get the limit of, instead of just asking for it based on type.
My personal opinion, I would remove everything unless it can be argued that a function is likely to be used in the future. Something just generally looking useful without any particular use in monero should be removed. Ideally we would shrink epee over time with all new code getting added to |
{ | ||
|
||
template<class t_base_storage> | ||
class gziped_storage: public t_base_storage |
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.
Open for debate, but I find such a "demo" on how to use zipping important.
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 we create a doc then? Maybe we could put it in the EPEE Readme.
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.
Sounds like a compromise for sure.
@jeffro256 They are separate patches so I would not squash. If we want to revert anything specific in the future it's easier this way. |
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.
Rechecked.
I agree.
Knowing ahead of time of the existence of the problem (plenty of dead code + one large PR, even though the commits are separate) and its accompanying risks (merge conflicts, preventing the merge of all of the commits, rather than only the affected ones), making a prediction, which got confirmed twice in both tries (merge bursts), yet still being confronted with criticism and disbelief(?) is a funny feeling. BTW, I didn't insist on keeping the dead code around, just shared an opinion about a few specific functions from a pool of mud for others to consider. Anyway, we're on the same page when it comes to highlighting the need of maintenance... in many forms.
The Monero's CCS is open for anybody. However I think, that Managers would not find this place very attractive for them. We need people who can do the actual work. Ability to manage is just a perk and is not reserved just to Managers. What I think we should do is to simply learn from our own and each others' mistakes and carry on doing what we already do. |
Currently working on an EPEE [ser/de]ialization library for Rust and at first glance, EPEE seemed to have support for optional wrappers. However, after looking into it, this feature appears to be half-baked and unused. Furthermore, adding support for optional values would be better suited to implement at the storage level, in my opinion. That would make parsing DOMs easier and less error-prone. If anyone is currently using this code, please comment. Thanks! At the time of writing, this PR has no merge conflicts with monero-project#8211
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.
Rechecked the recently synchronized file.
@luigi1111 looks good! |
Here lies dozens of unused files. This commit is ONLY file deletions except for the removing of a couple of #includes and removing filenames from CmakeLists where appropriate.
Remove unused include statements or unused definitions.
Actions: 1. Remove unused functions from misc_os_dependent.h 2. Move three remaining functions, get_gmt_time, get_ns_count, and get_tick_count into time_helper.h 3. Remove unused functions from time_helper.h 4. Refactor get_ns_count and get_internet_time_str and get_time_interval_string 5. Remove/add includes as needed Relevant commits on the old PR: a9fbe52 9a59b13 7fa9e28
Relevant commit on old PR: 2499269
Relevant commit from old PR: bd0a511
Relevant commit from old PR: 330df29
Relevant commit in old PR: 1b798a7
ba85aa4
to
1137142
Compare
Rebased to clean up commit history @selsta |
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.
Nothing changed from the reviewer's perspective.
Huzzah! Take that entropy! |
This PR is identical to #8175 but organized in a way that I believe is easier to verify for others. I will not adding any more of my own commits to this PR, but I'm ready to squash or add changes if/when this PR gets approved. If you want more granular comments on changes, I would refer to the old PR, but I'm happy to answer any questions. Thanks for your time!