diff --git a/src/utils/ActiveProposalsLimiter.sol b/src/utils/ActiveProposalsLimiter.sol index 32981f84..2a80a3de 100644 --- a/src/utils/ActiveProposalsLimiter.sol +++ b/src/utils/ActiveProposalsLimiter.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.18; /// @title Active Proposals Limiter Proposal Validation Module /// @notice This module can be used to limit the number of active proposals per author. abstract contract ActiveProposalsLimiter { + /// @dev Active proposal data stored for each author in a space. struct PackedData { uint32 activeProposals; uint32 lastUpdate; @@ -13,7 +14,7 @@ abstract contract ActiveProposalsLimiter { /// @notice Thrown when the maximum number of active proposals per user is set to 0. error MaxActiveProposalsCannotBeZero(); - /// @dev Mapping that stores a data struct for each space. + /// @dev Mapping that stores a data struct for each author in a space. mapping(address space => mapping(address author => PackedData)) private usersPackedData; /// @dev Validates an author by checking if they have reached the maximum number of active proposals at the current timestamp. @@ -21,7 +22,7 @@ abstract contract ActiveProposalsLimiter { if (maxActiveProposals == 0) revert MaxActiveProposalsCannotBeZero(); // The space calls the proposal validation strategy, therefore msg.sender corresponds to the space address. - PackedData storage packedData = usersPackedData[msg.sender][author]; + PackedData memory packedData = usersPackedData[msg.sender][author]; if (packedData.lastUpdate == 0) { // First time the user proposes, activeProposals is 1 no matter what. @@ -36,8 +37,8 @@ abstract contract ActiveProposalsLimiter { // Cooldown has not passed, user has not reached maximum active proposals: increase counter. packedData.activeProposals += 1; } - packedData.lastUpdate = uint32(block.timestamp); + usersPackedData[msg.sender][author] = packedData; return true; } }