View Functions
Do not modify functions as view
in your interface definitions.
Using the visibility modifier view
has some different behaviour when used in conjunction with delegatecall
which forces your Extension interface definitions to avoid view
even if your function does not modify state.
The implementation function, however, can be modified with view
as long as the interface is used when the contract is interacted with by another contract.
Problem
The usage of view
tells the Solidity compiler that the opcode that should be used to call this function is STATICCALL
.
When any function is called on an Extendable contract, the _fallback
function is called first before rerouting execution to the Extension.
Solidity believes that the _fallback
function is always state-changing whilst a STATICCALL
must not be state-changing and causes a revert.
Some more details in this similar problem.
Last updated