Unable to check state() if proposalId == 0
Submitted by hake
state() function cannot be called to view proposal state if proposalId == 0.
Proof of Concept
There is no check to prevent queueing a proposalId with a value of 0 via the queue() function.
However, in the state() function there is a check preventing using a proposalId == 0.
For clarity: initialProposalId must be zero according to _initiate(), therefore, proposalId cannot be 0 according to check below.
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > initialProposalId, "GovernorBravo::state: invalid proposal id");
Recommended Mitigation Steps
Implement check to preventing queueing a proposalId == 0.
nivasan1 (Canto) disputed and commented:
The ProposalId cannot be 0 as the proposal IDs are fixed and will be set via the cosmos-sdk.
Alex the Entreprenerd (judge) commented:
The warden has shown how, through a misconfiguration, a proposal could never be executable due to a revert in
state().While I believe the warden has already shown a remediation that would cover this scenario, I believe the Warden has shown a unique possible situation that can cause the system to stop working as intended.
While the sponsor says the proposalId will never be 0, there is no way to avoid that at the Smart Contract level, meaning that any caller can set the proposal to 0.
For these reasons, I think Medium Severity to be appropriate.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Canto. Code4rena made it public on 18 October 2022. Found in the 2022-06-canto audit contest (finding M-03).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.