From cf99ff22e5f23fff60593d39133eb725bf35bb2f Mon Sep 17 00:00:00 2001 From: gallo Date: Thu, 17 Oct 2024 12:10:25 +0200 Subject: [PATCH] chore: comment on FLs --- test/VotingPower.t.sol | 12 ++++++++++++ test/recon/properties/GovernanceProperties.sol | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/test/VotingPower.t.sol b/test/VotingPower.t.sol index af04e0ec..4364866e 100644 --- a/test/VotingPower.t.sol +++ b/test/VotingPower.t.sol @@ -183,6 +183,18 @@ contract VotingPowerTest is Test { assertEq(avgTs_reset_2, avgTs2_diff, "Same as diff means it does reset"); } + + // Check if Flashloan can be used to cause issues? + // A flashloan would cause issues in the measure in which it breaks any specific property + // Or expectation + + // Remove votes + // Removing votes would force you to exclusively remove + // You can always remove at any time afacit + // Removing just updates that + the weights + // The weights are the avg time * the number + + function _getAverageTS(address initiative) internal returns (uint256) { ( , diff --git a/test/recon/properties/GovernanceProperties.sol b/test/recon/properties/GovernanceProperties.sol index ba9147c3..cf19afc7 100644 --- a/test/recon/properties/GovernanceProperties.sol +++ b/test/recon/properties/GovernanceProperties.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.0; import {BeforeAfter} from "../BeforeAfter.sol"; import {Governance} from "src/Governance.sol"; import {IGovernance} from "src/interfaces/IGovernance.sol"; +import {MockStakingV1} from "test/mocks/MockStakingV1.sol"; abstract contract GovernanceProperties is BeforeAfter { @@ -45,6 +46,21 @@ abstract contract GovernanceProperties is BeforeAfter { } } + + function property_stake_and_votes_cannot_be_abused() public { + // User stakes + // User allocated + + // allocated is always <= stakes + for(uint256 i; i < users.length; i++) { + // Only sum up user votes + uint256 stake = MockStakingV1(stakingV1).stakes(users[i]); + (uint88 user_allocatedLQTY, ) = governance.userStates(users[i]); + lte(user_allocatedLQTY, stake, "User can never allocated more than stake"); + } + + } + // View vs non view must have same results function property_viewTotalVotesAndStateEquivalency() public { for(uint8 i; i < deployedInitiatives.length; i++) {