Open hats-bug-reporter[bot] opened 11 months ago
As you mentioned, it is a possible issue.
... In this case, the 2300 gas limit might not be enough for smart contract interactions. ...
But it didn't happen in our setup yet. So 2300 gas is enough.
Github username: @0xmuxyz Twitter username: -- Submission hash (on-chain): 0x834c2aefee1a5e8b690e5084d0503016ac1a4cf4d2fa334bb94c4a7eaa27ab4d Severity: medium
Description:
Description
When a full withdrawal, the EtherFiNodesManager#
fullWithdraw()
would be called.Within the EtherFiNodesManager#
fullWithdraw()
, the EtherFiNodesManager#_distributePayouts()
would be called like this: \ https://github.com/hats-finance/ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4/blob/180c708dc7cb3214d68ea9726f1999f67c3551c9/src/EtherFiNodesManager.sol#L259When a partial withdrawal to skim rewards, the EtherFiNodesManager#
partialWithdraw()
would be called.Within the EtherFiNodesManager#
partialWithdraw()
, the EtherFiNodesManager#_distributePayouts()
would be called as well like this: \ https://github.com/hats-finance/ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4/blob/180c708dc7cb3214d68ea9726f1999f67c3551c9/src/EtherFiNodesManager.sol#L229Within the EtherFiNodesManager#
_distributePayouts()
, the EtherFiNode#withdrawFunds()
would be called like this: \ https://github.com/hats-finance/ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4/blob/180c708dc7cb3214d68ea9726f1999f67c3551c9/src/EtherFiNodesManager.sol#L495-L500Within the EtherFiNode#
withdrawFunds()
, funds (Native ETH) would be transferred from this EtherFiNode (Withdrawal Safe) contract to the 4 associated parties (bNFT, tNFT, treasury, nodeOperator) like this: \ https://github.com/hats-finance/ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4/blob/180c708dc7cb3214d68ea9726f1999f67c3551c9/src/EtherFiNode.sol#L163-L169However, within the EtherFiNode#
withdrawFunds()
above, the_treasuryAmount
of Native ETH would be transferred to the Treasury contract (_treasury
) with the small and fixed amount of gas unit (2300
gas) like this: \ https://github.com/hats-finance/ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4/blob/180c708dc7cb3214d68ea9726f1999f67c3551c9/src/EtherFiNode.sol#L169This is problematic. Because both the sender (the EtherFiNode contract) and the receiver (the Treasury contract) would be a smart contract respectively. In this case, the 2300 gas limit might not be enough for smart contract interactions. For example, if the receiver contract has a
receive()
function orfallback()
function that takes more than 2300 gas units, which is too low. (Remarks: Thereceive()
function would be implemented in the Treasury contract) \ In another scenario, if a congestion would occur on Ethereum Mainnet, a transaction cost would be higher than a usual. In this case, 2300 gas units cause an insufficient gas to send Native ETH.This lead to reverting to transfer funds (Native ETH) from the EtherFiNode contract to the Treasury contract via the EtherFiNode#
withdrawFunds()
when a full withdrawal or a partial withdrawal.Impact
This lead to reverting to transfer funds (Native ETH) from the EtherFiNode contract to the Treasury contract via the EtherFiNode#
withdrawFunds()
when a full withdrawal or a partial withdrawal.Recommendation
Within the EtherFiNode#
withdrawFunds()
, consider removing the fixed-gas limit (2300
) from the low-level call that send Native ETH to the Treasury contract like this: