Skip to content

Commit

Permalink
Report for issue #557 updated by wen
Browse files Browse the repository at this point in the history
  • Loading branch information
code423n4 committed Mar 6, 2023
1 parent 400bff9 commit 640cdb1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions data/PwnedNoMore-G.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
## Gas Optimizations

1 Read totalStakesSnapshot[_collateral] twice.
### TroveManager._computeNewStake()
Read totalStakesSnapshot[_collateral] twice.
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Core/contracts/TroveManager.sol#L1224
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Core/contracts/TroveManager.sol#L1225

2 Reading totalCollateralSnapshot[_collateral] twice.
### TroveManager._computeNewStake()
Reading totalCollateralSnapshot[_collateral] twice.
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Core/contracts/TroveManager.sol#L1215
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Core/contracts/TroveManager.sol#L1225

3 Could assign with 'strategyBal - actualWithdrawn' instead of -=.
### ReaperVaultV2._withdraw()
Could assign with 'strategyBal - actualWithdrawn' instead of -=.
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Vault/contracts/ReaperVaultV2.sol#L395

4 Emitting a storage value instead of memory one.
### ReaperVaultV2.updateTvlCap()
Emitting a storage value instead of memory one.
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Vault/contracts/ReaperVaultV2.sol#L581

### ReaperVaultV2.addStrategy()
Prefer not to read/write the state variable `totalAllocBPS` for more than once.
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Vault/contracts/ReaperVaultV2.sol#L156

0 comments on commit 640cdb1

Please sign in to comment.