immutable for libraries / dynamic libraries / high-level delegatecall
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
I'm pretty sure there are issues about this scattered across the project, but this has come up recently, so I'll create a new one.
Since linking is a bit cumbersome, it has been brought up that libraries should be explicit immutable state variables, so that linking happens at construction time instead of before deployment. If we also open this up to non-immutable state variables for libraries, it will create a high-level interface for delegatecall and proxies, even though the library interface cannot be changed after compilation (i.e. for a truly generic proxy, we would need `.delegatecall` anyway).
Pros:
- easier recompilation (no issue about using the compiler to link or substituting manually)
-
Cons:
- it is more complicated for off-chain tools to get the library address (it is not directly in the metadata file, but has to be extracted from the constructor)
- "using for" does not work
Contributor guide
Research direction
The issue does not name files, tests, or compiler entry points. Start by reviewing the scattered library and linking issues referenced in the discussion, then define the language and compiler behavior for immutable and non-immutable library state variables; done requires an agreed design that resolves the stated tooling and "using for" trade-offs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100