ethereumjs-monorepo icon indicating copy to clipboard operation
ethereumjs-monorepo copied to clipboard

evm: update imports/exports

Open acolytec3 opened this issue 2 years ago • 1 comments

Fixes #2295

acolytec3 avatar Sep 22 '22 14:09 acolytec3

Codecov Report

Merging #2303 (f5f0642) into master (6eb5a85) will decrease coverage by 0.27%. The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 91.37% <ø> (ø)
blockchain 90.21% <ø> (ø)
client 87.00% <ø> (?)
common 98.39% <ø> (ø)
devp2p 91.63% <ø> (-0.03%) :arrow_down:
ethash ∅ <ø> (∅)
evm 79.17% <100.00%> (-0.07%) :arrow_down:
rlp ∅ <ø> (∅)
statemanager 89.46% <ø> (ø)
trie 90.36% <ø> (ø)
tx 97.79% <ø> (ø)
util 88.99% <ø> (ø)
vm 85.20% <100.00%> (-0.11%) :arrow_down:

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

codecov[bot] avatar Sep 22 '22 14:09 codecov[bot]

Just read up on the associated issue, what is the status of this here? I would assume from your latest comment ("will pick up on Monday" or similar) not yet ready for review?

holgerd77 avatar Sep 26 '22 10:09 holgerd77

Correct. I need to figure out how to cleanly update the types for asyncEventEmitter. The hacks described in this thread all work in some sense but I haven't been able to make any of them without either casting to any or else having other weird side affects on the EVMInterface typing so far where it also comes for evm.codes

acolytec3 avatar Sep 26 '22 11:09 acolytec3

I ran the VM benchmarks with the new eventemitter2 dependency and below are the results vs current master (basically identical).

eventemitter2
Number of blocks to sample: 10
Block 9422905 x 27,769 ops/sec ±1.84% (85 runs sampled)
Block 9422906 x 26,526 ops/sec ±3.12% (87 runs sampled)
Block 9422907 x 26,901 ops/sec ±0.80% (91 runs sampled)
Block 9422908 x 25,902 ops/sec ±0.80% (88 runs sampled)
Block 9422910 x 24,201 ops/sec ±4.45% (86 runs sampled)

async-eventemitter
Number of blocks to sample: 10
Block 9422905 x 28,308 ops/sec ±1.21% (88 runs sampled)
Block 9422906 x 26,785 ops/sec ±2.05% (89 runs sampled)
Block 9422907 x 26,336 ops/sec ±1.01% (92 runs sampled)
Block 9422908 x 24,039 ops/sec ±3.81% (83 runs sampled)
Block 9422910 x 24,225 ops/sec ±0.82% (86 runs sampled)

So, on performance at least, looks good. Will rebase the PR on current master and we can verify everything is working ok.

acolytec3 avatar Oct 14 '22 01:10 acolytec3

This is a breaking change, if EthereumJS follows semver. Ganache uses the next method of EtheruemJS vm's usage of AsyncEventEmitter's emitter.on method. Example:

vm.evm.events.on("step", async (event, next) => {
  // ... some async things ...
  next();
});

It doesn't appear that the new library you use has this option. Can you revert this change in the v6 release? Then maybe re-release with this PR as a v7?

davidmurdoch avatar Oct 19 '22 17:10 davidmurdoch

@davidmurdoch we'll discuss internally on how to proceed here and reach back here once we have settled.

holgerd77 avatar Oct 19 '22 19:10 holgerd77