Bug Report
Cairo version: 2.16.1 (scarb 2.16.1)
Current behavior:
Input arguments with leading zeros (e.g., 007, 00100) are silently accepted and parsed as their decimal value. While this produces correct results, it indicates the input parser accepts non-canonical number representations without warning.
Expected behavior:
Either:
- Accept with canonical parsing (current behavior is functionally correct)
- Warn:
Warning: input '007' has leading zeros, interpreting as 7
Steps to reproduce:
#[executable]
fn main(a: felt252) -> felt252 {
a + 1
}
scarb execute --arguments="007" --print-program-output
# Output: 8 (007 parsed as 7, 7+1=8, no warning)
scarb execute --arguments="00100" --print-program-output
# Output: 101 (00100 parsed as 100)
Related code:
#[executable]
fn main(a: felt252) -> felt252 {
a + 1
}
Other information:
| Input |
Circom |
Noir |
Cairo |
Leo |
| 007 |
Accepts (7) |
Accepts (7) |
❌ Accepts (7) |
Rejects |
| 00100 |
Accepts (100) |
Accepts (100) |
❌ Accepts (100) |
Rejects |
Bug Report
Cairo version: 2.16.1 (scarb 2.16.1)
Current behavior:
Input arguments with leading zeros (e.g.,
007,00100) are silently accepted and parsed as their decimal value. While this produces correct results, it indicates the input parser accepts non-canonical number representations without warning.Expected behavior:
Either:
Warning: input '007' has leading zeros, interpreting as 7Steps to reproduce:
Related code:
Other information: