Lucene search

K
code423n4Code4renaCODE423N4:2022-12-STEALTH-PROJECT-FINDINGS-ISSUES-108
HistoryDec 12, 2022 - 12:00 a.m.

Changes not being stored in Delta.sol

2022-12-1200:00:00
Code4rena
github.com
4
vulnerability
impact
storage
mitigation
instance
functions

Lines of code

Vulnerability details

Changes not being stored in Delta.sol

Impact

Functions working without proper storage dealing into unexpected behaviors

##Proof of Concept

    function combine(Instance memory self, Instance memory delta) internal pure {
        if (!self.skipCombine) {
            self.deltaInBinInternal += delta.deltaInBinInternal;
            self.deltaInErc += delta.deltaInErc;
            self.deltaOutErc += delta.deltaOutErc;
        }
        self.excess = delta.excess;
        self.decrementTick = delta.decrementTick;
        self.endSqrtPrice = delta.endSqrtPrice;
        self.swappedToMaxPrice = delta.swappedToMaxPrice;
    }//@audit not stored

    function pastMaxPrice(Instance memory self) internal pure {
        self.swappedToMaxPrice = self.sqrtPriceLimit != 0 && (self.tokenAIn ? self.sqrtPriceLimit <= self.sqrtPrice : self.sqrtPriceLimit >= self.sqrtPrice);
    }//@audit not stored 


    function noSwapReset(Instance memory self) internal pure {
        self.excess = 0;
        self.skipCombine = true;
        self.endSqrtPrice = self.sqrtPrice;
    }//@audit not stored

Mitigation

Use Instance storage self or return values


The text was updated successfully, but these errors were encountered:

All reactions