Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly calculate totalgas for large return values #275

Merged
merged 1 commit into from
Feb 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/runCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,9 @@ module.exports = function (opts, cb) {
// fee for size of the return value
var totalGas = results.gasUsed
if (!results.runState.vmError) {
var returnFee = results.return.length * fees.createDataGas.v
var returnFee = new BN(results.return.length * fees.createDataGas.v)

// avoid BN assertion failure when returnFee is greater than 0x4000000
if (returnFee > gasLimit.toNumber()) {
returnFee = gasLimit.toNumber() + 1
}

totalGas = totalGas.addn(returnFee)
totalGas = totalGas.add(returnFee)
}
// if not enough gas
if (totalGas.lte(gasLimit) && results.return.length <= 24576) {
Expand Down