Notional x Index Coop - UnusualTurtle's results

A collaboration between Notional and Index Coop to create fixed rate yield index tokens.

General Information

Platform: Code4rena

Start Date: 07/06/2022

Pot Size: $75,000 USDC

Total HM: 11

Participants: 77

Period: 7 days

Judge: gzeon

Total Solo HM: 7

Id: 124

League: ETH

Notional

Findings Distribution

Researcher Performance

Rank: 67/77

Findings: 1

Award: $47.60

🌟 Selected for report: 0

🚀 Solo Findings: 0

1. Avoiding initialization of loop index can save a little gas

POC

Examples of this issue in the codebase: https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L618

https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L238

impact

The local variable used for the loop index need not be initialized to 0 because the default value is 0. Avoiding this anti-pattern can save a few opcodes and therefore a tiny bit of gas.


2. Use != 0 instead of > 0

POC

Examples of this issue in the codebase:

https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L619

https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L607

impact

Using != 0 is slightly cheaper than > 0.


3. Using Prefix (++i) rather than postfix (i++) in increment/decrement operators in for-loops

POC

Examples of this issue in the codebase:

https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L605

https://github.com/code-423n4/2022-06-notional-coop/blob/cdf34d775d8e1deb6805968ff1b7fec93cab5387/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L238

impact

using the prefix increment/decrement operators (++i/--i) cost less gas PER LOOP than the postfix increment/decrement operators (i++/i--)


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