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

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

Open
HarmlessEvil opened this issue Jul 25, 2022 · 1 comment

Comments

@HarmlessEvil
Copy link

HarmlessEvil commented Jul 25, 2022

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"
@HarmlessEvil HarmlessEvil changed the title Go-ethereum's ethclient can't parse some blocks due to the gas field being too big Go-ethereum's ethclient can't parse some blocks due to the value in the gas field being too big Jul 25, 2022
@birchmd
Copy link
Member

birchmd commented Jul 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants