warp icon indicating copy to clipboard operation
warp copied to clipboard

Cairo keywords as file names

Open cicr99 opened this issue 2 years ago • 0 comments
trafficstars

When the name of a Solidity file is a Cairo reserved word, the Scarb.toml that is created for the output uses the name of the file as the name of the manifest, but Cairo keywords are not allowed for this.

As an example, there is a test: https://github.com/NethermindEth/warp/blob/cairo-1.0/tests/compilation/contracts/errorHandling/assert.sol The name of the file is assert.sol and so the Scarb file created looks like:

[package]
name = "assert"
version = "1.0.0"

(other stuff)

This test fails on cairo compilation phase with the error message: Expected function, found module in every place there was a call to an assert function in the cairo code.

Suggestion: Changing the name of the file obviously prevents this issue. However, users shouldn't have to worry about the name of the file, specially when this is not a problem on the Solidity side. If the name of the file is a word that's not allowed we should mangle the name on the output files

cicr99 avatar Jun 08 '23 16:06 cicr99