aurora-is-near / aurora-engine

⚙️ Aurora Engine implements an Ethereum Virtual Machine (EVM) on the NEAR Protocol.
https://doc.aurora.dev/develop/compat/evm
329 stars 82 forks source link

Go-ethereum's ethclient can't parse some blocks due to the value in the `gas` field being too big #558

Open HarmlessEvil opened 2 years ago

HarmlessEvil commented 2 years ago

We request a block (for example, 95283117) through the official Ethereum client written in Golang. Due to the fact that the value in the gas field is too large number, the client cannot parse it (because it expects the number to be no more than 64 bits, as indicated by the error). Because of this, we are forced to skip blocks in our application.

Is it intentional or not? How should we handle this?

Here is the code to reproduce the issue:

package main

import (
    "context"
    "math/big"

    "github.com/ethereum/go-ethereum/ethclient"
    "github.com/ethereum/go-ethereum/rpc"
    log "github.com/sirupsen/logrus"
)

func main() {
    ethRPC, err := rpc.DialContext(context.TODO(), "https://testnet.aurora.dev/")
    if err != nil {
        log.WithError(err).Panic("failed to connect to rpc")
    }

    c := ethclient.NewClient(ethRPC)
    block, err := c.BlockByNumber(context.TODO(), big.NewInt(95283117))
    log.WithFields(log.Fields{
        "block": block,
        "err":   err,
    }).Info()
}

And this is the result of the execution:

INFO[0000] block="<nil>" err="json: cannot unmarshal hex number > 64 bits into Go struct field rpcBlock.transactions of type hexutil.Uint64"
birchmd commented 2 years ago

Thanks for the report @HarmlessEvil

I think the issue is coming from this transaction in the block, rather than the block itself. So one possible work-around would be to only get the block header, instead of getting all the transaction data.

I was not aware geth required transaction objects themselves to have 64-bit gas limits. In our data structures gas limit is allowed to be 256-bit. It is only on execution that we prevent gas limits larger than 64-bit.