trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 676 forks source link

Ganache returns incorrect error when `out of gas` occurs #4183

Open jeffsmale90 opened 1 year ago

jeffsmale90 commented 1 year ago

As of ganache@7.7.0, when a transaction fails because it runs out of gas, the error returned is code size exceeds maximum.

https://github.com/ethereumjs/ethereumjs-monorepo/blob/c788bf7610ccf18eb908ba6aa7639334116782a4/packages/evm/src/evm.ts#L574

EthereumJS logs Not enough gas or code size not allowed (>= Homestead) but then returns code size to deposit exceeds maximum code size.

Can be reproduced with:

ganache -dD --chain.vmErrorsOnRPCResponse true &&
curl -s http://localhost:8545/ -X POST -H "Content-Type:application/json;" -d '{"id":1,"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"data":"0x6080604052600560008190555060858060196000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80633fa4f24514602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea26469706673582212200897f7766689bf7a145227297912838b19bcad29039258a293be78e3bf58e20264736f6c63430007040033","from":"0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"}]}' | jq .error.message

7.7.0:

"VM Exception while processing transaction: code size to deposit exceeds maximum code size"

7.6.0:

"VM Exception while processing transaction: out of gas"

This is covered in https://github.com/ethereumjs/ethereumjs-monorepo/issues/2466