argotorg / argotorg/solidity

[StackLimitEvader] Successive runs throws because of invalid yul code

Open
#14,588 7 comments 0 reactions 0 assignees View on GitHub
bug :bug: low effort low impact should have
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

```
{
{
mstore(memoryguard(0x010000), 1)
sstore(mload(calldataload(0)), 1)
let x, x_1, x_2, x_3 := foo_m(calldataload(224), sload(288), calldataload(32), sload(96))
sstore(160, x)
sstore(224, x_1)
sstore(288, x_2)
sstore(32, x_3)
let x_4 := foo_s(calldataload(288), sload(32), calldataload(96))
sstore(160, x_4)
}
function foo_m(x, x_1, x_2, x_3) -> x_4, x_5, x_6, x_7
{ }
function foo_s(x, x_1, x_2) -> x_3
{
x_1 := callcode(call(0x400, 0x4000, 0x40000, mod(call(x_3, x_1, 0x400000, mod(0x4000000, 32768), mod(0x40000000, 32768), mod(0x400000000, 32768), mod(0x4000000000, 32768)), 32768), mod(0x40000000000, 32768), mod(0x400000000000, 32768), mod(0x4000000000000, 32768)), 0x40000000000000, 0x400000000000000, mod(0x4000000000000000, 32768), mod(0x40000000000000000, 32768), mod(0x400000000000000000, 32768), mod(selfbalance(), 32768))
}
}
```

When the code above is optimized successively using `StackLimitEvader` (i.e., applied twice), the compiler throws.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Yul reproducer through StackLimitEvader twice and confirm that the second optimization throws. Trace the StackLimitEvader entry point to determine why successive runs produce invalid Yul, then add regression coverage showing that repeated optimization completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.