Root Cause: The _payout function handles failed Ether transfers by crediting the amount to failedTransferCredits[recipient] when (bool success, ) = payable(recipient).call{value: amount}("") returns false, but it does not emit an event to log this action. This omission leaves no on-chain record of the failure or the subsequent crediting.
Impact: The lack of event emission reduces transparency, making it challenging for users and developers to detect failed transfers or monitor funds credited to failedTransferCredits. This can lead to debugging difficulties, decreased user trust, and potential operational inefficiencies, especially in a marketplace handling significant transactions.
The BidBeastsNFTMarket::_payout function handles failed Ether transfers by silently crediting the amount to failedTransferCredits[recipient] without emitting an event. This lack of transparency makes it difficult for users or developers to detect and debug failed transfers. Emitting an event when a transfer fails would improve traceability and allow off-chain systems to monitor contract behavior effectively.
Likelihood: Medium. The issue affects all failed transfers, a scenario that may occur due to gas limits, recipient contract reverts, or out-of-gas conditions. The likelihood increases with active usage or interactions with untrusted contracts.
Impact: Medium. While not causing direct financial loss, the lack of transparency hinders monitoring and debugging, potentially leading to unresolved issues, user frustration, and reduced trust in the platform’s reliability.
The following analysis demonstrates the absence of event emission for failed transfers.
Add the following to BidBeastsNFTMarketTest.t.sol and run with:
Setup: The contract is funded, and a recipient address is set to revert all calls, simulating a failed transfer.
Issue: The _payout function credits 10 ether to failedTransferCredits[recipient] but emits no event, as verified by vm.expectEmit(false, ...).
Result: The test confirms the lack of event emission, highlighting the transparency gap for failed transfers.
Emit an event when a transfer fails to notify users and developers of the failure and the crediting of funds to failedTransferCredits.
Use a custom error instead of silent failure to improve clarity and save gas.
Example:
placeBid emits AuctionSettled even though the auction hasn’t ended, causing misleading event logs.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.