Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
hooked-wallet - default gasLimit is 1.5*estimateGas
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Mar 12, 2016
1 parent abe4546 commit 3c02501
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion subproviders/hooked-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ HookedWalletSubprovider.prototype.fillInTxExtras = function(txParams, cb){
if (result.nonce)
res.nonce = result.nonce.result
if (result.gas)
res.gas = result.gas.result
// add some extra gas, just in case
// see https://github.com/MetaMask/metamask-plugin/issues/60
res.gas = Math.ceil(1.5 * parseInt(result.gas.result, 16))

cb(null, extend(res, txParams))
})
Expand Down

6 comments on commit 3c02501

@axic
Copy link
Contributor

@axic axic commented on 3c02501 Mar 14, 2016

Choose a reason for hiding this comment

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

Can't this be solved in a better way? I define fixed gas limits via fixtures and I would like those to be taken seriously.

@danfinlay
Copy link
Contributor

@danfinlay danfinlay commented on 3c02501 Mar 14, 2016 via email

Choose a reason for hiding this comment

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

@kumavis
Copy link
Member Author

Choose a reason for hiding this comment

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

I define fixed gas limits via fixtures and I would like those to be taken

@axic what do you mean by fixtures? also - this is the fallback limit, if you specify a limit it will override this.

@axic
Copy link
Contributor

@axic axic commented on 3c02501 Mar 14, 2016

Choose a reason for hiding this comment

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

I define a method for eth_estimateGas using the FixtureSubprovider. That is called by hooked wallet as during web3 contract execution there is no easy way to define gas limits.

@kumavis
Copy link
Member Author

Choose a reason for hiding this comment

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

@axic so yeah this is a temporary fix to a real bug that was blocking the tutorial for the ethereum hackathon dan is participating in. i didnt have time to explore --- MetaMask/metamask-extension#60

id much rather have a real fix.

@kumavis
Copy link
Member Author

Choose a reason for hiding this comment

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

in summary - on the testrpc, estimateGas and actually processing the tx had different gas requirements, and so the estimateGas resulted in OOG

Please sign in to comment.