Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/horizon/test/unit/escrow/getters.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down