Yul: add comments on function dispatcher.
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
The yul code is sometimes hard to read.
When optimized, the main dispatch looks like:
```
let _2 := 0
switch shr(224, calldataload(_2))
case 0x1a212539 {
if callvalue() { revert(_2, _2) }
...
```
It is very nice that the public functions are inlined. but it makes the code very hard to read.
when the code is unoptimized, the code is slightly more readable:
```
switch shr(224, calldataload(0))
case 0x1a212539 { external_fun_xxx() }
case 0x1e13bcd2 { external_fun_yyy() }
```
### Suggestion:
add a comment near the "case xxxx", with the external method name (or its full signature)
Contributor guide
Research direction
Start by locating the Yul function-dispatcher generation path and compare the optimized and unoptimized output shown in the issue. Trace how selector cases are emitted; done means optimized dispatch output includes the external method name or full signature while preserving dispatch behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100