-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit tests for Withdrawal Vault excess fee refund behavior
- Loading branch information
Showing
3 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
// for testing purposes only | ||
|
||
pragma solidity 0.8.9; | ||
|
||
interface IWithdrawalVault { | ||
function addFullWithdrawalRequests(bytes calldata pubkeys) external payable; | ||
function getWithdrawalRequestFee() external view returns (uint256); | ||
} | ||
|
||
/** | ||
* @notice This is a contract for testing refund failure in WithdrawalVault contract | ||
*/ | ||
contract RefundFailureTester { | ||
IWithdrawalVault private immutable withdrawalVault; | ||
|
||
constructor(address _withdrawalVault) { | ||
withdrawalVault = IWithdrawalVault(_withdrawalVault); | ||
} | ||
|
||
receive() external payable { | ||
revert("Refund failed intentionally"); | ||
} | ||
|
||
function addFullWithdrawalRequests(bytes calldata pubkeys) external payable { | ||
require(msg.value > withdrawalVault.getWithdrawalRequestFee(), "Not enough eth for Refund"); | ||
|
||
// withdrawal vault should fail to refund | ||
withdrawalVault.addFullWithdrawalRequests{value: msg.value}(pubkeys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters