Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas estimation using intentional reverts with binary data don't work in Nethermind #225

Closed
habdelra opened this issue Mar 31, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@habdelra
Copy link

Describe the bug
When using a nethermind RPC node, which is one of the supported RPC nodes for Gnosis chain, the gas estimation in Safe.estimate_tx_gas_with_safe that uses intentional reverts with binary data results that include the estimated gas fails. Nethermind returns these reverts in a slightly different format than OpenEthereum.

Specifically this is one such example on Gnosis chain:

request POST 
{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [
        {
            "value": "0x0",
            "from": "0x030e4688f6C8eCf7872a366540D34260623EB578",
            "gasPrice": "0x0",
            "to": "0x030e4688f6C8eCf7872a366540D34260623EB578",
            "data": "0xc4ca3a9c000000000000000000000000e097ec255ea9fe4e199e920e105b0f61d6e09c340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044cd4517eb00000000000000000000000026f2319fbb44772e0ed58fb7c99cf8da59e2b5be00000000000000000000000000000000000000000000000006e8f3c41ff9210000000000000000000000000000000000000000000000000000000000"
        }, "latest"
    ],
    "id": 1
}

Nethermind response is:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32015,
    "message": "VM execution error.",
    "data": "Reverted 0x0000000000000000000000000000000000000000000000000000000000010419"
  },
  "id": 1
}

Open Ethereum response is:

{
    "jsonrpc": "2.0",
    "result": null,
    "error": {
        "code": -32015,
        "message": "VM execution error.",
        "data": "Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000010419"
    },
    "id": 1
}

To Reproduce
Set the relay server to a Nethermind RPC URL in Gnosis chain, configured to use a gas token of 0x26F2319Fbb44772e0ED58fB7c99cf8da59e2b5BE (this is DAI.CPXD)
using the API tool perform a
POST /v2/safes/{address}/transactions/estimate
where the body is:

{
  "safe": "0x030e4688f6C8eCf7872a366540D34260623EB578",
  "to": "0xE097ec255eA9fE4e199E920E105b0f61d6e09C34",
  "value": 0,
  "data": "0xcd4517eb00000000000000000000000026f2319fbb44772e0ed58fb7c99cf8da59e2b5be00000000000000000000000000000000000000000000000006e8f3c41ff92100",
  "operation": 0,
  "gasToken": "0x26F2319Fbb44772e0ED58fB7c99cf8da59e2b5BE"
}

and the address of the safe is 0x030e4688f6C8eCf7872a366540D34260623EB578

Expected behavior
This should return the response that looks something like this (depending on how your relay server is configured):

{
    "safeTxGas": "102585",
    "baseGas": "48740",
    "dataGas": "48740",
    "operationalGas": "0",
    "gasPrice": "5000000000",
    "lastUsedNonce": 1,
    "gasToken": "0x26F2319Fbb44772e0ED58fB7c99cf8da59e2b5BE",
    "refundReceiver": "0x846fcb74913277AF31FF535cC88bfcC62f64346A"
}

however because the revert data cannot be parsed this error is returned instead:

{
    "exception": "CannotEstimateGas: Received 0x0000000000000000000000000000000000000000000000000000000000010419 for tx={'value': 0, 'chainId': 100, 'from': '0x030e4688f6C8eCf7872a366540D34260623EB578', 'gas': 0, 'gasPrice': 0, 'to': '0x030e4688f6C8eCf7872a366540D34260623EB578', 'data': '0xc4ca3a9c000000000000000000000000e097ec255ea9fe4e199e920e105b0f61d6e09c340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044cd4517eb00000000000000000000000026f2319fbb44772e0ed58fb7c99cf8da59e2b5be00000000000000000000000000000000000000000000000006e8f3c41ff9210000000000000000000000000000000000000000000000000000000000'}"
}
@habdelra habdelra added the bug Something isn't working label Mar 31, 2022
@Uxio0
Copy link
Member

Uxio0 commented Apr 1, 2022

Hi, could you provide the version of the Nethermind node?

@habdelra
Copy link
Author

habdelra commented Apr 1, 2022

sure, it is Nethermind/v1.12.4-0-1c8b669ae-20220401/X64-Linux/6.0.1

@Uxio0
Copy link
Member

Uxio0 commented Apr 4, 2022

Could you check if that's still an issue with the last version: 1.12.6?

@Uxio0 Uxio0 closed this as completed Jun 7, 2022
@Uxio0
Copy link
Member

Uxio0 commented Jun 7, 2022

Closing as we cannot reproduce with new versions of Nethermind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants