Omniscia Euler Finance Audit

Storage Code Style Findings

Storage Code Style Findings

SEG-01C: Potential Combination of Data Points

Description:

The Snapshot structure has an empty variable meant to remain as "dirty" at all times to prevent the Snapshot storage slot from ever being zeroed out as part of a gas optimization. The initialized flag, on the other hand, is meant to remain true during the contract's normal operation.

Example:

src/EVault/shared/Storage.sol
7/// @title Storage
8/// @author Euler Labs (https://www.eulerlabs.com/)
9/// @notice Contract that defines the EVault's data storage
10abstract contract Storage {
11 /// @notice Flag indicating if the vault has been initialized
12 bool initialized;
13
14 /// @notice Snapshot of vault's cash and borrows created at the beginning of an operation or a batch of operations
15 /// @dev The snapshot is separate from VaultStorage, because it could be implemented as transient storage
16 Snapshot snapshot;
17
18 /// @notice A singleton VaultStorage
19 VaultStorage vaultStorage;
20}

Recommendation:

We advise the initialized and snapshot data points to be potentially combined, optimizing the Storage contract's storage layout.

Alleviation (fb2dd77a6ff9b7f710edb48e7eb5437e0db4fc1a):

The Euler Finance team evaluated this recommendation and opted to retain the data structures separate as the current layout is better suited for their future plans, such as utilization of transient storage (i.e. EIP-1153).

As such, we consider this exhibit inapplicable in light of the Euler Finance team's future plans.