You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Add a field that would store a hook callback to the VM struct:
type VM struct {
...
executionHook func(scriptHash util.Uint160, offset int, opcode opcode.Opcode)
}
Define a new constructor for the VM type, e.g. NewWithExecutionHook(callback), that would create an instance of VM with the specified callback
Modify the step() method so that it calls the v.executionHook for each instruction
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.
the end result of this implementation allows us to get the list instructions/offsets executed
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: