You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler requires internal functions that index into storage mappings just to return a storage pointer not read the actual contents be marked view.
When manually creating & assigning the slot of a struct storage pointer via inline assembly the compiler does not impose the same constraint of requiring the method to be marked view, it accepts pure
Furthermore a public function that calls the pure, storage pointer returning method just to publicly return the struct as a memory struct (implicitly reading storage) the compiler does not require said function to be marked view
Intuitively one would expect that neither creation of the storage pointer (assembly or vanilla Solidity) should be view as it does not actually read storage yet, simply create a stack variable based on some inputs. However casting a storage pointer to a memory struct which requires reading the storage pointer should be marked as an environment touching operation.
Environment
Compiler version: v0.8.25 / v0.8.28
Compilation pipeline (legacy, IR, EOF): legacy & via-IR
Target EVM version (as per compiler settings): paris, shanghai, cancun
Description
internal
functions that index into storage mappings just to return a storage pointer not read the actual contents be markedview
.view
, it acceptspure
public
function that calls thepure
, storage pointer returning method just to publicly return the struct as amemory
struct (implicitly reading storage) the compiler does not require said function to be markedview
Intuitively one would expect that neither creation of the storage pointer (assembly or vanilla Solidity) should be
view
as it does not actually read storage yet, simply create a stack variable based on some inputs. However casting a storage pointer to a memory struct which requires reading the storage pointer should be marked as an environment touching operation.Environment
Steps to Reproduce
Example
The text was updated successfully, but these errors were encountered: