The buyOutEstateNFT() function in InheritanceManager.sol has a critical loop exit bug that prevents proper fund distribution. If msg.sender appears early in the beneficiaries list, the function stops execution prematurely, leading to partial or no fund transfers. This causes an inconsistent distribution mechanism.
The function incorrectly exits early when it encounters msg.sender in the loop:
Since msg.sender (the buyer) can be anywhere in the list, the number of people receiving funds varies depending on their position.
Partial distribution if msg.sender appears later—some beneficiaries receive funds, but others do not.
No distribution if msg.sender appears first
Loss of user funds, as msg.sender pays but doesn't ensure complete distribution
Foundry (Forge) Testing Framework
Console Logs to trace balance updates
continue; Instead of return;Ensure all beneficiaries receive their funds, skipping msg.sender without stopping the loop:
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.