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

fix!: Fix eth tx hashes in json-rpc responses #1176

Merged
merged 12 commits into from
Jul 19, 2022
Merged

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Jul 12, 2022

Description

Fix eth tx hashes in json-rpc responses

Closes: #1175

  • Remove Size_ field
  • Validate From/Hash fields in ante handler
  • Recompute tx hashes in json-rpc apis to cope with old blocks

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)

@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #1176 (479a812) into main (ea81e15) will increase coverage by 0.03%.
The diff coverage is 73.00%.

❗ Current head 479a812 differs from pull request most recent head 2acc2fb. Consider uploading reports for the commit 2acc2fb to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1176      +/-   ##
==========================================
+ Coverage   62.27%   62.31%   +0.03%     
==========================================
  Files          91       91              
  Lines        7369     7411      +42     
==========================================
+ Hits         4589     4618      +29     
- Misses       2553     2563      +10     
- Partials      227      230       +3     
Impacted Files Coverage Δ
rpc/types/utils.go 0.00% <0.00%> (ø)
x/evm/types/tx_args.go 0.00% <0.00%> (ø)
rpc/types/events.go 88.09% <60.00%> (-2.51%) ⬇️
app/ante/eth.go 81.54% <65.45%> (-1.42%) ⬇️
x/evm/keeper/params.go 100.00% <100.00%> (ø)
x/evm/types/msg.go 85.04% <100.00%> (+1.12%) ⬆️
x/evm/types/utils.go 62.50% <100.00%> (+1.38%) ⬆️
x/feemarket/keeper/params.go 82.35% <100.00%> (+5.42%) ⬆️

CHANGELOG.md Outdated Show resolved Hide resolved
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 @yihuang, please add tests so that this doesn't break again

CHANGELOG.md Outdated Show resolved Hide resolved
@yihuang yihuang requested a review from fedekunze July 13, 2022 02:01
@yihuang
Copy link
Contributor Author

yihuang commented Jul 13, 2022

Thanks @yihuang, please add tests so that this doesn't break again

unit tests added.
And I updated the PR to fix the root cause:

  • Removed Size_ field from MsgEthereumTx, reverted, maybe better to keep it to avoid breaking the current tx format.
  • Validate Hash/From field in MsgEthereumTx

app/ante/eth.go Outdated Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
Closes: evmos#1175

- Remove Size_ field
- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

remove Size_, validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format
@yihuang
Copy link
Contributor Author

yihuang commented Jul 15, 2022

Thanks @yihuang, please add tests so that this doesn't break again

tests added.

app/ante/eth.go Outdated Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
x/evm/types/msg.go Show resolved Hide resolved
x/evm/spec/04_transactions.md Show resolved Hide resolved
proto/ethermint/evm/v1/tx.proto Show resolved Hide resolved
app/ante/eth.go Outdated Show resolved Hide resolved
@yihuang
Copy link
Contributor Author

yihuang commented Jul 19, 2022

Added a commit to workaround the issue in event parsing, this is needed to handle the legacy blocks even if we have the root cause fix, without require user to resync from scatch.

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. Let's create an issue to deal with the breaking change

@fedekunze
Copy link
Contributor

@yihuang some checks are failing

@yihuang
Copy link
Contributor Author

yihuang commented Jul 19, 2022

ACK. Let's create an issue to deal with the breaking change

Do you mean removing the Size_ field?

@yihuang
Copy link
Contributor Author

yihuang commented Jul 19, 2022

@yihuang some checks are failing

done, unit tests fixed.

@fedekunze fedekunze enabled auto-merge (squash) July 19, 2022 15:03
@fedekunze fedekunze merged commit ffe78da into evmos:main Jul 19, 2022
@yihuang yihuang deleted the fix-tx-hash branch July 19, 2022 15:18
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Jul 27, 2022
* Fix eth tx hashes in json-rpc responses

Closes: evmos#1175

- Remove Size_ field
- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

remove Size_, validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format

* move some validation to ValidateBasic

* move validation to ValidateBasic

* make ToTransaction returns a valid msg

* restructure the protoTxProvider check

* add comment

* workaround tx hash issue in event parsing

* fix integration test

* fix unit test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
fedekunze added a commit that referenced this pull request Aug 3, 2022
facs95 pushed a commit that referenced this pull request Aug 12, 2022
* Fix eth tx hashes in json-rpc responses

Closes: #1175

- Remove Size_ field
- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

remove Size_, validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format

* move some validation to ValidateBasic

* move validation to ValidateBasic

* make ToTransaction returns a valid msg

* restructure the protoTxProvider check

* add comment

* workaround tx hash issue in event parsing

* fix integration test

* fix unit test

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 Aug 17, 2022
* Fix eth tx hashes in json-rpc responses

Closes: evmos#1175

- Remove Size_ field
- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

remove Size_, validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format

* move some validation to ValidateBasic

* move validation to ValidateBasic

* make ToTransaction returns a valid msg

* restructure the protoTxProvider check

* add comment

* workaround tx hash issue in event parsing

* fix integration test

* fix unit test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
devon-chain added a commit to FunctionX/ethermint that referenced this pull request Nov 17, 2022
* Fix eth tx hashes in json-rpc responses

Closes: evmos#1175

- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format

* move some validation to ValidateBasic

* move validation to ValidateBasic

* make ToTransaction returns a valid msg

* restructure the protoTxProvider check

* add comment

* workaround tx hash issue in event parsing

* fix integration test

* fix unit test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

(cherry pick from commit 5cae04e)
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.

getBlock and other json-rpc api return incorrect tx hash
3 participants