-
Notifications
You must be signed in to change notification settings - Fork 790
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
Common: Rename/delete ambiguous active* methods #1674
Comments
Short note: have done several post corrections, please read on site! 🙂 |
Ok, had another deeper look here: even the With this I would really pledge to delete all three messages. Actually I guess it is safe to execute on this if there are 24 hours or so more with no objections raised here. So - as a summary - "action items" on this would be:
|
@holgerd77 I was able to adapt I ran into an issue in your suggestion for removing |
@emersonmacro Ok, I would cautiously say here (if someone wants to correct feel free, otherwise you can execute I guess): this internal I have looked at the 3-4 usages of this function, all should remain safe to execute. You need to adopt the following boolean checks though a bit and first check for the respective Just thinking a bit, maybe you want to add one respective additional test (if not already existing) per And, then - to make things complete - Would also be nice if you collect the change semantics for functions a bit together we have made through all of this and post as a list or so in your initial PR comment, so that we have this a bit together for the release notes. Thanks a lot! 😄 |
Closed by #1753 |
There currently is some ambiguity around methods named with "active*" in the Common library, see index.ts implementation (best take the version from the
develop
branch, since there has already been some additional bloat along "active HFs" being removed by #1649 so this is easier to digest).So there is basically the meaning of "active" in meaning that a HF respectively its rules are activated (e.g. on a certain block number). I guess this is the intuitive and expected meaning respectively semantics. So the associated method names should be kept:
hardforkIsActiveOnBlock()
activeOnBlock()
The second used version for "active" in method names is rather meaning: "is generally included (but not necessarily: active 😋) on the chain.
These should be renamed for clarity, this ambiguity has already let to wrong usage patterns in the past.
Following suggestings:
hardforkIsActiveOnChain
->isIncludedHardfork
activeHardforks
->includedHardforks
activeHardfork
->lastestIncludedHardfork
Another thing I noticed together with an alternative solution:
All these three methods are extremely little used. For our monorepo:
hardforkIsActiveOnChain
-> One usage in block headeractiveHardforks
-> No external usage, several Common internal usagesactiveHardfork
-> One usage in block headerBoth usages are actually even suboptimal usages of the Common API and can be replaced by other Common functions. For 1. all the four lines or so of various checks can be replaced with a single
hardforkIsActiveOnBlock()
call if I am not mistaken. For 3. agetHardforkByBlockNumber()
would be the replacement and - furthermore - this whole_getHardfork()
function in block is generally misplaced and should be removed entirely (not sure if this would lead to some necessary tweaks), since normally the hardfork should directly be retrieved by Common, this is some sort of strange functionality "doubling".So I wonder if we should rather - at least for 1. and 3. - remove these functions at all. 🤔
I think this whole semantics is somewhat confusing, regardless of the name.
For 2. we might consider to rather make an internal private function (since this is a helpful utility function inside of Common) or maybe we keep this single one (but then also do the renaming).
Thoughts?
The text was updated successfully, but these errors were encountered: