-
Notifications
You must be signed in to change notification settings - Fork 744
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 AsyncEventEmitter extension from EVM and VM #2235
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
Note: the original problem we tried to solve in #2229, #2182 was that before this PR, each time if you wanted to use EVM events, you had to
This is not what we want. Instead, if we add the events optionally to the interface, one can now;
This does therefore not require the generic types as was introduced in the other PRs. |
tape('Berlin: EIP 2315 tests', (t) => { | ||
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Berlin, eips: [2315] }) | ||
|
||
const runTest = async function (test: any, st: tape.Test) { | ||
let i = 0 | ||
const vm = await VM.create({ common }) | ||
|
||
;(<EVM>vm.evm).on('step', function (step: any) { | ||
vm.evm.events!.on('step', function (step: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have updated all these unnecessary castings in the tests, should be good to go now. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this is much cleaner, thanks 😄 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Counter PR against #2229
I'm not sure anymore why we needed the generic types, especially now we can just access these fields from the interface directly (yes, the events are optional, but you can just
vm.events!.on(
)