From 47c0cdcdeba6144f19cecdc52325fc6608dc0114 Mon Sep 17 00:00:00 2001 From: C4 <81770958+code423n4@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:21:44 +0200 Subject: [PATCH] Report for issue #447 updated by __141345__ --- data/__141345__-G.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/data/__141345__-G.md b/data/__141345__-G.md index faa3340..2baa669 100644 --- a/data/__141345__-G.md +++ b/data/__141345__-G.md @@ -186,17 +186,6 @@ src/lib/token/ERC721Votes.sol mapping(address => mapping(uint256 => Checkpoint)) internal checkpoints; ``` -#### Variables referred multiple times can be cached in local memory - -Each storage read uses opcode `sload` which costs 100 gas (warm access), while memory read uses `mload` which only cost 3 gas. ([reference](https://ethereum.org/en/developers/docs/evm/opcodes/)) -Even for a memory struct variable, the member variable access still has overhead. It can be saved further by caching the final result. - - -`proposal.proposer` can be cached. -src/governance/governor/Governor.sol -```solidity - -``` #### Use bit shift instead of power operation or * 2, / 2 @@ -215,4 +204,3 @@ Change the above to ``` The demo of the gas comparison can be seen [here](https://github.com/Flame57/gas_demo/blob/main/bit_shift.sol). -