The game contract is designed for users to participate exclusively through the claimThrone
function. This function correctly handles incoming funds by recording the deposit, registering the user as a player, and allocating the funds between the game owner and the eventual winner.
However, the contract also includes a receive
function, which passively accepts plain ETH transfers. If a user accidentally sends ETH directly to the contract (e.g., via send
, transfer
, or a plain call
), the receive
function will accept the funds but will not add the amount to the game pot, register the sender as a player, or provide any way to recover the funds.
Likelihood:
User will send claim fee using a smart contract or EAO with EIP-7702 via send
, transfer
, or a plain call
Impact:
Transfered ETH is not added to the game pot.
User is not registered as a player.
User's funds stuck forever in the game.
The following test should be added to the Game.t.sol
file.
One way to handle this scenario is to call the claimThrone
function inside the receive
function to give a fair chance to become a king to unaware users.
There is no reason for a user to directly send ETH or anything to this contract. Basic user mistake, info, invalid according to CH Docs.
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.