Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a customizable _execute function in TimelockController #3317

Merged
merged 9 commits into from Apr 8, 2022

Conversation

Joeysantoro
Copy link
Contributor

@Joeysantoro Joeysantoro commented Apr 4, 2022

Fixes #N/A

Set the _call method of the TimelockController to internal virtual so it can be overridden.

For context, I am looking to write a TimelockController which exclusively executes through a Gnosis Safe as a module https://github.com/gnosis/safe-contracts/blob/main/contracts/base/ModuleManager.sol#L61-L73

So the "call" would get overridden to:

    function _call(
        bytes32 id,
        uint256 index,
        address target,
        uint256 value,
        bytes calldata data
    ) internal override {
        safe.executeTransactionFromModule(target, value, data, Operation.CALL);

        emit CallExecuted(id, index, target, value, data);

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

@Amxx
Copy link
Collaborator

Amxx commented Apr 4, 2022

Hello @Joeysantoro

Overriding the _execute function is possible in the governor, so your change would not only make sense, but improve consistency.

The way you propose we change it is safe in your case, but I'm worried some override might forget the event. I'm going to refactor this PR a bit.

@Amxx
Copy link
Collaborator

Amxx commented Apr 4, 2022

If these changes follow your idea, I think we can go ahead and add a changelog before we can merge

frangio
frangio previously approved these changes Apr 4, 2022
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me.

The tests are failing but I'm not sure why. @Amxx Can you check?

@Joeysantoro
Copy link
Contributor Author

This makes sense to me.

The tests are failing but I'm not sure why. @Amxx Can you check?

Tests are failing because Addresses.verifyCallResult will bubble up errors by default which is a different behavior to always returning the TimelockController error.

Changing it back to require(success, "TimelockController: underlying transaction reverted"); would fix this but the newer implementation is slightly better so maybe its best to just fix the test

@Amxx
Copy link
Collaborator

Amxx commented Apr 5, 2022

I already fixed part of the tests. I'll have a second pass

@Joeysantoro
Copy link
Contributor Author

Joeysantoro commented Apr 8, 2022

I edited this to use the old require logic instead so tests won't be broken. @frangio assuming the tests pass I think this can merge?

The Addresses.verifyCallResult could be fixed in another PR

@Joeysantoro Joeysantoro requested a review from frangio April 8, 2022 18:31
frangio
frangio previously approved these changes Apr 8, 2022
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree to merge.

@frangio frangio changed the title Update TimelockController.sol Use a customizable _execute function in TimelockController Apr 8, 2022
@frangio frangio merged commit bc810db into OpenZeppelin:master Apr 8, 2022
@must479

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants