Use of return value from assignment hampers readability #2
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
TomFrenchBlockchain
Vulnerability details
Impact
Reduced readability
Proof of Concept
In a number of placed we seem to be inlining an assignment with the usage of that variable:
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L40
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L70
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L83
This is quite atypical in my experience and reduces readability: lines which contain require statements and event emission now modify contract storage.
Recommended Mitigation Steps
Consider whether any small benefits to gas/compactness are worth the reduced clarity.
The text was updated successfully, but these errors were encountered: