skalenetwork / skaled

Running more than 20 production blockchains, SKALED is Ethereum-compatible, high performance C++ Proof-of-Stake client, tools and libraries. Uses SKALE consensus as a blockchain consensus core. Includes dynamic Oracle. Implements file storage and retrieval as an EVM extension.
https://skale.network
GNU General Public License v3.0
84 stars 40 forks source link

Update error handling for eth_call and eth_estimateGas #1166

Open DmytroNazarenko opened 2 years ago

DmytroNazarenko commented 2 years ago

Skaled return less information about TransactionException than geth for eth_call and eth_estimateGas. When transaction failure was not due revert instruction skaled returns only message EVM revert instruction without description message, while geth returns message execution reverted and data field, that contains error details (invalid instruction etc):

{ "originalError": { "code": 3, "data": "0x4e487b710000000000000000000000000000000000000000000000000000000000000032", "message": "execution reverted" } }

To test send eth_estimateGas or eth_call of badFunction(20, 10) or badFunction(0, 0) in contract :

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

/** 
 * @title Ballot
 * @dev Implements voting process along with vote delegation
 */
contract Ballot {

    uint256[10] answer;

    function badFunction(uint256 b, uint256 index) public {
        uint256 a = 5 / b;
        answer[index] = a;
    }
}
DmytroNazarenko commented 7 months ago

Moved to 2.5 as part of #1833