From aa1004567e116f0abaccd674a248c76bced7f937 Mon Sep 17 00:00:00 2001 From: Rembrandt Kuipers <50174308+RembrandtK@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:26:35 +0000 Subject: [PATCH] fix: resolve fuzz test failure in testGetBalance_WhenCollectedOverThawing Replace vm.assume with bounded inputs to fix "vm.assume rejected too many inputs" error. The previous implementation used overly restrictive constraints that caused the fuzzer to reject most random inputs. Now limits amountThawing and amountCollected to half of MAX_STAKING_TOKENS, guaranteeing valid deposit ranges while maintaining test coverage. --- packages/horizon/test/unit/escrow/getters.t.sol | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/horizon/test/unit/escrow/getters.t.sol b/packages/horizon/test/unit/escrow/getters.t.sol index 2d348cab2..ded655b39 100644 --- a/packages/horizon/test/unit/escrow/getters.t.sol +++ b/packages/horizon/test/unit/escrow/getters.t.sol @@ -35,20 +35,17 @@ contract GraphEscrowGettersTest is GraphEscrowTest { uint256 amountThawing, uint256 amountCollected ) public useGateway { - amountThawing = bound(amountThawing, 1, MAX_STAKING_TOKENS); - amountCollected = bound(amountCollected, 1, MAX_STAKING_TOKENS); + // Limit thawing and collected to half of MAX_STAKING_TOKENS to ensure valid deposit range + amountThawing = bound(amountThawing, 1, MAX_STAKING_TOKENS / 2); + amountCollected = bound(amountCollected, 1, MAX_STAKING_TOKENS / 2); // amountDeposit must be: // - >= amountThawing (so we can thaw that amount) // - >= amountCollected (so we can collect that amount) // - < amountThawing + amountCollected (so that after collecting, balance < thawing) - // - <= MAX_STAKING_TOKENS (consistent with other tests) + // With the above bounds, this range is guaranteed to be valid uint256 minDeposit = amountThawing > amountCollected ? amountThawing : amountCollected; uint256 maxDeposit = amountThawing + amountCollected - 1; - if (maxDeposit > MAX_STAKING_TOKENS) { - maxDeposit = MAX_STAKING_TOKENS; - } - vm.assume(minDeposit <= maxDeposit); amountDeposit = bound(amountDeposit, minDeposit, maxDeposit); _depositTokens(users.verifier, users.indexer, amountDeposit);