Summary
test_rescue_transfersNativeBnb sends BNB to makeAddr("recipient"), which is an EOA (no fallback). The test passes because payable(to).transfer(2300 gas) succeeds against an EOA.
Issue #117 documents that rescue() uses Solidity's transfer() which forwards only 2300 gas. If the owner's cold wallet is a Safe multisig or any contract with a fallback that requires more than 2300 gas (e.g., Safe's fallback manager), the call will revert, permanently trapping native BNB in the contract.
The current test implicitly validates the happy path while actively masking the failure path. A test reviewer seeing green on test_rescue_transfersNativeBnb would not be alerted to the multisig revert risk.
Location
contracts/test/CharonLiquidator.t.sol — test_rescue_transfersNativeBnb
Fix
Add a test using a stub contract that consumes more than 2300 gas in its receive function:
contract GasHungryReceiver {
uint256 public counter;
receive() external payable {
for (uint256 i; i < 100; ++i) { counter++; } // >2300 gas
}
}
function test_rescue_transferNativeBnb_revertsOnContractRecipient() public {
GasHungryReceiver receiver = new GasHungryReceiver();
vm.deal(address(liquidator), 1 ether);
vm.expectRevert();
liquidator.rescue(address(0), address(receiver), 1 ether);
}
This test should be marked as documenting a known limitation (not blocking) while #117 is open, but it must exist to prevent regressions.
Refs #38, Refs #117
Summary
test_rescue_transfersNativeBnbsends BNB tomakeAddr("recipient"), which is an EOA (no fallback). The test passes becausepayable(to).transfer(2300 gas)succeeds against an EOA.Issue #117 documents that
rescue()uses Solidity'stransfer()which forwards only 2300 gas. If the owner's cold wallet is a Safe multisig or any contract with a fallback that requires more than 2300 gas (e.g., Safe's fallback manager), the call will revert, permanently trapping native BNB in the contract.The current test implicitly validates the happy path while actively masking the failure path. A test reviewer seeing green on
test_rescue_transfersNativeBnbwould not be alerted to the multisig revert risk.Location
contracts/test/CharonLiquidator.t.sol—test_rescue_transfersNativeBnbFix
Add a test using a stub contract that consumes more than 2300 gas in its receive function:
This test should be marked as documenting a known limitation (not blocking) while #117 is open, but it must exist to prevent regressions.
Refs #38, Refs #117