Missing state updates or optimizable state variables
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- solidity
- 領域
- blockchain
調査の方向性
Start by reading dynamic-nft-3-services/SuperDynamicNFT.sol and ultimate-nft-repo/contracts/RandomIpfsNft.sol. Trace every use and assignment of callbackGasLimit, requestConfirmations, numWords, and s_tokenIdToBreed, then compare their roles with Solidity constant and immutable documentation. Done means each reported variable has a documented decision about whether it needs updates or a modifier change.
索引モデルが issue の本文から書いたものです。
説明
Hi, we are a research group on programming languages and software engineering. We recently conducted a systematic study on the causes, effects, and fixes of the inconsistent state update vulnerability in solidity. We are attempting to build a tool to detect bugs about state updates based on our findings. We have tried our prototype tool on some popular Github solidity repositories, and for your repository, we found that there are missing state updates or gas consumption that can be optimized.
The point is that when we declare a state variable in the contract, if the variable is not reassigned throughout the project, it may be a missed state update, including balance, order number, counter, contract status flag, etc. Of course, it may also be a state variable with special purposes that does not need to be changed, such as maximum supply, contract administrator address, configuration information, etc. When declaring these state variables that do not need to be changed, the constant or immutable modifier should be used as required, which will save gas.
For your repository, we found the following state variables that may need attention. If you are not forgetting to update them, perhaps you should declare them with the constant or immutable modifier:
SuperDynamicNFT.sol
State variable: callbackGasLimit, requestConfirmations, numWords
uint32 private callbackGasLimit = 2500000;
uint16 private requestConfirmations = 3;
uint32 private numWords = 6;
RandomIpfsNft.sol
State variable: s_tokenIdToBreed
mapping(uint256 => Breed) private s_tokenIdToBreed;
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!
(The reason why constant and immutable modifiers can save gas is that they do not consume storage space within the EVM. Their values are compiled directly into smart contract bytecode, which reduces the gas cost of storage. This storage method also avoids the SLOAD operation that reads EVM storage (costs about 100 gas in EVM). The main difference between constant and immutable variables is that the value of immutable variables can be set in the constructor, and immutable variables may cost more gas than constant variables. In addition, there is a slight difference in the variable types they support. The official documentation describes more details: https://docs.soliditylang.org/en/latest/contracts.html)
- 主要言語
- Solidity
- スター
- 243
- フォーク
- 116
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
smartcontractkit/smart-contract-examples のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
smartcontractkit/smart-contract-examples#10 · コメント 1 件 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 50/100
smartcontractkit/smart-contract-examples#91 · コメント 1 件 · リアクション 1 件 ·
-
Wioowオープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
-
Update the Functions example README to use the new .env.enc再び着手できるかも @buddhiraz が 957 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
smartcontractkit/smart-contract-examples#22 · コメント 1 件 ·
smartcontractkit/smart-contract-examples の issue をすべて見る
似ている issue
-
_check_tx_inputs lacks Core's bad-txns-inputvalues-outofrange and bad-txns-fee-outofrange checksオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
btclib-org/btclib-node#2111 ·
メンテナーはふだん 1 日以内に返信
-
dincli: `task model-owner register-request --manifestCID` fails because the registry contract isn't initialised対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
InfiniteZeroFoundation/DevNet#295 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
paritytech/polkadot-sdk#13625 ·
メンテナーはふだん 1 日以内に返信
-
Add address-balance gas to the PTB building guide対応中かも @NaitsabesMue が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MystenLabs/skills#138 ·
メンテナーはふだん 1 日以内に返信
-
[Integration]: eRPCオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ava-labs/builders-hub#4826 ·
メンテナーはふだん 1 日以内に返信