neo-go icon indicating copy to clipboard operation
neo-go copied to clipboard

Allow compilation with CompileFile if config file differs

Open ixje opened this issue 1 year ago • 1 comments

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.

ixje avatar Aug 04 '24 11:08 ixje

Not sure this cache is useful at all, but changing the key is easy.

roman-khimov avatar Aug 04 '24 12:08 roman-khimov