Skip to content
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

New utility methods for Common (loosely connected to Eth64 implementation) #805

Merged
merged 1 commit into from
Jul 4, 2020

Conversation

holgerd77
Copy link
Member

Related to ethereumjs/ethereumjs-devp2p#82

This PR adds the following methods to the Common library together with associated tests:

  • nextHardforkBlock() - Returns the next HF block for a HF provided or set
  • isNextHardforkBlock() - Some convenience additional utility method, matching the existing hardforkBlock() / isHardforkBlock() method setup
  • hardforkForForkHash() - Returns the data available for a HF given a specific forkHash

All functions are triggered by needs of the Eth64 implementation, but will likely - especially the first two next-HF-block functions also be useful in other contexts, e.g. for switching the HF setting on the client along block download.

@codecov
Copy link

codecov bot commented Jul 2, 2020

Codecov Report

Merging #805 into master will increase coverage by 0.13%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #805      +/-   ##
==========================================
+ Coverage   84.32%   84.46%   +0.13%     
==========================================
  Files          17       17              
  Lines        1231     1242      +11     
  Branches      246      247       +1     
==========================================
+ Hits         1038     1049      +11     
  Misses        125      125              
  Partials       68       68              
Flag Coverage Δ
#account 92.85% <ø> (ø)
#block 80.15% <ø> (ø)
#blockchain 84.71% <ø> (ø)
#common 93.98% <100.00%> (+0.38%) ⬆️
#ethash 85.40% <ø> (ø)
#tx 94.16% <ø> (ø)
Impacted Files Coverage Δ
packages/common/src/index.ts 93.92% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dacc853...f0e547d. Read the comment docs.

@holgerd77 holgerd77 force-pushed the add-next-fork-method-to-common branch from 1177ae4 to f316dab Compare July 2, 2020 14:42
Copy link
Member

@jochem-brouwer jochem-brouwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicky comments

packages/common/src/index.ts Show resolved Hide resolved
packages/common/src/index.ts Outdated Show resolved Hide resolved
packages/common/src/index.ts Show resolved Hide resolved
@jochem-brouwer
Copy link
Member

These block tests sometimes seem to timeout. I also had this on some other PR. If you re-run the CI there's a chance it'll pass.

@holgerd77 holgerd77 force-pushed the add-next-fork-method-to-common branch from f316dab to 9d3271f Compare July 2, 2020 16:50
@holgerd77 holgerd77 force-pushed the add-next-fork-method-to-common branch from 9d3271f to f0e547d Compare July 3, 2020 21:32
@holgerd77 holgerd77 merged commit e5a140b into master Jul 4, 2020
@holgerd77 holgerd77 deleted the add-next-fork-method-to-common branch July 4, 2020 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants