Files
aitbc/contracts/test/fuzz/AIPowerRental.t.sol
oib f353e00172 chore(security): enhance environment configuration, CI workflows, and wallet daemon with security improvements
- Restructure .env.example with security-focused documentation, service-specific environment file references, and AWS Secrets Manager integration
- Update CLI tests workflow to single Python 3.13 version, add pytest-mock dependency, and consolidate test execution with coverage
- Add comprehensive security validation to package publishing workflow with manual approval gates, secret scanning, and release
2026-03-03 10:33:46 +01:00

41 lines
1.2 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "../../contracts/AIPowerRental.sol";
contract AIPowerRentalFuzzTest is Test {
AIPowerRental public rental;
address public owner;
address public provider;
address payable public renter;
function setUp() public {
owner = address(this);
provider = makeAddr("provider");
renter = payable(makeAddr("renter"));
rental = new AIPowerRental();
}
function invariant_balanceInvariant() public {
assertEq(address(rental).balance, 0, "Contract should hold no stray ETH");
}
function testFuzz_RentalFlow(uint256 duration, uint256 price) public {
vm.assume(duration > 0 && duration <= 365 days);
vm.assume(price >= 0.001 ether && price <= 10 ether);
uint256 rentAmount = price * duration / 1 days;
vm.deal(renter, rentAmount + 1 ether);
vm.prank(provider);
rental.createRental(price, duration);
uint256 rentalId = 0;
vm.prank(renter);
rental.startRental{value: rentAmount}(rentalId);
assertEq(rental.getRentalEnd(rentalId), block.timestamp + duration);
}
}