function periodCumulativesInside(/* ... */) /* ... */ {
    // ...
    if (lastTick < tickLower) {
        // ...
    } else if (lastTick < tickUpper) {
        // ...
        if (currentPeriod <= period) {
            // ...
        } else {
            cache.secondsPerLiquidityCumulativeX128 = $.periods[period].endSecondsPerLiquidityPeriodX128;
        }
        return
            cache.secondsPerLiquidityCumulativeX128 -
            snapshot.secondsPerLiquidityOutsideLowerX128 -
            snapshot.secondsPerLiquidityOutsideUpperX128;
    } else {
        // ...
    }
}
function _advancePeriod() /* ... */ {
    // ...
    if ((_blockTimestamp() / 1 weeks) != _lastPeriod) {
        // ...
        uint160 secondsPerLiquidityCumulativeX128 = Oracle.newPeriod(
            $.observations,
            _slot0.observationIndex,
            period
        );
        // ...
        $.periods[_lastPeriod].endSecondsPerLiquidityPeriodX128 = secondsPerLiquidityCumulativeX128;
        // ...
    }
}

function newPeriod(/* ... */) /* ... */ {
    // ...
    uint32 delta = uint32(period) * 1 weeks - 1 - last.blockTimestamp;
    secondsPerLiquidityCumulativeX128 =
        last.secondsPerLiquidityCumulativeX128 +
        ((uint160(delta) << 128) / ($.liquidity > 0 ? $.liquidity : 1));
    // ...
}
-------------------- START --------------------
Liquidity start 0n
Tick start 0n
Liquidity after 200n
walletEarned1 4999991732804232804n
attackerEarned1 4999991732804232804n
tokenTotalSupplyByPeriod 10000000000000000000n
attackerEarned2 9999991732804232804n
attacker claim amount 9999991732804232804n
walletEarned2 4999991732804232804n
-------------------- END --------------------
     Inflated multi-week gauge rewards (81ms)
function _advancePeriod() /* ... */ {
    // ...
    if ((_blockTimestamp() / 1 weeks) != _lastPeriod) {
        // ...
        uint160 secondsPerLiquidityCumulativeX128 = Oracle.newPeriod(
            $.observations,
            _slot0.observationIndex,
            _lastPeriod // << CHANGE: pass _lastPeriod instead of period
        );
        // ...
        $.periods[_lastPeriod].endSecondsPerLiquidityPeriodX128 = secondsPerLiquidityCumulativeX128;
        // ...
    }
}

function newPeriod(/* ... */) /* ... */ {
    // ...
    uint32 delta = uint32(period + 1) * 1 weeks - 1 - last.blockTimestamp; // << CHANGE: use end of period instead of start
    secondsPerLiquidityCumulativeX128 =
        last.secondsPerLiquidityCumulativeX128 +
        ((uint160(delta) << 128) / ($.liquidity > 0 ? $.liquidity : 1));
    // ...
}
function periodCumulativesInside(/* ... */) /* ... */ {
    // ...
    snapshot.secondsPerLiquidityOutsideLowerX128 = uint160(lower.periodSecondsPerLiquidityOutsideX128[period]);
    if (tickLower <= startTick && snapshot.secondsPerLiquidityOutsideLowerX128 == 0) {
        snapshot.secondsPerLiquidityOutsideLowerX128 = $
            .periods[previousPeriod]
            .endSecondsPerLiquidityPeriodX128;
    }

    snapshot.secondsPerLiquidityOutsideUpperX128 = uint160(upper.periodSecondsPerLiquidityOutsideX128[period]);
    if (tickUpper <= startTick && snapshot.secondsPerLiquidityOutsideUpperX128 == 0) {
        snapshot.secondsPerLiquidityOutsideUpperX128 = $
            .periods[previousPeriod]
            .endSecondsPerLiquidityPeriodX128;
    }
    // ...
}
