neo-go
neo-go copied to clipboard
Allow compilation with CompileFile if config file differs
Is your feature request related to a problem? Please describe.
I want to test contract deployment and updating with neotest. I only modified some settings in the config file, but CompileFile returns the old contract because of the caching being based on just the contract source path. Specifically this code
https://github.com/nspcc-dev/neo-go/blob/d8e3e57f88f281934d875d44cbca28111757c9ed/pkg/neotest/compile.go#L46-L49
I tried using it as follows
c := neotest.CompileFile(t, e.CommitteeHash, basePath+"main.go", basePath+"neo-go.yml")
e.DeployContract(t, c, nil)
...some tests
c = neotest.CompileFile(t, e.CommitteeHash, basePath+"main.go", basePath+"neo-go-update.yml")
...invoke update and do rest of tests
Describe the solution you'd like
I think the easy way to resolve this is to use the combination of srcPath + configPath as key
Describe alternatives you've considered
Add a force bool arg that skips the cache check. The implicit fix seems more natural.
Not sure this cache is useful at all, but changing the key is easy.