-
Notifications
You must be signed in to change notification settings - Fork 77
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
Proposal: Coverage/Hooks API #3415
Comments
I consider Execution Hooks API / Hooks API a better name for this feature, so I edited the issue |
Just voicing my interest in this. We (COZ) would love if the end result of this implementation allows us to get the list instructions/offsets executed so we can map them back to our debug info. |
The design LGTM, it's more generic than the one presented in 96b5d90, so vote up from my side to implement this proposal. Also, this execution hook may be used not only for the coverage calculations, but also for custom VM logger implementation that we've discussed with @roman-khimov.
Can easily be reached with a custom execution hook that accumulates the set of instructions inside it (which also remains me some kind of Hooks-based logger that was recently implemented in EVM, ref. https://github.com/ethereum/go-ethereum/blob/1ec7af261223d6dad9370ee8263f86347b190bab/eth/tracers/logger/logger.go#L135). So this request can easily be implemented after the described proposal implementation. |
Refs nspcc-dev#3415 This commit introduces a small new change that implements the Hooks API and more specifically the OnExecHook. This feature can be used to implement test coverage collection, tracing, breakpoints, and etc. To be more specific, this commit: 1. adds a new `hooks` field to the `VM` (this field contains the OnExecHook function) 2. sets the default value of this hook to be a NOP function 3. adds the `VM.SetOnExecHook` method
Hello!
This is an RFC. Its goal is to discuss and approve the design of a new feature. My colleagues and I aim to implement this feature, once an agreement is reached.
Feature request
Background: Currently, there is no way to collect coverage of tests that are run on the VM. There already has been an issue on this subject and a prototype implementation (#2657). That implementation suffered from a bug in debug info which just got fixed (#3412). Now we can move further
Feature: In my view, the VM would really benefit from an Execution Hooks API that would allow to programmatically register callbacks that would be invoked for each executed instruction. Coverage collection would just be a special use case of this API.
Proposed design
I propose that we:
VM
struct:NewWithExecutionHook(callback)
, that would create an instance of VM with the specified callbackstep()
method so that it calls thev.executionHook
for each instructionThe text was updated successfully, but these errors were encountered: