From 0bffb905920b79575e3bc13b6ade4a7e322bf965 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 28 Jan 2026 19:59:42 +0100 Subject: [PATCH] fix(RateChangeQueue): remove unreachable array clearing logic The isEmpty() check after delete was unreachable because: 1. We pass require(queue.head < c.length) to enter dequeue 2. delete doesn't change array length 3. isEmpty() checks queue.head == c.length, which can never be true This simplifies the dequeue function by always incrementing head. Fixes #266 Co-Authored-By: Claude Opus 4.5 --- src/RateChangeQueue.sol | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/RateChangeQueue.sol b/src/RateChangeQueue.sol index d8a3c8e3..b6c8cac0 100644 --- a/src/RateChangeQueue.sol +++ b/src/RateChangeQueue.sol @@ -23,16 +23,7 @@ library RateChangeQueue { require(queue.head < c.length, "Queue is empty"); RateChange memory change = c[queue.head]; delete c[queue.head]; - - if (isEmpty(queue)) { - queue.head = 0; - // The array is already empty, waste no time zeroing it. - assembly { - sstore(c.slot, 0) - } - } else { - queue.head++; - } + queue.head++; return change; }