-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better described how gas is used when interacting with a smart contra… #11997
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @stolab, thanks for this! Sorry for delay. I like the direction of the content you're suggesting, just had a few thoughts on how we could clean it up a bit more. Let me know your thoughts of if you'd like someone else to resume from here. Thanks!
@@ -160,7 +160,9 @@ The base fee will be burned **-0.00399 ETH** | |||
|
|||
Validator keeps the tip **+0.000210 ETH** | |||
|
|||
Gas is required for any smart contract interaction too. | |||
In case of an interaction with a smart contract there is 2 cases possible: | |||
1. A `view` or `pure` function (as described in [solidity documentation](https://docs.soliditylang.org/en/v0.8.23/contracts.html#view-functions)) is called from an EOA. In that specific case, no gas will be paid by the caller and the result will be returned. The underlying RPC call for this scenario is [eth_call](https://ethereum.org/en/developers/docs/apis/json-rpc#eth_call) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see where you're going with this but it doesn't seem appropriate for where it is on the page. I might break this into it's own h3 header, ie ### Smart contract interactions {#smart-contract-interactions}
I would probably leave something similar to the comment you deleted as well though, just updated. Maybe "Gas is require for any transaction that alters the state of a smart contract" instead... weaving in the rest of the content.
Also, the link to eth_call
should be relative: /developers/docs/apis/json-rpc#eth_call
, and consider wrapping the term itself in single-backticks to style it as code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wackerow, thanks for your feedback, I made changes accordingly.
I agree for the h3 header, but in that case I would suggest to rename the ### On gas {#on-gas}
to ### Regular transactions {#regular-transactions}
. Let me know what's your opinion is on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stolab Like the updates! Left a few thoughts on some final touches, let me know what you think 😄
Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
@wackerow Yes indeed your suggestion sounds much better ! thanks for the suggestion I merged them |
|
||
Gas is required for any transaction that involves a smart contract. | ||
|
||
Smart contracts can also contain functions known as [`view`](https://docs.soliditylang.org/en/latest/contracts.html#view-functions) or [`pure`](https://docs.soliditylang.org/en/latest/contracts.html#pure-functions) functions, which do not alter the state of the contract. As such, calling these functions from an EOA will not require any gas. The underlying RPC call for this scenario is [`eth_call`](/developers/docs/apis/json-rpc#eth_call) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we could simplify this whole thing and say that any attempt at state change requires gas, but reading Ethereum does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree it could be simplified but as this is developer doc I thought it make sense to be a bit more explanatory. And as calling view
and pure
function internally cost gas I think that make sense to keep the part explaining the difference
However I agree that the underlying RPC call is probably not the most interesting/relevant thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna lean on the side of keeping a bit more detail here given dev docs location; pulling in
@wackerow, can we merge it then ? not sure why exactly one check is not successful |
Oops, apologies @stolab, didn't mean to let this sit. No worries about that check; not required (and a false negative). |
@all-contributors please add @stolab for content |
I've put up a pull request to add @stolab! 🎉 |
@wackerow thanks for your time and the discussion we had on this PR! |
Description
Suggestion to better describe how the gas is used when interacting with a smart contract. The documentation say
But there is a use case when you don't have to pay any gas when calling a smart contract function.
Related Issue
[Fixes #11989 ]