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

Fix get block #781

Merged
merged 7 commits into from
Nov 26, 2021
Merged

Fix get block #781

merged 7 commits into from
Nov 26, 2021

Conversation

crypto-facs
Copy link
Contributor

@crypto-facs crypto-facs commented Nov 25, 2021

Closes: #778

Description

We were seeing an issue where some txs where not being indexed on our indexer without any noticeable errors. @yihuang noticed that tx Indexer runs asynchronously with block commit. This leads to unexepected behaviour sinceeth_getBlockByNumber currently cross checks valid txs based on the tx Indexer. resultBlock is on sync with block commit so it provides a better approach to remove failed transactions from the block response.


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

if err != nil || ethTx.Height != block.Height {
e.logger.Debug("failed to query eth tx", "hash", tx.Hash().Hex())
// check tx exists on EVM by cross checking with blockResults
if txResults[i].Code != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

if Code is not 0, it's EVM tx?
maybe add some comment about it

Copy link
Contributor

Choose a reason for hiding this comment

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

if Code != 0, it's a failed transaction.

Copy link
Contributor

@leejw51crypto leejw51crypto left a comment

Choose a reason for hiding this comment

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

lgtm

@fedekunze fedekunze added backport/0.17.x PR scheduled for inclusion in the v0.17's next stable release backport/0.16.x PR scheduled for inclusion in the v0.16's next stable release labels Nov 25, 2021
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

LGTM. Can you add a bugfix changelog entry and an integration test on tests/e2e/integration_test.go to check for this?

@fedekunze fedekunze enabled auto-merge (squash) November 26, 2021 18:03
@fedekunze fedekunze merged commit bfe059e into evmos:main Nov 26, 2021
mergify bot pushed a commit that referenced this pull request Nov 26, 2021
(cherry picked from commit bfe059e)

# Conflicts:
#	CHANGELOG.md
@mergify mergify bot mentioned this pull request Nov 26, 2021
mergify bot pushed a commit that referenced this pull request Nov 26, 2021
(cherry picked from commit bfe059e)

# Conflicts:
#	CHANGELOG.md
#	rpc/ethereum/backend/backend.go
@mergify mergify bot mentioned this pull request Nov 26, 2021
leejw51crypto pushed a commit to leejw51crypto/ethermint that referenced this pull request Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/0.16.x PR scheduled for inclusion in the v0.16's next stable release backport/0.17.x PR scheduled for inclusion in the v0.17's next stable release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: web3 getBlock api could return empty transactions
4 participants