Eth sent to Timelock will be locked in current implementation
See original GitHub issueIssue 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)
- Send eth to timelock contract
- 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(
[signers[3].address],
[ethers.utils.parseEther("0.1")],
[""],
[ethers.BigNumber.from(0)],
"Send funds to 3rd signer"
);
- Vote and have the proposal succeed.
- 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
- 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:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.One other possible solution is to disambiguate the values into something like valuesExecutor, valuesTimelock. Relevant functions