Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Eth sent to Timelock will be locked in current implementation

See original GitHub issue

Issue Description

I came across this problem while playing around with the new governance contracts.

Here’s what I did Setup the governance contracts (Comp, GovernorBravoDelegate, GovernorBravoDelegator, Timelock)

  1. Send eth to timelock contract
  2. Setup a proposal to send 0.1 eth out. Code snippet in ether.js below. proxy refers to GovernorBravoDelegator instance using GovernorBravoDelegate’s abi.
    await proxy.propose(
      "Send funds to 3rd signer"
  1. Vote and have the proposal succeed.
  2. Execute the proposal, the proposal number here is arbitrary.
await proxy.execute(2);  // this fails
await proxy.execute(2, {value: ethers.utils.parseEther("0.1")})  // this would work
  1. 0.1 eth will be sent out, but it is sent from the msg.sender not from the timelock contract

Changing this line on GovernorBravoDelegate will address the issue and allow for eth in the Timelock contract to be sent out.

// Before
timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);

// After, don't duplicate the proposal.values[i]
timelock.executeTransaction.value(0)(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);

The solution I found above is definitely not ideal, any other ideas appreciated.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

arr00commented, Nov 18, 2021

I think the approach we will go with is PR #174. We don’t foresee a situation where the executor will actually be sending ETH in the future, so we will make execute a non-payable function and have all ETH value come from the timelock.

JSeam2commented, Aug 24, 2021

One other possible solution is to disambiguate the values into something like valuesExecutor, valuesTimelock. Relevant functions

