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

Common File Layout Alignment #1915

Merged
merged 3 commits into from
May 27, 2022
Merged

Common File Layout Alignment #1915

merged 3 commits into from
May 27, 2022

Conversation

acolytec3
Copy link
Contributor

Fixes #1913

@acolytec3
Copy link
Contributor Author

Barring something I missed somewhere in an obscure test, this should be ready for a first round of review. The important bits are the common reorganization changes. There are tons of changes elsewhere but they are just copy/paste updates for the enums more or less.

@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #1915 (859b40c) into develop (9e98dc8) will increase coverage by 0.02%.
The diff coverage is 95.56%.

Impacted file tree graph

Flag Coverage Δ
block 85.28% <ø> (ø)
blockchain 83.13% <ø> (ø)
client 77.75% <ø> (ø)
common 95.57% <95.56%> (+0.05%) ⬆️
devp2p 82.83% <ø> (-0.14%) ⬇️
ethash 90.81% <ø> (ø)
statemanager 84.24% <ø> (ø)
trie 80.64% <ø> (+0.49%) ⬆️
tx 92.09% <ø> (ø)
util 87.29% <ø> (ø)
vm 81.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@acolytec3
Copy link
Contributor Author

Okay, now it's really ready for review.

@@ -20,7 +20,7 @@ import util from 'util'

tape('[Block]: block functions', function (t) {
t.test('should test block initialization', function (st) {
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Chainstart })
const common = new Common({ chain: ChainId.Mainnet, hardfork: HardforkName.Chainstart })
Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry, but I find both these renaming very unfortunate, I didn't think that you would change these actually.

These are all over the place, we settled on the short names a long time ago (and I honestly also like these a lot) and this is also used by the Community on all their instantiations, so this would cause a lot of unnecessary hazzle.

Can you please name back? If this conflicts with something else, then please rename the "else" part, but this should really stay stable and untouched.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, though alternatively can we rename the corresponding Hardfork and Chain interfaces? It makes no sense to me to have both an enum and an interface with the same name and produces all sorts of naming collisions.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, these are a lot more uncritical, since close to no one will use these directly. So maybe we can do HardforkConfig and ChainConfig for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, I'd already started down this path so will revert all the other commits.

Copy link
Member

Choose a reason for hiding this comment

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

(not sure if we should then rename to GenesisBlockConfig and BootstrapNodeConfig as well for consistency? A bit undecided)

Copy link
Member

Choose a reason for hiding this comment

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

Can you also do:

  1. Remove this eipsType completely and type directly at the one application point with [key: number]: any. This is just polluting the types file and it should be avoided that these kind of super-trivial non-relevant types are exported and eventually used directly by users.
  2. Make sure all types/interfaces/... start with capital letters
  3. genesisStatesType seems not be used at all anywhere, delete?
  4. Rename ChainsType to something more consistent (we never have Type in the name somewhere else, at least if it is meant in the sense of "TypeScript Type" (so we do have ConsensusType, but that has another semantics)), I would suggest ChainsConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe I've addressed all the feedback here. I know @ryanio mentioned combining the types/enums into one file but I kind of like them separated. Just makes things more readable to my way of thinking but could be persuaded otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice thanks, just took a look, yeah i think it is kind of nice to have them separated actually :)

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Ah, much smaller diff, nice, this looks great now! 🙂

Thanks a lot Andrew!

Will merge.

@holgerd77 holgerd77 merged commit 5bf632b into develop May 27, 2022
@holgerd77 holgerd77 deleted the common-refactor branch May 27, 2022 10:16
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* common: create new common.ts

* common: finish reorganize/rename in common

* Address comments
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* common: create new common.ts

* common: finish reorganize/rename in common

* Address comments
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* common: create new common.ts

* common: finish reorganize/rename in common

* Address comments
g11tech pushed a commit that referenced this pull request Jun 3, 2022
* common: create new common.ts

* common: finish reorganize/rename in common

* Address comments
holgerd77 pushed a commit that referenced this pull request Jun 8, 2022
* common: create new common.ts

* common: finish reorganize/rename in common

* Address comments
@holgerd77 holgerd77 changed the title Common refactor Common File Layout Alignment Jun 14, 2022
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.

Common: Align File Layout with other Libraries
3 participants