argotorg / argotorg/solidity

Document oddities in validation behaviour of calldata-to-memory copies.

Open
#13,520 1 comment 0 reactions 0 assignees View on GitHub
documentation :book: medium effort medium impact must have
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.