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:
55
contracts/test/fuzz/DAOGovernor.t.sol
Normal file
55
contracts/test/fuzz/DAOGovernor.t.sol
Normal file
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "../../contracts/DAOGovernor.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
contract DAOGovernorFuzzTest is Test {
|
||||
DAOGovernor public governor;
|
||||
ERC20 public govToken;
|
||||
address public owner;
|
||||
address public proposer;
|
||||
address public voter;
|
||||
|
||||
function setUp() public {
|
||||
owner = address(this);
|
||||
proposer = makeAddr("proposer");
|
||||
voter = makeAddr("voter");
|
||||
govToken = new ERC20("GovToken", "GOV");
|
||||
governor = new DAOGovernor(address(govToken));
|
||||
|
||||
// Mint tokens and delegate
|
||||
vm.prank(owner);
|
||||
govToken.mint(voter, 1000e18);
|
||||
vm.prank(voter);
|
||||
govToken.delegate(voter);
|
||||
}
|
||||
|
||||
function invariant_quorumInvariant() public {
|
||||
uint256 quorum = governor.quorum();
|
||||
uint256 totalSupply = govToken.totalSupply();
|
||||
assertLe(quorum, totalSupply, "Quorum cannot exceed total supply");
|
||||
}
|
||||
|
||||
function testFuzz_ProposalFlow(uint256 amount, uint256 votes) public {
|
||||
vm.assume(amount >= 1e18 && amount <= 1000e18);
|
||||
vm.assume(votes >= 1e18 && votes <= 1000e18);
|
||||
|
||||
vm.prank(owner);
|
||||
govToken.mint(proposer, amount);
|
||||
vm.prank(proposer);
|
||||
govToken.delegate(proposer);
|
||||
|
||||
// Create proposal
|
||||
address[] memory targets = new address[](1);
|
||||
targets[0] = address(governor);
|
||||
uint256[] memory values = new uint256[](1);
|
||||
values[0] = 0;
|
||||
bytes[] memory calldatas = new bytes[](1);
|
||||
calldatas[0] = abi.encodeWithSignature("setQuorum(uint256)", 1000);
|
||||
|
||||
vm.prank(proposer);
|
||||
governor.propose(targets, values, calldatas, "Test proposal");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user