-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add More Method For Enhancing Gas Efficiency Ref#454 #491
base: main
Are you sure you want to change the base?
Conversation
This reverts commit a7c5299.
Add Inline Assembly Optimizations, Explicit Use of staticcall
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
- **Gas Efficiency**: For functions that only need to read data from the blockchain, `staticcall` is more gas-efficient than a regular call. | ||
- **Security**: By preventing state changes, `staticcall` ensures that the called function cannot alter the contract's state or the state of other contracts. This makes contracts more predictable and secure. | ||
|
||
You're right; the example provided for demonstrating the benefits of `staticcall` might not fully showcase its advantages, especially since `staticcall` is implicitly used in Solidity for `view` and `pure` functions. To better illustrate the benefits, let's delve into a scenario where the explicit use of `staticcall` can optimize gas consumption, particularly when interacting with contracts in a more granular manner. |
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.
This looks rather strange, like the answer chatgpt gave you
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.
However, many of the words generated by chatgpt are nonsense and repetitive. I think it is not suitable to be placed directly in the document.
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, I generate some of the code snippet with Cody, failed to review that, I will fix that🤔
I think it is better to keep the gas optimization suggestions simple and direct. Many common sense contents in contract development should not be mentioned repeatedly. |
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.
Would follow @jackleeio 's opinion because he's working on this issue
In addition, I think the title should be kept as short and concise as possible, because if the title is too long, it will affect the reading experience when displayed in the sidebar. |
Pre-flight checklist
This change is