Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

In Governance.sol due to incorrect check, voting and quorom can be reached at proposal.endTime

Summary

In the governance.sol, a user can vote at the proposal.endTime and also the quorom can be reached at this time and thus the proposal can be queued/rejected. Thus the last persons voting may not be counted.

Vulnerability Details

The state() function is reponsible for getting the state of the proposal, but at time = proposal.endTime, the proposal is not considered active by this function, and thus the proposal can be executed/rejected now.

function state(uint256 proposalId) public view override returns (ProposalState) {
ProposalCore storage proposal = _proposals[proposalId];
if (proposal.startTime == 0) revert ProposalDoesNotExist(proposalId);
if (proposal.canceled) return ProposalState.Canceled;
if (proposal.executed) return ProposalState.Executed;
if (block.timestamp < proposal.startTime) return ProposalState.Pending;
if (block.timestamp < proposal.endTime) return ProposalState.Active;

But in the castVote function the voting is allowed even at time = proposal.endTime, this could cause the vote casted at this time to be not taken into account.

function castVote(uint256 proposalId, bool support) external override returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
if (proposal.startTime == 0) revert ProposalDoesNotExist(proposalId);
if (block.timestamp < proposal.startTime) {
revert VotingNotStarted(proposalId, proposal.startTime, block.timestamp);
}
if (block.timestamp > proposal.endTime) {
revert VotingEnded(proposalId, proposal.endTime, block.timestamp);
}



Impact

voting at the proposal.endTime may be not taken into account.

Tools Used

manual review

Recommendations

change the equality symbol at one place to match the other.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Governance::state and Governance::castVote use inconsistent time boundary checks, allowing votes at exactly proposal.endTime when state shows inactive

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!