fix: fix: transpiler outputs raw int literals for uint24 anchorWidth — overflow crashes forge (#900)
Clamp anchorWidth output with `% (2**24)` before the uint24 cast so that large literal values (e.g. 1e18 from evolved constants) produce valid Solidity instead of a compile-time overflow error. Add test_transpiler_clamping.sh (Test 5) verifying that a Push3 program outputting 1e18 for anchorWidth generates `uint24(... % (2**24))` and not the raw overflowing literal. Update package.json to run both test suites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a2c60a29a0
commit
1e75285579
3 changed files with 90 additions and 2 deletions
|
|
@ -79,7 +79,7 @@ function main(): void {
|
|||
...functionBody,
|
||||
` ci = uint256(${ciVar});`,
|
||||
` anchorShare = uint256(${anchorShareVar});`,
|
||||
` anchorWidth = uint24(${anchorWidthVar});`,
|
||||
` anchorWidth = uint24(${anchorWidthVar} % (2**24));`,
|
||||
` discoveryDepth = uint256(${discoveryDepthVar});`,
|
||||
' }',
|
||||
' }',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue