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
85 stars 40 forks source link

Gas Estimation Issue for GnosisSafe Calls on SKALE Network #1958

Closed mshakeg closed 1 month ago

mshakeg commented 2 months ago

Description

When attempting to estimate gas for GnosisSafe calls on the SKALE Network, specifically for the simulateAndRevert function, the node does not return the expected revert bytes containing gas usage information. This behavior differs from other EVM-compatible networks, such as Ethereum mainnet, where the revert bytes are correctly returned and can be decoded to extract the gas used.

Steps to Reproduce

  1. Prepare an eth_call request to a GnosisSafe contract's simulateAndRevert function on the SKALE Network.
  2. Execute the request using the SKALE Network RPC endpoint.
  3. Observe the response, which should contain revert bytes with gas usage information.

Expected Behavior

The eth_call should return revert bytes that can be decoded to extract the gas used, similar to the behavior observed on Ethereum mainnet.

Actual Behavior

The SKALE node returns an EVM revert instruction without a description message or revert bytes containing gas usage information.

Example

SKALE Network Request

curl https://mainnet.skalenodes.com/v1/elated-tan-skat \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_call","params":[{"to":"0xED0A10A7db58d9dB23DDfB7EEbFE1Fe863ef67aA","data":"0xb4faba09000000000000000000000000242cd12579467983dc521d8ac46eb13936ab65de000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e41c5fb2110000000000000000000000000ed9ce8bec5b782c99bda03b242442b862e6cbc10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f9c95d4600000000000000000000000000000000000000000000000000000000000002940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "latest"],"id":1,"jsonrpc":"2.0"}'

SKALE Network Response

{
  "error": {
    "code": -32000,
    "message": "EVM revert instruction without description message"
  },
  "id": 1
}

Ethereum Mainnet Request (for comparison)

curl https://eth.llamarpc.com \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_call","params":[{"to":"0xfF7B5E167c9877f2b9f65D19d9c8c9aa651Fe19F","data":"0xb4faba09000000000000000000000000727a77a074d1e6c4530e814f89e618a3298fc044000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e41c5fb211000000000000000000000000d22d97bb77e6bdf8d3f81ca8ffe58f58b75052820000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f9c95d4600000000000000000000000000000000000000000000000000000000000002940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "latest"],"id":1,"jsonrpc":"2.0"}'

Ethereum Mainnet Response (for comparison)

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 3,
    "data": "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000002e91000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
    "message": "execution reverted"
  }
}

Additional Context

Impact

This issue prevents accurate gas estimation for GnosisSafe transactions on the SKALE Network, which can lead to transaction failures or inefficient gas usage. It also creates inconsistencies for applications that rely on this gas estimation method when integrating with multiple EVM-compatible networks.

Possible Solution

Investigate the implementation of the eth_call method on the SKALE Network, particularly for cases involving REVERT opcodes. Ensure that the node correctly captures and returns the revert data, including gas usage information, in a manner consistent with other EVM-compatible networks.

Environment

Additional Notes

This behavior was compared against Ethereum mainnet, where the same type of call correctly returns the revert bytes containing gas usage information. Addressing this issue will improve compatibility and consistency for applications using GnosisSafe on the SKALE Network.

TheGreatAxios commented 1 month ago

close as duplicate of https://github.com/skalenetwork/skaled/issues/1931