14

I have tested a contract having a fallback function which updated a state variable (cost 5000 gas). I sent an amount of Ether to this contract with 100000 gas limit. The transaction is valid. As explained in solidity considerations, it should be fail because gas stipend is 2300. Can someone help me explain?

  • 1
    I misunderstood explanation in document. If send ETH from an external account to a contract, gas is computed based on how many gases the fallback function return. On the other hand, sending ETH from a contract to another contract will be limited in gas stipend. – Luan Do The Jan 10 '17 at 10:38
15

I was confused by this questions and self answer, so I will try to clarify.

The OP sent 1,000,000 gas to a smart contract from an external account. He/she incorrectly read the Solidity documentation to say that there was a 'stipend' of only 2300 gas on such a transaction, but that was mistaken.

The 'stipend' applies to internal sends from one smart contract to another. Because send has no way to specify the gas amount, (whereas call does), Solidity imposes a maximum amount of gas (i.e. 2300).

Because the OP's transaction was not an internal contract-to-contract send the 2300 stipend did not apply and the transaction went through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.