-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [draft] vaults validators triggerable exits #933
base: feat/vaults
Are you sure you want to change the base?
Conversation
Add role ADD_FULL_WITHDRAWAL_REQUEST_ROLE for full withdrawal requests.
…hdrawal-credentials
Access pubkeys and amounts directly instead of copying them to memory.
pass pubkeys as array of bytes
…o feat/waults-triggerable-exits # Conflicts: # scripts/scratch/steps/0120-initialize-non-aragon-contracts.ts
# Conflicts: # contracts/0.8.25/vaults/Dashboard.sol # test/integration/vaults-happy-path.integration.ts
…le-exits # Conflicts: # contracts/0.8.9/WithdrawalVault.sol # contracts/common/lib/TriggerableWithdrawals.sol
…le-exits # Conflicts: # contracts/common/lib/TriggerableWithdrawals.sol # test/common/lib/triggerableWithdrawals/triggerableWithdrawals.test.ts
function addFullWithdrawalRequests( | ||
bytes calldata pubkeys | ||
) external payable onlyRole(ADD_FULL_WITHDRAWAL_REQUEST_ROLE) { | ||
uint256 prevBalance = address(this).balance - msg.value; | ||
|
||
uint256 minFeePerRequest = TriggerableWithdrawals.getWithdrawalRequestFee(); | ||
uint256 totalFee = (pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH) * minFeePerRequest; | ||
|
||
if (totalFee > msg.value) { | ||
revert InsufficientTriggerableWithdrawalFee( | ||
msg.value, | ||
totalFee, | ||
pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH | ||
); | ||
} | ||
|
||
TriggerableWithdrawals.addFullWithdrawalRequests(pubkeys, minFeePerRequest); | ||
|
||
uint256 refund = msg.value - totalFee; | ||
if (refund > 0) { | ||
(bool success, ) = msg.sender.call{value: refund}(""); | ||
|
||
if (!success) { | ||
revert TriggerableWithdrawalRefundFailed(); | ||
} | ||
} | ||
|
||
assert(address(this).balance == prevBalance); | ||
} |
Check warning
Code scanning / Slither
Divide before multiply Medium
- totalFee = (pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH) * minFeePerRequest
function addFullWithdrawalRequests( | ||
bytes calldata pubkeys | ||
) external payable onlyRole(ADD_FULL_WITHDRAWAL_REQUEST_ROLE) { | ||
uint256 prevBalance = address(this).balance - msg.value; | ||
|
||
uint256 minFeePerRequest = TriggerableWithdrawals.getWithdrawalRequestFee(); | ||
uint256 totalFee = (pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH) * minFeePerRequest; | ||
|
||
if (totalFee > msg.value) { | ||
revert InsufficientTriggerableWithdrawalFee( | ||
msg.value, | ||
totalFee, | ||
pubkeys.length / TriggerableWithdrawals.PUBLIC_KEY_LENGTH | ||
); | ||
} | ||
|
||
TriggerableWithdrawals.addFullWithdrawalRequests(pubkeys, minFeePerRequest); | ||
|
||
uint256 refund = msg.value - totalFee; | ||
if (refund > 0) { | ||
(bool success, ) = msg.sender.call{value: refund}(""); | ||
|
||
if (!success) { | ||
revert TriggerableWithdrawalRefundFailed(); | ||
} | ||
} | ||
|
||
assert(address(this).balance == prevBalance); | ||
} |
Check warning
Code scanning / Slither
Dangerous strict equalities Medium
- assert(bool)(address(this).balance == prevBalance)
41728a7
to
a30cd67
Compare
Hardhat Unit Tests Coverage Summary
Diff against master
Results for commit: 7f18488 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
…ct during scratch deploy Grant ADD_FULL_WITHDRAWAL_REQUEST_ROLE to ValidatorsExitBusOracle contract
…le-exits # Conflicts: # scripts/scratch/steps/0130-grant-roles.ts
# Conflicts: # contracts/0.8.25/vaults/Dashboard.sol
Add options for node operator, vault owner, and dao to exit validators from the beacon chain.
requestValidatorExit
– just an event fromREQUEST_VALIDATOR_EXIT_ROLE
to NO to exit validators.initiateValidatorWithdrawal
- EIP-7002-based trigger for validators exit by VO of NO. Will trigger complete validators exit.initiatePartialValidatorWithdrawal
- EIP-7002-based trigger for validators exit by VO of NO. This will trigger partial validator withdrawals from the beacon chain.Extras: