Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

GetTransactionReceipt(hash common.Hash): the "cumulativeGasUsed" should not be nil in this function #648

Closed
banishee opened this issue Dec 10, 2020 · 0 comments · Fixed by #662
Assignees

Comments

@banishee
Copy link

banishee commented Dec 10, 2020

System info: [Include Ethermint commit, operating system name, and other relevant details]
before 6e1c166

Steps to reproduce:
If someone try to get a transaction receipt based on an txhash when using go-ethereum

  1. [First Step]
    import the github.com/ethereum/go-ethereum v1.9.24 to get a transaction receipt
	client, err := ethclient.Dial(host)
	if err != nil {
		log.Fatalf("failed to initialize client: %+v", err)
	}

	receipt, err := client.TransactionReceipt(context.Background(), "0x6283f56fd27cb547e54c9e16ac402ea31c5bc3f21279a4e93234da29da3f8810")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("contract address:", receipt.ContractAddress.String())

Expected behavior: [What you expected to happen]
the output should show up an legal eth adress

Actual behavior: [What actually happened]
an error comes out: missing required field 'cumulativeGasUsed' for Receipt

Additional info: [Include gist of relevant config, logs, etc.]

"cumulativeGasUsed": nil, // ignore until needed

  • the root cause is coming from here. You guys make it as nil
  • but when I use client.TransactionReceipt, it will trigger the judgement in (r *Receipt) UnmarshalJSON(input []byte) function
  • so it cause a tiny error
  • what I suggest is making nil into hexutil.Uint64(0)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants