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

Block -> Tree Shaking: Separate Consensus Methods #3563

Closed
holgerd77 opened this issue Aug 6, 2024 · 0 comments · Fixed by #3571
Closed

Block -> Tree Shaking: Separate Consensus Methods #3563

holgerd77 opened this issue Aug 6, 2024 · 0 comments · Fixed by #3571

Comments

@holgerd77
Copy link
Member

holgerd77 commented Aug 6, 2024

Sorry, I am still not willing to fully throw Ethash and Clique out. 🫣 😆 What we can do though is to (easily) further separate.

For Block the consensus related methods should go into separate methods additionally taking in the block object as a first parameter being placed into:

  • consensus/ethash.ts
  • consensus/clique.ts
  • consensus/index.ts (for export as usual, all methods should also be available from root)

Following methods:

  • ethashCanonicalDifficulty()
  • _requireClique() (should also go out from Block and used with additional block parameter from the new location, but not being exposed to users)
  • cliqueSigHash()
  • cliqueIsEpochTransition()
  • cliqueExtraVanity()
  • cliqueExtraSeal()
  • NOT cliqueSealBlock() (separate topic, at least not for this round of work (bound to a constructor option, at least substantially more difficult to substitute/move/replace))
  • cliqueEpochTransitionSigners()
  • cliqueVerifySignature()
  • cliqueSigner()

I would cautiously think we can just keep the method names.

If there are method checks like if Block.ethashCanonicalDifficulty !== undefined in the code base these checks can be removed.

Bundle size for a block example before/after should be provided especially on this one since this should be pretty satisfactory! 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant