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

Problem: traceTransaction fails for succesful tx #720

Merged
merged 32 commits into from Nov 9, 2021

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Nov 5, 2021

Description

Solution:

  • Change the context to the beginning of the block, rather than the end
    of it
  • fix block context to the target one, while load state from the previous one
  • replay predecessor txs to get correct context for tracing.

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)

Solution:
- Change the context to the begining of the block, rather than the end
  of it, while override block context to correct one

pass predecessors

pass current block information to grpc query
@crypto-facs
Copy link
Contributor

This PR fixes important issues. LGTM! 🚀

@codecov
Copy link

codecov bot commented Nov 5, 2021

Codecov Report

Merging #720 (5cd28c3) into main (7c7f3f0) will increase coverage by 0.20%.
The diff coverage is 57.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #720      +/-   ##
==========================================
+ Coverage   56.36%   56.56%   +0.20%     
==========================================
  Files          64       64              
  Lines        5715     5776      +61     
==========================================
+ Hits         3221     3267      +46     
- Misses       2300     2309       +9     
- Partials      194      200       +6     
Impacted Files Coverage Δ
x/evm/types/query.go 0.00% <0.00%> (ø)
x/evm/keeper/grpc_query.go 66.09% <68.51%> (+3.14%) ⬆️
x/evm/keeper/keeper.go 76.00% <0.00%> (+0.57%) ⬆️

@khoslaventures
Copy link
Contributor

Do you have a way to test this works?

@yihuang
Copy link
Contributor Author

yihuang commented Nov 6, 2021

Do you have a way to test this works?

We ported the fix to 0.7.2 here: https://github.com/crypto-org-chain/ethermint/releases/tag/v0.7.2-cronos20211105, and verified on our mainnet dry-run, at least exiting known cases are all fixed by this. But yes, it would be good to have some integrated testing.
There's still known issue with traceBlock which @crypto-facs is still working on.

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.

Minor comments. Please also add a test case

rpc/ethereum/namespaces/debug/api.go Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
rpc/ethereum/namespaces/debug/api.go Outdated Show resolved Hide resolved
rpc/ethereum/namespaces/debug/api.go Outdated Show resolved Hide resolved
for i, tx := range req.Predecessors {
ethTx := tx.AsTransaction()
msg, err := ethTx.AsMessage(signer, baseFee)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

this error should be logged

Copy link
Contributor

Choose a reason for hiding this comment

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

^^

x/evm/keeper/grpc_query.go Show resolved Hide resolved
proto/ethermint/evm/v1/tx.proto Outdated Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
proto/ethermint/evm/v1/query.proto Outdated Show resolved Hide resolved
crypto-facs and others added 9 commits November 8, 2021 11:04
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
crypto-facs and others added 5 commits November 9, 2021 06:52
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
go.mod Outdated Show resolved Hide resolved
rpc/ethereum/namespaces/debug/api.go Outdated Show resolved Hide resolved
rpc/ethereum/namespaces/debug/api.go Outdated Show resolved Hide resolved
x/evm/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/evm/keeper/grpc_query.go Show resolved Hide resolved
x/evm/keeper/grpc_query.go Outdated Show resolved Hide resolved
for i, tx := range req.Predecessors {
ethTx := tx.AsTransaction()
msg, err := ethTx.AsMessage(signer, baseFee)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

^^

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.

ACK, minor logger comments

rpc/ethereum/namespaces/debug/api.go Outdated Show resolved Hide resolved
rpc/ethereum/namespaces/debug/api.go Show resolved Hide resolved
@fedekunze fedekunze enabled auto-merge (squash) November 9, 2021 18:33
@fedekunze fedekunze merged commit 2a205e5 into evmos:main Nov 9, 2021
@yihuang yihuang deleted the fix-tracetx-context branch November 9, 2021 23:43
thomas-nguy referenced this pull request in crypto-org-chain/ethermint Nov 11, 2021
Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
Co-authored-by: crypto-facs <84574577+crypto-facs@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
thomas-nguy referenced this pull request in crypto-org-chain/ethermint Nov 17, 2021
Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
Co-authored-by: crypto-facs <84574577+crypto-facs@users.noreply.github.com>
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants