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
This commit is contained in:
38
contracts/test/fuzz/DynamicPricing.t.sol
Normal file
38
contracts/test/fuzz/DynamicPricing.t.sol
Normal file
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "../../contracts/DynamicPricing.sol";
|
||||
|
||||
contract DynamicPricingFuzzTest is Test {
|
||||
DynamicPricing public pricing;
|
||||
address public owner;
|
||||
address public provider;
|
||||
|
||||
function setUp() public {
|
||||
owner = address(this);
|
||||
provider = makeAddr("provider");
|
||||
pricing = new DynamicPricing();
|
||||
vm.prank(owner);
|
||||
pricing.addProvider(provider);
|
||||
}
|
||||
|
||||
function invariant_noNegativePrice() public {
|
||||
uint256 price = pricing.getCurrentPrice(provider);
|
||||
assertGe(price, 0, "Price should never be negative");
|
||||
}
|
||||
|
||||
function testFuzz_PriceAdjustment(uint256 basePrice, uint256 utilization) public {
|
||||
vm.assume(basePrice >= 0.001 ether && basePrice <= 10 ether);
|
||||
vm.assume(utilization >= 0 && utilization <= 10000); // basis points
|
||||
|
||||
vm.prank(provider);
|
||||
pricing.setBasePrice(basePrice);
|
||||
|
||||
vm.prank(owner);
|
||||
pricing.updateUtilization(provider, utilization);
|
||||
|
||||
uint256 price = pricing.getCurrentPrice(provider);
|
||||
assertGe(price, 0, "Adjusted price must be non-negative");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user