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

Gas multiplier is never applied in truffle-contract #2539

Closed
cgewecke opened this issue Nov 3, 2019 · 2 comments
Closed

Gas multiplier is never applied in truffle-contract #2539

cgewecke opened this issue Nov 3, 2019 · 2 comments

Comments

@cgewecke
Copy link
Contributor

cgewecke commented Nov 3, 2019

Issue

By default, contracts using autoGas should multiply the gas estimate by 1.25. At the moment, the multiplying logic seems like it just returns the original estimate value.

Web3 1.2.2 fixes long-broken logic that registers a transaction as failed when the gas consumed equals the gas sent. In older versions of the eth chain and some contemporary forks ( ETC? maybe Quorum?) failing txs consume all gas and the gas comparison is a reliable indicator that something has gone wrong.

This is relevant for #2488 because truffle-contract's tests are fueling the tx's with perfect estimates and triggering a false error.

The question of what behavior is correct is a little complicated and will need further discussion at Web3, but Truffle could side-step this by fixing the multiplier.

Possible that #2512 is related...

cf: web3 3175

Steps to Reproduce

utils.multiplyBigNumberByDecimal(
  utils.bigNumberify(500),
  1.25
);
> 500

Environment

  • Operating System:
  • Ethereum client:
  • Truffle version (truffle version): 5.0.41
  • node version (node --version):
  • npm version (npm --version):
@eggplantzzz
Copy link
Contributor

Ahh yes I see what you mean. It looks like the logic in that method isn't sound. Thanks for pointing this out!

@eggplantzzz
Copy link
Contributor

A fix for this is now out in the wild with v5.0.44.

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

No branches or pull requests

2 participants