forked from stakewise/v3-core
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Loss of vault creator msg.value #83
Labels
bug
Something isn't working
Comments
Better Revised Code: - uint256 private constant _securityDeposit = 1e9;
.
.
.
function __VaultEthStaking_init() internal onlyInitializing {
__ReentrancyGuard_init();
// see https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706
- if (msg.value < _securityDeposit) revert Errors.InvalidSecurityDeposit();
- _deposit(address(this), msg.value, address(0));
+ if (msg.value == 0) revert Errors.InvalidSecurityDeposit();
+ _deposit(address(this), 1, address(0));
+ if (msg.value - 1 > 0){
+ _deposit(msg.sender, msg.value-1, address(0));
+ }
+
} It should be considered that Users might think that The more is deposited, the stronger is protection against inflation attack, SO users will lose more ETH. |
duplicate of #12 |
tsudmi
added
duplicate
This issue or pull request already exists
and removed
duplicate
This issue or pull request already exists
labels
Aug 25, 2023
@tsudmi Please close this one. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github username: @0xmahdirostami
Submission hash (on-chain): 0x7ec93058030614963b3bf5a4f2e1b97c0d34cf5a43596b9367ae9b23e29c6bb5
Severity: high
Description:
Description
As mentioned in docs:
BUT it is not necessary for Stakewise vaults because vaults use the internal state for calculating shares not the balance of vaults:
_totalAssets is an internal state:
So it is a loss of funds for the vault creator.
Impact\
The Vault creator loses his msg.value for nothing
Attachments
Revised Code File (Optional)
As we need at least 1 wei for not reverting in the _convertToShares function, I recommend this code:
The text was updated successfully, but these errors were encountered: