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

Remove all the debug traces from the vm #1198

Merged
merged 1 commit into from Apr 12, 2021
Merged

Conversation

alcuadrado
Copy link
Member

We are receiving complains from our users about the release candidate version we published running >6x slower than our previous version.

The main difference between these versions is that the RC version uses v5, instead of v4, making it the first consumer of v5.

This performance regression is aligned with that @jochem-brouwer reported when experimenting with removing the traces and running the standard tests, so I instructed one of our users to remove them from their node_modules, and not only the performance regression was gone, but the test run actually faster.

This PR removes all the debug traces from the VM. I didn't remove them from other packages to keep the PR small, and because we don't use them, so it's not as urgent.

@holgerd77, do you think we can get this published today? We really need to publish a final version of our Berlin support on Wednesday, or otherwise there won't be any way to test smart contracts against Berlin, and we can't publish something with a regression this significant.

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #1198 (e7cf3d5) into master (588650e) will increase coverage by 0.10%.
The diff coverage is 50.00%.

Impacted file tree graph

Flag Coverage Δ
block 82.25% <ø> (+0.20%) ⬆️
blockchain 84.23% <ø> (+0.06%) ⬆️
client 84.03% <ø> (+0.03%) ⬆️
common 87.39% <ø> (ø)
devp2p 83.96% <ø> (+0.43%) ⬆️
ethash 82.08% <ø> (ø)
tx 81.98% <ø> (ø)
vm 81.34% <50.00%> (-0.63%) ⬇️

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

return '0x' + new BN(item).toString(16, 0)
})

const name = eventObj.opcode.name
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to regenerate this data in the step event? We have access to this eventObj in the event right? Then it is OK if all this is removed in this context.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you can generate the same data.

Copy link
Member

Choose a reason for hiding this comment

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

This change here changes the structure of the step event as mentioned in #1199

Copy link
Member Author

Choose a reason for hiding this comment

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

Where's the change? I really don't get it.

Copy link
Member

Choose a reason for hiding this comment

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

If one would listen to step like this;

vm.on('step', (obj: any) => {
// do stuff
let stack = obj.hexStack
// do stuff with stack (is now undefined)
})

Then this code now does not work anymore, since hexStack is not available anymore (and this opTrace thing is also not available anymore).

Copy link
Member Author

Choose a reason for hiding this comment

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

That object is not passed to the step handler. Take a look at line 232:

return this._vm._emit('step', eventObj)

Only eventObj is passed, which I didn't modify.

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.

Ok (short version, have a long version too 😄 , but not enough time right now).

@holgerd77 holgerd77 merged commit a4af0b1 into master Apr 12, 2021
@holgerd77 holgerd77 deleted the remove-debug-traces branch April 12, 2021 18:59
@holgerd77
Copy link
Member

I worked several hours on this debug integration and crafted this very carefully (only the UX/DevEx side, not the performance side), also for things like the associated documentation. I also personally need this for VM debugging and am very much convinced that this is highly useful for others to understand the VM (there are other cases of course where the functionality is not needed at all, e.g. for HardHat). So I would really love to see that we can reintegrate at some point in a performance sensitive way.

Totally understand though that we needed to remove here asap due to timing considerations.

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.

None yet

3 participants