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

Fix TxIndex wrongly when trace first Tx of a block #1187

Merged
merged 4 commits into from
Jul 20, 2022
Merged

Fix TxIndex wrongly when trace first Tx of a block #1187

merged 4 commits into from
Jul 20, 2022

Conversation

VictorTrustyDev
Copy link
Contributor

@VictorTrustyDev VictorTrustyDev commented Jul 17, 2022

If Predecessors is empty, txConfig.TxIndex originally = 0 and when it reachs line 401 txConfig.TxIndex++, it will becomes 1. It should be 0

Closes: #XXX

Description

Fix TxIndex wrongly when trace first Tx of a block


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 `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0
@itsdevbear
Copy link
Contributor

@VictorTrustyDev Nitpick but throw the ++ in an else

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.

Thanks @VictorTrustyDev, can you add a test and bug fix changelog entry?

x/evm/keeper/grpc_query.go Outdated Show resolved Hide resolved
@VictorTrustyDev
Copy link
Contributor Author

VictorTrustyDev commented Jul 18, 2022

Thanks @VictorTrustyDev, can you add a test and bug fix changelog entry?

@fedekunze well I'm sorry I've tried to look at geth's document but I can't find how to get txIndex as part of response so I have no idea how to write test case for this

@fedekunze fedekunze enabled auto-merge (squash) July 19, 2022 15:40
@fedekunze fedekunze added the backport/0.17.x PR scheduled for inclusion in the v0.17's next stable release label Jul 19, 2022
@codecov
Copy link

codecov bot commented Jul 19, 2022

Codecov Report

Merging #1187 (5a3917f) into main (ffe78da) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1187      +/-   ##
==========================================
+ Coverage   62.31%   62.32%   +0.01%     
==========================================
  Files          91       91              
  Lines        7411     7413       +2     
==========================================
+ Hits         4618     4620       +2     
  Misses       2563     2563              
  Partials      230      230              
Impacted Files Coverage Δ
x/evm/keeper/grpc_query.go 69.06% <100.00%> (+0.14%) ⬆️

@fedekunze fedekunze merged commit cd41c48 into evmos:main Jul 20, 2022
mergify bot pushed a commit that referenced this pull request Jul 20, 2022
…1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
(cherry picked from commit cd41c48)

# Conflicts:
#	CHANGELOG.md
fedekunze added a commit that referenced this pull request Jul 20, 2022
…ackport #1187) (#1195)

* fix(evm): `TxIndex` is wrong when trace is the first tx of a block (#1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
(cherry picked from commit cd41c48)

# Conflicts:
#	CHANGELOG.md

* fix RPC

Co-authored-by: Victor Pham <me@victortrusty.dev>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Jul 27, 2022
…vmos#1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Jul 27, 2022
…ackport evmos#1187) (evmos#1195)

* fix(evm): `TxIndex` is wrong when trace is the first tx of a block (evmos#1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
(cherry picked from commit cd41c48)

# Conflicts:
#	CHANGELOG.md

* fix RPC

Co-authored-by: Victor Pham <me@victortrusty.dev>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
devon-chain pushed a commit to devon-chain/ethermint that referenced this pull request Aug 2, 2022
…vmos#1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
devon-chain pushed a commit to PundiAI/ethermint that referenced this pull request Nov 17, 2022
…vmos#1187)

* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

3 participants