-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: describe full withdrawal method in withdrawal vault
- Loading branch information
Showing
2 changed files
with
18 additions
and
4 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 |
---|---|---|
|
@@ -143,9 +143,19 @@ contract WithdrawalVault is AccessControlEnumerable, Versioned { | |
} | ||
|
||
/** | ||
* @dev Adds full withdrawal requests for the provided public keys. | ||
* The validator will fully withdraw and exit its duties as a validator. | ||
* @param pubkeys An array of public keys for the validators requesting full withdrawals. | ||
* @dev Submits EIP-7002 full withdrawal requests for the specified public keys. | ||
* Each request instructs a validator to fully withdraw its stake and exit its duties as a validator. | ||
* Refunds any excess fee to the caller after deducting the total fees, | ||
* which are calculated based on the number of public keys and the current minimum fee per withdrawal request. | ||
* | ||
* @param pubkeys A tightly packed array of 48-byte public keys corresponding to validators requesting full withdrawals. | ||
* | ----- public key (48 bytes) ----- || ----- public key (48 bytes) ----- | ... | ||
* | ||
* @notice Reverts if: | ||
* - The caller does not have the `ADD_FULL_WITHDRAWAL_REQUEST_ROLE`. | ||
* - Validation of any of the provided public keys fails. | ||
* - The provided total withdrawal fee is insufficient to cover all requests. | ||
* - Refund of the excess fee fails. | ||
*/ | ||
function addFullWithdrawalRequests( | ||
bytes calldata pubkeys | ||
|
@@ -177,6 +187,10 @@ contract WithdrawalVault is AccessControlEnumerable, Versioned { | |
assert(address(this).balance == prevBalance); | ||
} | ||
Check warning Code scanning / Slither Divide before multiply Medium
WithdrawalVault.addFullWithdrawalRequests(bytes) performs a multiplication on the result of a division:
- totalFee = (pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH) * minFeePerRequest Check warning Code scanning / Slither Dangerous strict equalities Medium
WithdrawalVault.addFullWithdrawalRequests(bytes) uses a dangerous strict equality:
- assert(bool)(address(this).balance == prevBalance) |
||
|
||
/** | ||
* @dev Retrieves the current EIP-7002 withdrawal fee. | ||
* @return The minimum fee required per withdrawal request. | ||
*/ | ||
function getWithdrawalRequestFee() external view returns (uint256) { | ||
return TriggerableWithdrawals.getWithdrawalRequestFee(); | ||
} | ||
|
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