// GovernorBravoDelegate
// SPDX-License-Identifier: BSD-3

      * @notice Function used to propose a new proposal. Sender must have delegates above the proposal threshold
      * @param targets Target addresses for proposal calls
      * @param valuesExecutor Eth values for proposal calls to be paid by executor, 
      * if non-zero, it will override valuesTimelock for the particular index
      * @param valuesTimelock Eth values for proposal calls to be paid by timelock
      * @param signatures Function signatures for proposal calls
      * @param calldatas Calldatas for proposal calls
      * @param description String description of the proposal
      * @return Proposal id of new proposal
    function propose(address[] memory targets, uint[] memory valuesExecutor, uint[] memory valuesTimelock, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
        // Reject proposals before initiating as Governor
        require(initialProposalId != 0, "GovernorBravo::propose: Governor Bravo not active");
        require(comp.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold");
        require(targets.length == valuesExecutor.length && targets.length == valuesTimelock.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorBravo::propose: proposal function information arity mismatch");
        require(targets.length != 0, "GovernorBravo::propose: must provide actions");
        require(targets.length <= proposalMaxOperations, "GovernorBravo::propose: too many actions");
        uint latestProposalId = latestProposalIds[msg.sender];
        if (latestProposalId != 0) {
          ProposalState proposersLatestProposalState = state(latestProposalId);
          require(proposersLatestProposalState != ProposalState.Active, "GovernorBravo::propose: one live proposal per proposer, found an already active proposal");
          require(proposersLatestProposalState != ProposalState.Pending, "GovernorBravo::propose: one live proposal per proposer, found an already pending proposal");

        uint startBlock = add256(block.number, votingDelay);
        uint endBlock = add256(startBlock, votingPeriod);

        Proposal memory newProposal = Proposal({
            id: proposalCount,
            proposer: msg.sender,
            eta: 0,
            targets: targets,
            valuesExecutor: valuesExecutor,
            valuesTimelock: valuesTimelock,
            signatures: signatures,
            calldatas: calldatas,
            startBlock: startBlock,
            endBlock: endBlock,
            forVotes: 0,
            againstVotes: 0,
            abstainVotes: 0,
            canceled: false,
            executed: false

        proposals[] = newProposal;
        latestProposalIds[newProposal.proposer] =;

        emit ProposalCreated(, msg.sender, targets, valuesExecutor, valuesTimelock, signatures, calldatas, startBlock, endBlock, description);

      * @notice Queues a proposal of state succeeded
      * @param proposalId The id of the proposal to queue
    function queue(uint proposalId) external {
        require(state(proposalId) == ProposalState.Succeeded, "GovernorBravo::queue: proposal can only be queued if it is succeeded");
        Proposal storage proposal = proposals[proposalId];
        uint eta = add256(block.timestamp, timelock.delay());
        for (uint i = 0; i < proposal.targets.length; i++) {
            queueOrRevertInternal(proposal.targets[i], proposal.valuesTimelock[i], proposal.signatures[i], proposal.calldatas[i], eta);
        proposal.eta = eta;
        emit ProposalQueued(proposalId, eta);

    function queueOrRevertInternal(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
        require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorBravo::queueOrRevertInternal: identical proposal action already queued at eta");
        timelock.queueTransaction(target, value, signature, data, eta);

      * @notice Executes a queued proposal if eta has passed
      * @param proposalId The id of the proposal to execute
    function execute(uint proposalId) external payable {
        require(state(proposalId) == ProposalState.Queued, "GovernorBravo::execute: proposal can only be executed if it is queued");
        Proposal storage proposal = proposals[proposalId];
        proposal.executed = true;
        for (uint i = 0; i < proposal.targets.length; i++) {
            // timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
            timelock.executeTransaction.value(proposal.valuesExecutor[i])(proposal.targets[i], proposal.valuesTimelock[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
        emit ProposalExecuted(proposalId);

      * @notice Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold
      * @param proposalId The id of the proposal to cancel
    function cancel(uint proposalId) external {
        require(state(proposalId) != ProposalState.Executed, "GovernorBravo::cancel: cannot cancel executed proposal");

        Proposal storage proposal = proposals[proposalId];
        require(msg.sender == proposal.proposer || comp.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold, "GovernorBravo::cancel: proposer above threshold");

        proposal.canceled = true;
        for (uint i = 0; i < proposal.targets.length; i++) {
            timelock.cancelTransaction(proposal.targets[i], proposal.valuesTimelock[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);

        emit ProposalCanceled(proposalId);
// In GovernorBravoInterfaces
// SPDX-License-Identifier: BSD-3

pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;

contract GovernorBravoEvents {
    /// @notice An event emitted when a new proposal is created
    event ProposalCreated(uint id, address proposer, address[] targets, uint[] valuesExecutor, uint[] valuesTimelock, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);

 * @title Storage for Governor Bravo Delegate
 * @notice For future upgrades, do not change GovernorBravoDelegateStorageV1. Create a new
 * contract which implements GovernorBravoDelegateStorageV1 and following the naming convention
 * GovernorBravoDelegateStorageVX.
contract GovernorBravoDelegateStorageV1 is GovernorBravoDelegatorStorage {

    struct Proposal {
        /// @notice Unique id for looking up a proposal
        uint id;

        /// @notice Creator of the proposal
        address proposer;

        /// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
        uint eta;

        /// @notice the ordered list of target addresses for calls to be made
        address[] targets;

        /// @notice The ordered list of values (i.e. msg.value) to be made by the executor
        uint[] valuesExecutor;

        /// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made
        uint[] valuesTimelock;

        /// @notice The ordered list of function signatures to be called
        string[] signatures;

        /// @notice The ordered list of calldata to be passed to each call
        bytes[] calldatas;

        /// @notice The block at which voting begins: holders must delegate their votes prior to this block
        uint startBlock;

        /// @notice The block at which voting ends: votes must be cast prior to this block
        uint endBlock;

        /// @notice Current number of votes in favor of this proposal
        uint forVotes;

        /// @notice Current number of votes in opposition to this proposal
        uint againstVotes;

        /// @notice Current number of votes for abstaining for this proposal
        uint abstainVotes;

        /// @notice Flag marking whether the proposal has been canceled
        bool canceled;

        /// @notice Flag marking whether the proposal has been executed
        bool executed;

        /// @notice Receipts of ballots for the entire set of voters
        mapping (address => Receipt) receipts;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Time-locked Wallets: A Truffle Framework Tutorial | Toptal
Dive into Ethereum smart contract development with this tutorial. Learn how to create a practical ĐApp, complete with its own ERC20 token, using...
Read more >
Bypassing Smart Contract Timelocks - OpenZeppelin blog
The attack does not require that the locked ETH or ERC20 tokens can somehow be moved before the timelock expires. Indeed, that is...
Read more >
Timelock Smart Contract » Tutorial - Chainlink Blog
This technical tutorial will teach you what timelock smart contracts are and how to build them. You will make a smart contract that...
Read more >
TimeLocking Tokens - Become Ethereum Blockchain Developer
A hook into the transfer function to only allow token transfer of tokens which are not yet locked or which have been successfully...
Read more >
Time Lock | Solidity 0.8 - YouTube
Code time lock contract in Solidity1:31 - queue9:37 - execute17:53 - cancel19:19 - demo#Solidity #SmartContract # Ethereum #スマート ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found