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

vm, client: continuing v6 breaking changes #1815

Merged
merged 3 commits into from
Apr 2, 2022
Merged

Conversation

ryanio
Copy link
Contributor

@ryanio ryanio commented Mar 24, 2022

This PR accomplishes VM breaking change tasks listed in #1717:

  • Remove deprecated state (Trie) constructor option
  • Remove deprecated generateTxReceipt function in runBlock (preferring newer version located in runTx), remove Receipt re-exports
  • Remove StateManager.getStateRoot() force=true parameter (also in interface)
  • Removed deprecated EIP2930Receipt and EIP1559Receipt types
  • Do gasUsed deduplication Difference between gasUsed and execResult.gasUsed #1446 (comment)
    • Moved EVMResult.gasUsed to RunTxResult where it is added to there, and execResult.gasUsed remains the same
  • Update BaseTxReceipt gasUsed from Buffer to BigInt (suggestion added by @ryanio)
  • runCode throws if gasLimit is undefined: the gasLimit parameter is mandatory
  • Move gasRefund to a tx-level result object instead of ExecResult todo link
    • Moved one level up to EVMResult, since it does not seem appropriate (or used) in execResult

@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1815 (702dc22) into develop (0d44c79) will decrease coverage by 1.01%.
The diff coverage is 84.28%.

❗ Current head 702dc22 differs from pull request most recent head 045cfb4. Consider uploading reports for the commit 045cfb4 to get more accurate results

Impacted file tree graph

Flag Coverage Δ
block 85.17% <ø> (?)
blockchain 84.13% <ø> (?)
client 77.20% <100.00%> (?)
common 94.94% <ø> (?)
devp2p 82.83% <ø> (ø)
ethash 90.71% <ø> (?)
trie 80.27% <ø> (?)
tx 92.48% <ø> (?)
util 89.45% <ø> (?)
vm 82.53% <81.96%> (?)

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

@holgerd77
Copy link
Member

Force-pushed on this with the cherry-picked relevant commits.

@holgerd77
Copy link
Member

Not sure why CI is stuck here, otherwise I would give this a go!

@ryanio ryanio closed this Mar 25, 2022
@ryanio ryanio reopened this Mar 25, 2022
@ryanio
Copy link
Contributor Author

ryanio commented Mar 25, 2022

Not sure why CI is stuck here, otherwise I would give this a go!

thanks, looks good now!

holgerd77
holgerd77 previously approved these changes Mar 25, 2022
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.

LGTM

@ryanio
Copy link
Contributor Author

ryanio commented Mar 25, 2022

ok, noticed some last few things going over the diff again, this should be ready to merge now, thanks @holgerd77 !!!

acolytec3
acolytec3 previously approved these changes Mar 29, 2022
Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Looks great, and probably a long slog. I left one comment about an export that isn't directly related to the overall project of breaking changes but one we should consider.

@@ -6,7 +6,8 @@ import {
BlockBodyBuffer,
} from '@ethereumjs/block'
import { TransactionFactory, TypedTransaction } from '@ethereumjs/tx'
import { bigIntToBuffer, bufferToBigInt, bufferToInt, intToBuffer, rlp } from 'ethereumjs-util'
import { encodeReceipt } from '@ethereumjs/vm/dist/runBlock'
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an easy way to move encodeReceipt to a package level export since we're using this outside of the vm package and this import looks kinda hideous, maybe in a new util.ts since this looks like a pure function? This could be a follow-up as part of a more general overhaul of the vm package getting away from default exports and definitely shouldn't hold up merging this.

Copy link
Contributor Author

@ryanio ryanio Mar 29, 2022

Choose a reason for hiding this comment

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

yeah, good eye, this isn't as scary as it looks (we access vm/dist in a few other places) but definitely a good point to ease access a bit, i think this is likely what holger was aiming with this breaking releases task:

  • Restructure/sort VM exports (directly expose Bloom, other?, unified type location, type/interface exposure, index.ts -> vm.ts+ index.ts only for exports

let's target as a follow-up PR, since this one is already kind of involved, we can hone in on it separately

Copy link
Contributor Author

@ryanio ryanio Mar 29, 2022

Choose a reason for hiding this comment

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

these are our current vm/dist uses on master:

Screen Shot 2022-03-29 at 1 48 59 PM

StateManager uses might be solved with the current refactor to separate it from the vm

@holgerd77 holgerd77 force-pushed the vm-v6-breaking-changes branch from 702dc22 to 045cfb4 Compare April 2, 2022 08:16
@holgerd77
Copy link
Member

Rebased this and fixed some small conflicts along.

@holgerd77 holgerd77 changed the title vm: continuing v6 breaking changes vm, client: continuing v6 breaking changes Apr 2, 2022
@@ -288,7 +283,7 @@ export default class VM extends AsyncEventEmitter {
if (opts.stateManager) {
this.stateManager = opts.stateManager
} else {
const trie = opts.state ?? new Trie()
const trie = new Trie()
Copy link
Member

Choose a reason for hiding this comment

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

Side note, not directly related: I guess it would rather make sense, to make trie optional for the StateManager options and then do this trie instantiation there if not provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that makes sense, i should have checked, we already do that :) so i can just remove this, i will make a note for myself to do in a follow up develop PR

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.

Looks great, again, thanks a lot for all the code clean-ups! 😄

@holgerd77 holgerd77 merged commit 156b516 into develop Apr 2, 2022
@holgerd77 holgerd77 deleted the vm-v6-breaking-changes branch April 2, 2022 08:37
holgerd77 added a commit that referenced this pull request Apr 5, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
holgerd77 added a commit that referenced this pull request Apr 7, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
g11tech pushed a commit that referenced this pull request Apr 29, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
holgerd77 added a commit that referenced this pull request May 4, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
g11tech pushed a commit that referenced this pull request Jun 2, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
g11tech pushed a commit that referenced this pull request Jun 3, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
holgerd77 added a commit that referenced this pull request Jun 8, 2022
* vm: v6 breaking changes

* update benchmark util to use gasUsed as bigint

* VM: fixed gasUsed rebase related bug

Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
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.

3 participants