I deployed a contract of a multisig wallet to ropsten and try to test its abilities: https://ropsten.etherscan.io/address/0x8bf20c41ee6a9fd84e81d6f6df872d9628cd08b2
Things that worked fine:
- Withdraw ETH
- Sending transaction to other contract (transfer erc20 tokens)
Things that didn't worked as expected:
- add owner
- replace owner
- basically every wallet change transaction failed
Why and how it failed?
Example transaction: https://ropsten.etherscan.io/tx/0xf4074abba33252d79dcdd234071dff25c7eba205ddb777076e623d6d108b7392
First I use the wallet submitTransaction
function and submitted a transaction to the same wallet contract with data that call the internal transaction change, addOwner
.
Then I used another owner key to confirm it.
When the transaction got the required confirmations the contract called the method executeTransaction
which execute this call:
txn.destination.call.value(txn.value)(txn.data)
In this example
txn.data
is 0x7065cb480000000000000000000000009ac4f6e64d56043991f486e375994f67ecbfdde0
calling addOwner("0x9ac4f6e64d56043991f486e375994f67ecbfdde0")
txn.value
is 0
As you can see, the internal transaction is failing due to out of gas
.
Did a little research and found out that after the call
function, the contract "saves" some gas for after the internal transaction invoke, and the internal transaction invoked with only 700 gas that consumed immediately by the CALL
opcode.
https://ropsten.etherscan.io/vmtrace?txhash=0xf4074abba33252d79dcdd234071dff25c7eba205ddb777076e623d6d108b7392 line 728:
Funny thing is, that at the end of the external transaction, the execution left with 27511 gas.
Some other wired stuff:
- If I give the transaction a lot of gas (x10) it works fine.
- If I use different contract to interact with (for example
erc20.transfer
) it works fine. - If I use the
executeTransaction
by itself (after the transaction is confirmed), it works fine.
So, What is going on? Why the gas estimation not working?
PS I tried it both with MEW and web3 js code for gas estimation.