Platform: Code4rena
Start Date: 22/11/2022
Pot Size: $36,500 USDC
Total HM: 5
Participants: 3
Period: 6 days
Judge: GalloDaSballo
Total Solo HM: 5
Id: 184
League: ETH
Rank: 3/3
Findings: 0
Award: $0.00
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: zzzitron
Also found by: csanuragjain, izhuer
Data not available
Contract: https://github.com/code-423n4/2022-11-ens/blob/main/contracts/wrapper/ERC1155Fuse.sol#L202
Issue:
Both functions _doSafeBatchTransferAcceptanceCheck
and _doSafeTransferAcceptanceCheck
are doing same job, one for multiple id and other for single id. We can combine both by revising the safeBatchTransferFrom
function
Recommendation:
Revise the safeBatchTransferFrom
function
function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { ... for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; (address oldOwner, uint32 fuses, uint64 expiry) = getData(id); _preTransferCheck(id, fuses, expiry); require( amount == 1 && oldOwner == from, "ERC1155: insufficient balance for transfer" ); _setData(id, to, fuses, expiry); _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data); } emit TransferBatch(msg.sender, from, to, ids, amounts); }
#0 - GalloDaSballo
2022-11-28T20:21:15Z
I think this is a valid Refactoring from a SW standpoint, but I believe it will cost more gas due to how Low Level optimizations are made, will defer to the sponsor, would argue the change is very minor in either case
#1 - jefflau
2022-12-05T18:56:18Z
We are using code directly pasted from OZ here. If there aren't any gas savings to be made, I wouldn't qualify this myself.
#2 - GalloDaSballo
2022-12-06T20:21:09Z
Marking as NC as it's worth entertaining but low impact
#3 - GalloDaSballo
2022-12-06T20:21:11Z
1NC
#4 - c4-judge
2022-12-06T20:22:17Z
GalloDaSballo marked the issue as grade-b
#5 - GalloDaSballo
2022-12-11T16:48:33Z
Confirming B rating (3rd best)