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

Monorepo: remove default exports #2018

Merged
merged 4 commits into from
Jul 8, 2022
Merged

Conversation

gabrocheleau
Copy link
Contributor

@gabrocheleau gabrocheleau commented Jul 5, 2022

This PR removes all instances of default exports within the monorepo. It also adds the 'import/no-default-export' linting rule that will prevent the addition of new default exports.

Resolves #2013

@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #2018 (edfd022) into master (5b1da6a) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

Flag Coverage Δ
block 84.30% <100.00%> (ø)
blockchain 80.06% <100.00%> (ø)
client 78.34% <100.00%> (ø)
common 95.03% <100.00%> (ø)
devp2p 82.71% <100.00%> (+0.06%) ⬆️
ethash 90.81% <100.00%> (ø)
evm 40.32% <100.00%> (-0.03%) ⬇️
rlp 90.47% <100.00%> (-0.08%) ⬇️
statemanager 84.55% <100.00%> (ø)
trie 73.72% <100.00%> (-0.49%) ⬇️
tx 92.17% <100.00%> (ø)
util 87.03% <100.00%> (ø)
vm 78.58% <100.00%> (ø)

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

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.

Just went through for a first round, some things to address, generally this looks really really great though, thanks for all the work here!! 😄 👍

Please be really careful on the branch update with the VM/EVM README files since I put a lot of work in these rewriting the text and coming up with an adopted structure. So please do not use the merge function or so, this will close to for sure not work. I guess best rather is here to just copy over the versions from master and the manually re-apply the path adoptions, can't imagine that there is another chance to get this done right.

Also: I would like to merge this in early here, since changes are so vast, this will likely get conflicting with other work pretty quickly (I e.g. already postponed additional README work on the other libs today due to some fear of getting into the same situation as in VM/EVM again).

So, in case this isn't complete yet, it would be good if we can in doubt rather fix the current state and then merge here and do the work on top in favor of having these open for several more days. But for sure also totally depends on a) what's open and b) what are your free times to tackle. So this is rather just a general note and very much needs to be adopted to the situation.

// Provide your block data here or use default values
},
{ common }
)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, please do not change code examples from CHANGELOG files from the older (non-beta) library versions. The CHANGELOG examples are always "tied" to the respective versions, otherwise it would make not much sense.

Sorry, this might get a bit laborious, since this is actually present in all/most CHANGELOG files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I left the changes in the .md files in a separate commit so that they're easily removable, but I'm unsure why a lot of this sort of formatting was automatically done, I assumed it was project-configured formatting that only got triggered now that changes were made to these files? Anyhow will revert most of these, if we want to improve .md formatting we can always do it in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

👍

| `blockchain:clique` | Clique operations like updating the vote and/or signer list |
| Logger | Description |
| ------------------- | ----------------------------------------------------------- |
| `blockchain:clique` | Clique operations like updating the vote and/or signer list |
Copy link
Member

Choose a reason for hiding this comment

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

I guess I am not such a fan of these corrections, since this also renders correctly with the short version, so this just leads to slightly more work, since one now always has to adopt the length when rewriting the description.

Copy link
Member

Choose a reason for hiding this comment

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

On the plus side I see that this is somewhat more readable in the raw format.

Not sure, maybe there are also other opinions from the team and we can find a rather common ground? Also do not want to impose my personal preferences here (and some similar other locations).


const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
const vm = new VM({ common })
vm._common.isActivatedEIP(4399) // true
```

- [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) Support: Supplant DIFFICULTY opcode with PREVRANDAO, PR [#1565](https://
github.com/ethereumjs/ethereumjs-monorepo/pull/1565)
github.com/ethereumjs/ethereumjs-monorepo/pull/1565)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, no, these kind of format corrections are not correct, this simply destroys the correct rendering and draws the URL apart, see the rendered version of this file.

Please make sure that you haven't updated anywhere else in a similar fashion.

@@ -439,7 +439,7 @@ See PR [#1198](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1198).

**Features**

- Added `receipt` to `RunTxResult`, moved the tx receipt generation logic from `VM.runBlock()` to `VM.runTx()` (`generateTxReceipt()` and receipt exports in `runBlock` are now marked as *deprecated*), PR [#1185](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1185)
- Added `receipt` to `RunTxResult`, moved the tx receipt generation logic from `VM.runBlock()` to `VM.runTx()` (`generateTxReceipt()` and receipt exports in `runBlock` are now marked as _deprecated_), PR [#1185](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1185)
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, since these corrections are all over the place: isn't *deprecated* (e.g.) correct markdown? 🤔

@@ -1,7 +1,7 @@
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'

export default function (opts: PrecompileInput): ExecResult {
export function precompile04(opts: PrecompileInput): ExecResult {
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, definitely a better name than my pc suggestion. 🙂

@gabrocheleau gabrocheleau force-pushed the monorepo/remove-default-exports branch from 1b99dbb to 2c95530 Compare July 7, 2022 17:23
@gabrocheleau gabrocheleau requested a review from holgerd77 July 7, 2022 20:04
@gabrocheleau gabrocheleau marked this pull request as ready for review July 7, 2022 20:04
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.

Love it (to speak with Tim Beiko 😋), also thanks for addressing this so quickly then I can continue with the README updates today! ❤️

Also totally love the linting rule and the generality of this - thanks for suggesting - this is now just such a pure simplification and a general we-are-done-with-it thing - really with no substantial downsides - always great to have these structural simplifications in the whole monorepo where one has the feeling that things just get easier to handle.

Will merge.

@holgerd77 holgerd77 merged commit b30f914 into master Jul 8, 2022
@holgerd77 holgerd77 deleted the monorepo/remove-default-exports branch July 8, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment