Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Last-emo-boy
Copy link
Contributor

@Last-emo-boy Last-emo-boy commented Mar 28, 2024

Pre-flight checklist


This change is Reviewable

Copy link

vercel bot commented Mar 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
conflux-documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 28, 2024 3:13pm

@Last-emo-boy Last-emo-boy changed the title Add More Method For Enhancing Gas Efficiency Add More Method For Enhancing Gas Efficiency Ref#454 Mar 28, 2024
- **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.
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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🤔

@jackleeio
Copy link
Contributor

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.

Copy link
Collaborator

@darwintree darwintree left a 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

@jackleeio
Copy link
Contributor

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.

@darwintree darwintree added the external contributor This label marks the issues connected to Dework label Apr 7, 2024
@darwintree darwintree added the Pending PR Not Active PR label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external contributor This label marks the issues connected to Dework Pending PR Not Active PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants