Closed sherlock-admin2 closed 4 months ago
Amusing Turquoise Cormorant
Low/Info
storage
memory
Unnecessary usage of storage instead of memory, leads to excessively high gas fees
Reading from storage can be many times more expensive to perform and it's not needed when the function doesn't change the state of the the blockchain.
Users pay excessively high gas fees for nothing
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L240
Manual Review
if the function is view(only reads from blockchain but doesn't change it's state) use memory instead of storage for gas saving
view
Amusing Turquoise Cormorant
Low/Info
Unnecessary usage of
storage
instead ofmemory
, leads to excessively high gas feesSummary
Unnecessary usage of
storage
instead ofmemory
, leads to excessively high gas feesVulnerability Detail
Reading from storage can be many times more expensive to perform and it's not needed when the function doesn't change the state of the the blockchain.
Impact
Users pay excessively high gas fees for nothing
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L240
Tool used
Manual Review
Recommendation
if the function is
view
(only reads from blockchain but doesn't change it's state) usememory
instead ofstorage
for gas saving