in the contract, when a proposal is successful, someone can call the _execute function with parameters to execute the proposal. So how does the contract ensure that the execution parameters are the same as those for the proposal?

Thank you

1 Answer 1


The _execute function you linked is not the actual execute function you would call. This is the main execute function: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/6aac66d065dc39795fbad1f680f80e3a3d70f2d1/contracts/governance/Governor.sol#L320

And if you take a look at it, you would see the proposalId is a data retrieved by hashing execute parameters (targets, values, calldatas, descriptionHash). And proposalId is used for retrieving the status of a proposal in the same function. If you send a different parameter other then the proposed one, the hashing would return a wrong proposalId and you would get "Governor: proposal not successful" which comes from the require statement from the execute function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.