Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Not all function calls reset the inheritance deadline, which breaks one of the contract invariants

Summary

Contract creation of InheritanceManager, InheritanceManager::removebeneficiary() and InheritanceManager::createEstateNFT() do not call _setDeadline() and do not reset the inheritance deadline, which breaks one of the core invariants of the contract.

Impact

Contract invariant broken.

Proof Of Concept

Add the following test to one of InheritanceManager.t.sol and run the test:

function test_deadlineReset() public {
address alice = makeAddr("alice");
vm.startPrank(owner);
assertEq(0, im.getDeadline()); // contract creation does not reset deadline, contradicting natspec
im.addBeneficiery(alice); // resets deadline
im.getDeadline();
assertEq(1 + 90 days, im.getDeadline());
vm.warp(5 days);
im.removeBeneficiary(alice); // does not reset deadline
assertEq(1 + 90 days, im.getDeadline());
vm.warp(10 days);
im.createEstateNFT("NFT", 5e6, address(usdc)); // does not reset deadline
assertEq(1 + 90 days, im.getDeadline());
vm.stopPrank();
}

Expected Result:

// forge test --mt test_deadlineReset -vvv
[⠆] Compiling...
No files changed, compilation skipped
Ran 1 test for test/ProofOfConcept.t.sol:InheritanceManagerTest
[PASS] test_deadlineReset() (gas: 218922)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 33.32ms (6.51ms CPU time)
Ran 1 test suite in 464.76ms (33.32ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

Recommendations:

Add _setDeadline() to the contract constructor and the other functions.

Updates

Lead Judging Commences

0xtimefliez Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

functions do not reset the deadline

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.