Better specify the fall function gas cost in the docs.#2945
Better specify the fall function gas cost in the docs.#2945chriseth merged 1 commit intoargotorg:developfrom
Conversation
ce0758e to
d6209fa
Compare
docs/contracts.rst
Outdated
| Ether through regular transactions. | ||
|
|
||
| In such a context, there is usually very little gas available to the function call (to be precise, 2300 gas), | ||
| In such a context, there is usually very little gas available to the function call (to be precise, 2300 gas). That is in addition to the simple value transfer gas cost of 21000. So in total 22300 gas. |
There was a problem hiding this comment.
The 21k gas is not available to the called contract. You just pay 21k gas for the transaction itself. It might have multiple simple value transfers which each provide a stipend of 2.3k gas.
There was a problem hiding this comment.
It needs rephrasing, since people get confused and copy around the 2.3k value as being the gas limit for the fallback which makes no sense. What would you propose?
There was a problem hiding this comment.
You can add a sentence like: Note that the gas required by a transaction (as opposed to an internal call) that invokes the fallback function is much higher, because each transaction charges an additional amount of 21k gas or more for things like signature checking.
Specify that also 21k gas is needed for fallback functions originating from external function calls.
d6209fa to
7f88d43
Compare
|
|
||
| In such a context, there is usually very little gas available to the function call (to be precise, 2300 gas), | ||
| so it is important to make fallback functions as cheap as possible. | ||
| In such a context, there is usually very little gas available to the function call (to be precise, 2300 gas), so it is important to make fallback functions as cheap as possible. Note that the gas required by a transaction (as opposed to an internal call) that invokes the fallback function is much higher, because each transaction charges an additional amount of 21000 gas or more for things like signature checking. |
There was a problem hiding this comment.
I think this is a bit confusing, it seems like 21000 gas is charged so the contract can do signature checking (which is not the case).
However, that 21000 is not usable by the contract if I am not mistaken?
There was a problem hiding this comment.
It's not usable by the contract, no. I don't think it reads like what you said though. But ofcourse if you think it can be expressed in some more clear way let's change it.
Better specify the fall function gas cost in the docs.