OpenSea Seaport contest - TerrierLover's results

A marketplace contract for safely and efficiently creating and fulfilling orders for ERC721 and ERC1155 items.

General Information

Platform: Code4rena

Start Date: 20/05/2022

Pot Size: $1,000,000 USDC

Total HM: 4

Participants: 59

Period: 14 days

Judge: leastwood

Id: 128

League: ETH

OpenSea

Findings Distribution

Researcher Performance

Rank: 54/59

Findings: 1

Award: $434.51

🌟 Selected for report: 0

🚀 Solo Findings: 0

[Gas-1] No need to set 0 on uint variables

The default value of uint varibles are 0. Therefore, there is no need to set 0 on uint variables. Not setting 0 on uint variables can reduce the deployment gas cost.

Here are some examples:

https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/AmountDeriver.sol#L44

uint256 extraCeiling = 0;

https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/CriteriaResolution.sol#L56

for (uint256 i = 0; i < totalCriteriaResolvers; ++i) {

They can be modified as follows:

uint256 extraCeiling;
for (uint256 i; i < totalCriteriaResolvers; ++i) {

[Gas-2][FulfillmentApplier.sol] unchecked can be used in _applyFulfillment function

Since it has if (considerationItem.amount > execution.item.amount) check, following parts can be wrapped by unchecked like them.

https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/FulfillmentApplier.sol#L97-L100

if (considerationItem.amount > execution.item.amount) { ... unchecked { advancedOrders[targetComponent.orderIndex] .parameters .consideration[targetComponent.itemIndex] .startAmount = considerationItem.amount - execution.item.amount; }

https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/FulfillmentApplier.sol#L109-L112

} else { ... unchecked { advancedOrders[targetComponent.orderIndex] .parameters .offer[targetComponent.itemIndex] .startAmount = execution.item.amount - considerationItem.amount; }

#0 - HardlyDifficult

2022-07-05T00:10:01Z

No need to set 0 on uint variables

I tested this and got mixed results - some functions saved a tiny amount, others got a bit worse.

The other suggestion should have small savings.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter