yul: include ingot id in function name
- Dominant language
- Rust
- Stars
- 1.7k
- Forks
- 218
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 9
Description
From codex in #1230:
> In multi-ingot builds, two functions with the same module path/name (e.g., both at the root) can still produce identical mangled names because function_qualifier only hashes module_path_segments and returns the literal "root" for empty paths. module_path_segments doesn’t include the ingot name, so the qualifier can’t distinguish between ingots; if the signatures also match, mangled_name will collide across ingots, breaking linking or causing the wrong function to be referenced. Consider folding the ingot identity into the qualifier/hash so cross-ingot duplicates remain unique.
Maybe we could remove some of the hash noise in our current naming scheme while we're at it. One possible strategy is to use `$` separators in function names, eg `ingot_name$$path$to$function_name$$generic_args`. (There may be cases where we need the hash, I haven't really thought this through)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating function_qualifier, module_path_segments, and mangled_name, then trace how they construct names in multi-ingot builds. Confirm the collision with identical functions across ingots; done means equivalent functions from different ingots always receive distinct mangled names and linking resolves the intended function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100