dcSpark / milkomeda-c1-evm-passive

Milkomeda evm node configurations for partners wanting to connect to the evm nodes p2p network
MIT License
15 stars 5 forks source link

[MILKOMEDA C1] Making JSON-RPC request via `window.ethereum.request` with null fields result in status code `400` #16

Open Mercurial opened 1 year ago

Mercurial commented 1 year ago

So basically I'm trying to make RPC request via ethereum.request to Milkomeda C1 like so:

Note: ethereum.request is injected by metamask which is then connected to Milkomeda C1 RPC url

await ethereum.request({
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0x48d51ebfd87d2ec655a77bdc7e798dbf42eab770",
            "to": "0xCA77372a728C09610BCf68a47C71c419888b380D",
            "gas": null,
            "gasPrice": null,
            "value": null,
            "data": "0x6057361d00000000000000000000000000000000000000000000000000000000637050de",
            "maxFeePerGas": null,
            "maxPriorityFeePerGas": null,
            "type": null,
            "chainId": null
        }
    ]
})

but the response is:

image

if I update my request to remove the null fields:

await ethereum.request({
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0x48d51ebfd87d2ec655a77bdc7e798dbf42eab770",
            "to": "0xCA77372a728C09610BCf68a47C71c419888b380D",
            "data": "0x6057361d00000000000000000000000000000000000000000000000000000000637050de"
        }
    ]
})

it seems to give a successful result:

image

Switching to Milkomeda A1 / A1 Devnet seems to work or any other EVM chains for that matter.

There seems to be something special in the C1 nodes causing the issue.

Some example frameworks / libraries that generates this payload is Nethereum .NET library for Ethereum. I also have opened a ticket in their repo. https://github.com/Nethereum/Nethereum/issues/897

rinor commented 1 year ago

maxFeePerGas and maxPriorityFeePerGas are properties of EIP-1559 transactions included in Ethereum's London fork that C1 doesn’t support (neither does A1 for that matter). Both networks A1/C1 operate under Berlin fork.

Mercurial commented 1 year ago

maxFeePerGas and maxPriorityFeePerGas are properties of EIP-1559 transactions included in Ethereum's London fork that C1 doesn’t support (neither does A1 for that matter). Both networks A1/C1 operate under Berlin fork.

Hello thanks for the response!

I think it still doesn't explain the behavior because if I remove both fields from the request it still gives an error:

image

But if I switch the Metamask network to Milkomeda A1 it seems to work great even with the same payload:

image

So its just weird that Milkomeda C1 mainnet and devnet gives this error 😥

rinor commented 1 year ago
  1. Because the deployed Besu version on C1 doesn't accept type or chainId to be null when the key is present on params.
  2. A1 doesn't use Besu
Mercurial commented 1 year ago
  • Because the deployed Besu version on C1 doesn't accept type or chainId to be null when the key is present on params.
  • A1 doesn't use Besu

ah that makes sense!

Mercurial commented 1 year ago
  • Because the deployed Besu version on C1 doesn't accept type or chainId to be null when the key is present on params.
  • A1 doesn't use Besu

Oh yes I can confirm that is the case!

image