Soulmate::getDivorced
Not Resetting soulmateOf Mapping After DivorceDescription: In the Soulmate::getDivorced()
function of the Soulmate
contract, the Soulmate::soulmateOf
mapping is not reset after a couple gets divorced. This means that even after divorce, the mapping still retains the soulmate relationship between the two parties, potentially leading to incorrect behavior or inconsistencies in the application logic.
Impact: The failure to reset the soulmateOf
mapping after divorce could lead to unexpected behavior when querying the soulmate relationship between users. This inconsistency could cause confusion or errors in the application logic and could potentially allow users to exploit the system by falsely claiming soulmate relationships.
Proof of Concept:
Suppose soulmate1 and soulmate2 are soulmates and are represented by their addresses.
soulmate1 and soulmate2 get married, and their soulmate relationship is recorded.
soulmate1 and soulmate2 decide to divorce by calling the getDivorced()
function.
The soulmateOf
mapping is not reset, so both soulmate1 and soulmate2 still have each other as soulmates.
However, they are now divorced, which leads to inconsistencies in the application logic.
Past this code in SoulmateTest.t.sol
:
Recommended Mitigation:
In the getDivorced()
function, ensure that the soulmateOf
mapping is reset for both parties involved in the divorce. This ensures that after divorce, the soulmate relationship is cleared, and the application maintains consistency in its state.
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.