Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: high
Invalid

Contract Storage Inconsistencies from Deposit Reverts

Summary

The deposit() function directly updates on-chain storage upon receiving a deposit transaction, however the token transfer may revert before completing. This could leave storage in an invalid state.

Vulnerability Details

When a user calls deposit(), storage modifications like updating the deposit cache occur immediately. But the token transfer instruction executes separately, and has the potential to revert prior to completion. If this occurs, storage would be prematurely updated, risking inconsistencies.

function deposit(
GMXTypes.Store storage self,
GMXTypes.DepositParams memory dp,
bool isNative
) external {

Reproduction Steps:

  1. User deposits tokens by calling deposit()

  2. Function triggers storage updates like to the deposit cache

  3. Token transfer executes independently

  4. Before transfer settles, it reverts

  5. But storage was already modified out of sync

Impact

Storage inconsistencies if transfer reverts after updates

Tools Used

Manual Review

Recommendations

Defer storage changes until after validating token arrival

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.