Closed PaulRBerg closed 5 years ago
This quite possibly could have been caused by the value of the 'data'
property of the raw tx.
The comparison ran into here is that of the base gas cost of the transactions with the gas limit set when creating the transaction (not the block gas limit). The "base gas cost" depends on the data included in the transaction, the standard gas fee, and possibly a fee associated with sending to the creation address.
The relevant code is:
/**
* The amount of gas paid for the data in this tx
* @return {BN}
*/
getDataFee () {
const data = this.raw[5]
const cost = new BN(0)
for (let i = 0; i < data.length; i++) {
data[i] === 0 ? cost.iaddn(fees.txDataZeroGas.v) : cost.iaddn(fees.txDataNonZeroGas.v)
}
return cost
}
/**
* the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
* @return {BN}
*/
getBaseFee () {
const fee = this.getDataFee().iaddn(fees.txGas.v)
if (this._homestead && this.toCreationAddress()) {
fee.iaddn(fees.txCreation.v)
}
return fee
}
I made a few attempts to recreate this but couldn't. Given that, how old this issue is, and given the probably explanation of the experienced error, I am going to close for now.
But if anyone experiences this again, please comment or open a new issue.
Expected
Token transaction should execute successfully.
Behaviour
The base fee exceeds the gas limit, when that's not the case. The gas limit I set is 0xEA60, which in decimal is 60,000, definitely lower than Ganache's block gas limit of 6,721,975.
Code
Tools
• ethereumjs-tx:
1.3.4
• web3:0.20.6
• ganache (UI):1.1.0
• node:9.3.0
• os:osx high sierra 10.13.3
Full log ouput here.