Skip to content

Commit

Permalink
Fix failing fork test
Browse files Browse the repository at this point in the history
  • Loading branch information
ermyas committed Mar 20, 2024
1 parent b2e11a4 commit e4f2e1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/fork/root/RootERC20BridgeFlowRate.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@ contract RootERC20BridgeFlowRateForkTest is Test, Utils {
uint256 largeTransferThreshold = bridge.largeTransferThresholds(token);
uint256 totalWithdrawals;
uint256 amount;
while (depth > 0) {
// There could be scenarios where depth is already 0 but the withdrawal queue is not activated.
// For instance, when the global queue was activated in the past and then manually deactivated.
// Hence, a do-while loop is used to ensure that at least one withdrawal transaction is sent before checking the depth.
do {
amount = depth > largeTransferThreshold ? largeTransferThreshold - 1 : depth + 1;
_giveBridgeFunds(address(bridge), token, amount);
_sendWithdrawalMessage(bridge, token, withdrawer, amount);
(, depth,,) = bridge.flowRateBuckets(token);
totalWithdrawals += amount;
}
} while (depth > 0);

assertTrue(bridge.withdrawalQueueActivated());
_verifyWithdrawalWasQueued(bridge, token, withdrawer, amount);
Expand Down

0 comments on commit e4f2e1c

Please sign in to comment.