Document oddities in validation behaviour of calldata-to-memory copies.
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
Arrays with static (as in "not dynamically encoded") base types use an old custom copy routine for calldata-to-memory copies, which does not perform cleanup or validation, while arrays with dynamically encoded base types use the yul conversion routine, which uses abi-decoding and validates, e.g. reverts on dirty higher-order bits (see ``CompilerUtils.cpp:L1033`` for the case distinction).
This fact for legacy code generation should be documented somewhere.
Additionally, via-IR-code generation always implements such copies using abi-decoding, so this difference should be documented as an via-IR-breaking-change.
Came up in https://github.com/ethereum/solidity/issues/13518
Furthermore, once this is documented for now, we should actually change this to *always* validating in all such copies in 0.9.
Contributor guide
Research direction
Start with the case distinction at CompilerUtils.cpp:L1033 and review the related context from issue #13518. Document the legacy code-generation difference between static and dynamically encoded base types, the via-IR validation behavior as a breaking change, and the planned always-validate change for 0.9.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100