Skip to content

5.0 Architecture Thread - Fix Governance Interface Architecture #4383

Open
@RitzyDevBox

Description

@RitzyDevBox

Open Zeppelins Interface makes assumptions about its implentation.

abstract contract IGovernorTimelock is IGovernor {
    event ProposalQueued(uint256 proposalId, uint256 eta);

    function timelock() public view virtual returns (address);

    function proposalEta(uint256 proposalId) public view virtual returns (uint256);

    function queue(
        address[] memory targets,
        uint256[] memory values,
        bytes[] memory calldatas,
        bytes32 descriptionHash
    ) public virtual returns (uint256 proposalId);
}

`
Queue and Execute don't take the proposalId in as a parameter, In OZ Governor, thats fine because the members hash to the Proposal. However this means that anyone consuming the interface has to use the same proposal.

This is a huge limitation as in other architectures such as GovernorA GovernorB the Proposals are sequential so the interfaces are not compatible for inheritance

For Deeper clarification look at the Execute Method:

/**
 * @dev See {IGovernor-execute}.
 */
function execute(
    address[] memory targets,
    uint256[] memory values,
    bytes[] memory calldatas,
    bytes32 descriptionHash
) public payable virtual override returns (uint256) {
    uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);

    ProposalState status = state(proposalId);
    require(
        status == ProposalState.Succeeded || status == ProposalState.Queued,
        "Governor: proposal not successful"
    );
    _proposals[proposalId].executed = true;

    emit ProposalExecuted(proposalId);

    _beforeExecute(proposalId, targets, values, calldatas, descriptionHash);
    _execute(proposalId, targets, values, calldatas, descriptionHash);
    _afterExecute(proposalId, targets, values, calldatas, descriptionHash);

    return proposalId;
}

I would like to inherit from this method in my implemntation, However since my proposalId is not based on your implemtation my code will due to the following lines:

    uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions