mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Make neotest coverage properly handle contract update #1354
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnnaShaleva on GitHub (Aug 19, 2024).
Is your feature request related to a problem? Please describe.
Contract update often implies new source file and new instructions offsets. Currently neotest internally treats an updated contract as a new one (since it has a new sourcepath), and it's correct:
nspcc-dev/neo-go@7766168c19/pkg/neotest/compile.go (L24-L25)However, coverage tool identifies contracts by hash:
nspcc-dev/neo-go@3e31b118c5/pkg/neotest/coverage.go (L29-L30)Hence, coverage tool can't really distinguish old executable from the new one since both of them have the same hash. It leads to the fact that coverage results of updated and old contracts are mixed (and even may be invalid due to instructions offset update).
Describe the solution you'd like
I thought about making coverage tool distinguish contracts coverage by source path, exactly like neotest does. The trick is VM execution hook doesn't have access to the executable contract source, VM can only access executable script hash. This problem my be solved by accessing contract's path via Executor state provided to VM execution hook.
Describe alternatives you've considered
No other alternatives yet, but there should be any.