Use Local Memory Type Variable Instead of Global Storage Type Variable in Event to Save Gas
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 55/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- solidity
- 領域
- blockchain
調査の方向性
Open contracts/APIConsumer.sol and inspect the fulfill function and its DataFullfilled event use. Compare the emitted value with the _volume parameter and the volume state variable; done means the event uses the equivalent local value without changing the stored state.
索引モデルが issue の本文から書いたものです。
説明
Hi, we recently have conducted a systematic study about Solidity event usage, evolution, and impact, and we are attempting to build a tool to improve the practice of Solidity event use based on our findings. We have tried our prototype tool on some of the most popular GitHub Solidity repositories, and for your repository, we find a potential optimization of gas consumption arisen from event use.
The point is that when we use emit operation to store the value of a certain variable, local memory type variable would be preferable to global storage type (state) variable if they hold the same value. The reason is that an extra SLOAD operation would be needed to access the variable if it is storage type, and the SLOAD operation costs 800 gas.
For your repository, we find that the following event use can be improved:
- APIConsumer.sol
function name: fulfill
event name: DataFullfilled
variable: volume->_volume
function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
{
volume = _volume;
emit DataFullfilled(volume);
}
Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!
- 主要言語
- Solidity
- スター
- 515
- フォーク
- 189
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
smartcontractkit/chainlink-mix のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
-
Wrong instructionsオープン
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
smartcontractkit/chainlink-mix#50 · コメント 1 件 ·
smartcontractkit/chainlink-mix の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ava-labs/builders-hub#4922 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
icon-project/sodax-sdks#696 ·
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
th30d4y/OpenLearnX#737 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
btclib-org/btclib-node#2656 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hiero-ledger/hiero-sdk-js#4832 ·
メンテナーはふだん 1 日以内に返信