Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

blockwatch/core: Fix Kovan incorrect block hash bug #181

Merged
merged 11 commits into from
Jun 19, 2019

Conversation

fabioberger
Copy link
Contributor

@fabioberger fabioberger commented Jun 19, 2019

MarkM mentioned Mesh not firing events when connected to Kovan on our discord.

Turns out Kovan uses a different structure for block headers then mainnet that isn't rlp compatible and since we are using go-ethereum's EthClient, it is generating incorrect block hashes for Kovan blocks. More details on this discrepancy between mainnet and Kovan here: ethereum/go-ethereum#18166.

The fix is to use a raw JSON RPC request to eth_blockByNumber which returns a pre-computed block hash that is always properly formatted instead of re-computing the block hash given the block header struct returned from EthClient's BlockByNumber() method.

Additionally, this PR also logs all BlockWatcher errors, which were not being logged previously.

@fabioberger fabioberger requested a review from albrow June 19, 2019 18:31
@fabioberger fabioberger changed the title blockwatch/core: Fix Kovan incorrect block hash bug [WIP] blockwatch/core: Fix Kovan incorrect block hash bug Jun 19, 2019
@fabioberger fabioberger changed the title [WIP] blockwatch/core: Fix Kovan incorrect block hash bug blockwatch/core: Fix Kovan incorrect block hash bug Jun 19, 2019
ethereum/blockwatch/block_watcher.go Show resolved Hide resolved
ethereum/blockwatch/client.go Outdated Show resolved Hide resolved
ethereum/blockwatch/client.go Show resolved Hide resolved
ethereum/blockwatch/client.go Outdated Show resolved Hide resolved
fabioberger and others added 4 commits June 19, 2019 16:58
Co-Authored-By: Alex Browne <stephenalexbrowne@gmail.com>
Co-Authored-By: Alex Browne <stephenalexbrowne@gmail.com>
Copy link
Contributor

@albrow albrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one small comment.

@fabioberger fabioberger merged commit 30ffca4 into master Jun 19, 2019
@fabioberger fabioberger deleted the fix/kovanBlockHashIssue branch June 19, 2019 21:53
@HACKNATHON001
Copy link

HACKNATHON001 commented Jul 5, 2019

not kovan issue mainet ethereum do not accept spam issue..if im closed this project same stuck overall

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

Successfully merging this pull request may close these issues.

3 participants