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: incorrect number of transactions returned #2812

Closed
jbaldwinroberts opened this issue Aug 12, 2024 · 2 comments
Closed

go-ethereum: incorrect number of transactions returned #2812

jbaldwinroberts opened this issue Aug 12, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jbaldwinroberts
Copy link

jbaldwinroberts commented Aug 12, 2024

Description

go-ethereum is returning the incorrect number of transactions

Steps to reproduce

func TestHederaParseBlock(t *testing.T) {
	ctx := context.Background()

	ethClient, err := eth.Dial("https://testnet.hashio.io/api")
	require.NoError(t, err)

	block, err := ethClient.BlockByNumber(ctx, big.NewInt(7771665))
	require.NoError(t, err)

	log.Infof("number of block transactions, %v", len(block.Transactions())) // 1

	rpcClient, err := rpc.Dial("https://testnet.hashio.io/api")
	require.NoError(t, err)

	var result map[string]interface{}
	err = rpcClient.Call(
		&result, "eth_getBlockByNumber", toBlockNumArg(big.NewInt(7771665)), true,
	)
	require.NoError(t, err)
	
	log.Infof("number of rpc transactions, %v", len(result["transactions"].([]interface{}))) // 1
}

The above prints 1, whereas https://hashscan.io/testnet/block/7771665 shows 9.

Additional context

No response

Hedera network

testnet

Version

NA

Operating system

macOS

@jbaldwinroberts jbaldwinroberts added the bug Something isn't working label Aug 12, 2024
@ebadiere ebadiere added this to the 0.55.0 milestone Aug 19, 2024
@ebadiere ebadiere moved this from Backlog to Sprint Backlog in Smart Contract Sprint Board Aug 19, 2024
@arianejasuwienas
Copy link
Contributor

arianejasuwienas commented Aug 20, 2024

@jbaldwinroberts thank you for bringing this to our attention and for your support.

The difference you're seeing occurs because Hedera Consensus Service Submit Messages are not included in the results when querying block data via the Hedera JSON-RPC API. We will determine the reason shortly. This behaviour is not tied to the Golang client itself.

To retrieve the complete list of transactions stored on a specific block, you can use the following script:

curl -X POST https://testnet.hashio.io/api \
-H "Content-Type: application/json" \
-d '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params": [
        "0x769611",  // Block number in hexadecimal (7771665 in decimal is 0x769611 in hex)
        true
    ],
    "id":1
}'

@github-project-automation github-project-automation bot moved this from Sprint Backlog to Done in Smart Contract Sprint Board Aug 20, 2024
@ebadiere ebadiere reopened this Aug 20, 2024
@github-project-automation github-project-automation bot moved this from Done to Sprint Backlog in Smart Contract Sprint Board Aug 20, 2024
@ebadiere
Copy link
Contributor

@jbaldwinroberts To add to @arianejasuwienas point, the above JSON RPC call will return ethereum related as well as crypto transfer transactions, and there is one crypto transfer transaction in that block.

@github-project-automation github-project-automation bot moved this from Sprint Backlog to Done in Smart Contract Sprint Board Aug 20, 2024
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
Archived in project
Development

No branches or pull requests

3 participants