starknet-foundry icon indicating copy to clipboard operation
starknet-foundry copied to clipboard

Throw an error when script does not have [lib] defined

Open THenry14 opened this issue 1 year ago • 3 comments

If someone did not state [lib] section in their Scarb.toml file, the script command may fail. We should print a warning/throw an error if that's the case + instruct users what to do to mitigate the problem. https://github.com/foundry-rs/starknet-foundry/pull/1192#issuecomment-1935571457

THenry14 avatar Feb 09 '24 09:02 THenry14

I would argue that we should just return an error in this case - the only other solution I see is adding stuff to Scarb.toml which I would consider potentially dangerous

piotmag769 avatar Feb 09 '24 12:02 piotmag769

I would argue that we should just return an error in this case - the only other solution I see is adding stuff to Scarb.toml which I would consider potentially dangerous

I have discussed the matter briefly with scarb team a few weeks ago, and according to them unless someone explicitly disables the section (with [lib] sierra = false) this should just work. So my plan is to first investigate, and then reach out to the scarb team again with the findings.

THenry14 avatar Feb 09 '24 12:02 THenry14

This will work if someone hasn't specified any other target, which is a rare case in sncast scripts - usually starknet target is needed to compile contracts. Scarb just defaults to lib target if not other target is specified. In case of sncast scripts user usually will need to define both targets manually

piotmag769 avatar Feb 09 '24 13:02 piotmag769