-
Notifications
You must be signed in to change notification settings - Fork 678
VM is initially undefined
on provider object
#455
Comments
The Also, you are 5 levels into undocumented internals here; I wouldn't rely on any of these properties existing in the future. Would #381 solve your issue? Or would you prefer the Ganache provider just emit low-level events like the vm's |
Thanks @davidmurdoch
Isn't this a little worrying / race-condition-y? Who is doing the disk I/O? Can't they do it sync?
Yes, ideally I would like |
No race condition here, as we queue all RPC calls until the entire node has initialized. There are a few async init tasks done in parallel, so changing to sync may have an adverse effect on start up performance. In any case, we'd have to patch or fork some libraries to make them work synchronously.
Exposing a third party library as part of our official API would tie us to a release based on their own semver changes, which I'd rather not do. I'd much rather abstract these things away so we can handle these breaking changes in a backwards-compatible way when they occur. |
Ah ok cool! Thanks for that, good to know.
Yes this makes sense. Could you expose it informally, with the documented caveat that consumers should be aware that they are responsible for tracking & managing API changes upstream? The number of engineers interested in tapping the VM directly is small & 'vm-aware'. They might be happy to trade convenient access for semver guarantees. TBH I'd prefer direct exposure just because it means I don't have to litigate or wait for changes to the abstraction here :) Conversely, if it's something you're interested in taking on as a first order concern then awesome - it seems like there's a lot of cool stuff being added to the VM atm. I'm going to close since the core issue is resolved. Thanks again @davidmurdoch! |
Oh, maybe a |
Something about the VM creation is asynchronous & ganache isn't waiting for it.
Reproduction
Output
Expected Behavior
That the provider instantiation call is synchronous - there's no need to wait for its subcomponents to resolve before referencing them.
Context
I'd like to attach to the VM and listen to its step. Additionally, there are API extensions in development at ethereumjs-vm I'd like to take advantage of in future.
There's a trivial workaround - just opening here in case other people run into this unexpectedly as well.
Your Environment
v2.6.0
cf: solidity-coverage 0.7.0
The text was updated successfully, but these errors were encountered: