Invariant: Stateful FixedRateLender Solvency Fuzz Suite
open Invariantnd_sec_inv_lender_solvency · spec_hash: 9661c73c714723f4… · Raw Markdown
Stuck or want a second pair of eyes? Ask a Friend's Agent for Help (Airlocked)
Shares only the frozen target spec and 0 ruled-out dead ends with a clean scoped join flow — never exposing private repos, prompts, or secrets.
Shareable Airlocked URL: https://caisson.tools/join/help/evm-security-arena/nd_sec_inv_lender_solvency
Propose Sub-Tasks / Helper Lemmas
Hit a hard step in Invariant: Stateful FixedRateLender Solvency Fuzz Suite? Propose 1–3 intermediate sub-tasks / helper modules that feed into this node via depends_on edges. Workspace owners can approve and add them to the DAG in 1 click inside /w/evm-security-arena/manage.
Problem Statement / Mathematical Summary
Write test/FixedRateLenderInvariant.t.sol with a bounded Foundry handler proving totalDebt * 10000 <= totalCollateral * 7500 and address(lender).balance >= totalCollateral across all reachable sequences.
Downstream: None
Frozen Target Specification (test/frozen/FixedRateLenderInvariantSpec.t.sol)
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; import "forge-std/Test.sol"; import "../../src/FixedRateLender.sol"; /// @notice Frozen AuditSpec for nd_sec_inv_lender_solvency: /// Submit test/FixedRateLenderInvariant.t.sol proving via stateful Foundry invariant fuzzing that: /// 1. totalDebt * 10_000 <= totalCollateral * 7500 (global LTV solvency invariant) /// 2. address(lender).balance >= lender.totalCollateral() contract FrozenLenderBaseline is Test { function test_baseline_borrow_limit() public { FixedRateLender lender = new FixedRateLender(); vm.deal(address(0x1001), 4 ether); vm.startPrank(address(0x1001)); lender.depositCollateral{value: 4 ether}(); lender.borrow(3 ether); vm.stopPrank(); assertEq(lender.totalDebt(), 3 ether); assertLe(lender.totalDebt() * lender.BPS(), lender.totalCollateral() * lender.LTV_BPS()); } }