hashgraph / hedera-the-graph

Tools for hosting a graph node for the Hedera community.
Apache License 2.0
4 stars 2 forks source link

TheGraph Node is reporting a ChainID changed from `0x127` to `295` #117

Closed AlfredoG87 closed 3 months ago

AlfredoG87 commented 3 months ago

Description

This is due to the change in format from HEX to Decimal.

this change is due to https://github.com/hashgraph/hedera-json-rpc-relay/pull/2645

Steps to reproduce

curl --location 'https://mainnet.hashio.io/api' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "net_version", "params": [], "id": 1 }'

Is returning 295 when the graph was expecting 0x127

Additional context

No response

Hedera network

mainnet, testnet, previewnet

Version

v0.51.0

Operating system

None

acuarica commented 3 months ago

The error in the logs due to this issue are the following

ERRO the net version for chain mainnet has changed from 0x127 to 295 since the last time we ran, component: BlockStore
[...]
ERRO Not starting block ingestor (chain is defective), network_name: mainnet
acuarica commented 3 months ago

To fix this, first check the current net_version using the following query [1]

SELECT * FROM public.chains LIMIT 10

this should display the old net_version. To update it, run (using testnet values, change accordingly for mainnet)

UPDATE public.chains SET net_version = '296' WHERE net_version = '0x128'

Check again using [1] that the net_version was indeed updated. After that, the service needs to be restarted for the change to take effect.


On the other hand previewnet network was reset. This fix wouldn't work because the genesis block also changed. Thus a better solution is to reset the TheGraph as well. Refer to this SQL script to do so https://github.com/hashgraph/hedera-the-graph/blob/main/scripts/db/cleanup.sql.