-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Vault reentrancy guard #17487
Vault reentrancy guard #17487
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
4cdf93d
to
ade5a19
Compare
1cabba8
to
cdd389f
Compare
receive() external payable { | ||
if (!attackInitiated) { | ||
attackInitiated = true; | ||
vault.transferETH(payable(address(this)), 100); | ||
} | ||
} | ||
|
||
function attack() external payable { | ||
attackInitiated = false; | ||
vault.transferETH(payable(address(this)), 100); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not
receive() external payable {
vault.transferETH(payable(address(this)), 100);
}
function attack() external payable {
vault.transferETH(payable(address(this)), 100);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would cause an Infinite loop / any call to the attack() function would run out of gas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't the reentrancy guard catch this in the 2nd loop?
No description provided.