@@ -111,22 +111,35 @@ otherwise, the ``value`` option would not be available.
111
111
the ``value `` and ``gas `` settings are lost, only
112
112
``feed.info{value: 10, gas: 800}() `` performs the function call.
113
113
114
- Due to the fact that the EVM considers a call to a non-existing contract to
115
- always succeed, Solidity uses the ``extcodesize `` opcode to check that
116
- the contract that is about to be called actually exists (it contains code)
117
- and causes an exception if it does not. This check is skipped if the return
118
- data will be decoded after the call and thus the ABI decoder will catch the
119
- case of a non-existing contract.
114
+ .. warning ::
115
+ Due to the fact that the EVM considers a call to a non-existing contract to
116
+ always succeed, Solidity uses the ``extcodesize `` opcode to check that
117
+ the contract that is about to be called actually exists (it contains code)
118
+ and causes an exception if it does not. This check is skipped if the return
119
+ data will be decoded after the call and thus the ABI decoder will catch the
120
+ case of a non-existing contract.
120
121
121
- Note that this check is not performed in case of :ref: `low-level calls <address_related >` which
122
- operate on addresses rather than contract instances.
122
+ This check is not performed in case of :ref: `low-level calls <address_related >` which
123
+ operate on addresses rather than contract instances.
123
124
124
- .. note ::
125
+ .. warning ::
125
126
Be careful when using high-level calls to
126
127
:ref: `precompiled contracts <precompiledContracts >`,
127
128
since the compiler considers them non-existing according to the
128
129
above logic even though they execute code and can return data.
129
130
131
+ .. note ::
132
+ Since the version 0.8.10, the compiler does not check ``extcodesize `` on
133
+ high-level external calls if return data is expected, because an empty code
134
+ will be unable to return data, and the ABI decoder will revert.
135
+ As a consequence, this allows high-level external calls to precompiled
136
+ contracts, since they can return data despite having no code
137
+ associated with their addresses.
138
+
139
+ Read about :ref: `precompiled contracts <precompiledContracts >` and
140
+ :ref: `low-level calls <address_related >`
141
+ for more information.
142
+
130
143
Function calls also cause exceptions if the called contract itself
131
144
throws an exception or goes out of gas.
132
145
@@ -901,4 +914,4 @@ in scope in the block that follows.
901
914
out-of-gas situation and not a deliberate error condition:
902
915
The caller always retains at least 1/64th of the gas in a call and thus
903
916
even if the called contract goes out of gas, the caller still
904
- has some gas left.
917
+ has some gas left.
0 commit comments