Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patch the consistency of transaction receipts with a different chain-id #21

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

jasonsong0
Copy link

@jasonsong0 jasonsong0 commented Sep 2, 2024

Description

There was a specific block height that used the Evmos default chain ID (9000).
This occurred from v8 to v8.1.1 (block heights from 10848200 to 10849447).

Due to this issue, third-party services encountered an 'invalid chain-id' error when attempting to verify transaction results.
This patch addresses the problem by ensuring that the transaction receipt returns the same results as before.

How to verify

  1. Get the all EVM txs hashes using this script
#!/bin/bash

# Base URL
base_url="http://127.0.0.1:26657/block_results?height="

# height  range
start_height=10848200
end_height=10849447

# extract and save all ethereumTxHash to temp file
temp_file=$(mktemp)

# loop each height
for height in $(seq $start_height $end_height)
do
    # parse json and extract hash
    curl -s "${base_url}${height}" | \
    jq -r '.result.txs_results[]?.events[]? | select(.type=="ethereum_tx") | .attributes[] | select(.key=="ethereumTxHash") | .value' >> "$temp_file"
done

# remove duplicated ethereumTxHash
sort "$temp_file" | uniq

# del tmp
rm "$temp_file"
  1. Check the results of eth_getTransactionReceipt. You can use this script, which already contains EVM hashes from v8 to v8.1.1
#!/bin/bash

#hash array to check
hashes=(
    "0x17a1cacf3e10d3021157b3b1bb37c20ff5346c198c26b2706b140e15844f8b2c"
    "0x27b110b65da60ba48cbacdbbd603d3c7431e95f76b45ed04825655cff7b987b9"
    "0x287208b0e0ecce2dd2b2ead580cb35906d47568c43d06af415a926c2bdb059fc"
    "0x32a4e3869519be5072136329e135f88cf74168e519866ebea57cc433a40e075c"
    "0x3a2f786c413b25ee3dd0a0b4ce381bf34070057b45d42ec352b74d83a9485214"
    "0x444fbbc3b512ba8a88fb0123a561bf6b705687961842e8b0f36c89e6fd341dd4"
    "0x507c4b2ccbd7a039b87ad1f2c15e4c2f37877afdbd62c8c4335a0a8300d0096d"
    "0x552026b9a81ffe9c3d77d397380732646ad68f1887fcd06b3748ad63ad5c085c"
    "0x634d27ce283d0c048aae0ff51697dd794a3e7330beface61c001f5eb593e1840"
    "0x637d0c673093e8f112eeb57cae831d1355f1341a786c1fd7496c7921fabe2493"
    "0x6be81a6e5fe84f4c78cc51cbcf53862c58f69c633ffcef9ac872786b3a9362bf"
    "0x758c45ec800c05c509204db58e5463b0336750db16056f765001e55a6b1dafb6"
    "0x7af8e965fd437b29a4cdc45ca6bcd83ad5ce5cb631d9515c085529986174af64"
    "0x81e26f5674d3221372648fef0f65ff2d3b1bb9055ffa113e9e14882e7c937fc1"
    "0x83ba7322f5b446b29d9cb3de15a7fe3a0af094d29df8dcc99738ee84d8b778fd"
    "0x875d7cb7668b6ff9d022b809db54f512736190dca58b47a377bea07183d66ff0"
    "0x955fa0f3f4d2b4b32f13d6aabe212e646bcfef158c9a2fff8b4c6086b15474f2"
    "0xad1ba0a2fbf5db4280c72b16ddb1f7eff44881235b7a510fc7ad7f38da12dd49"
    "0xb53f9324f75a8a8867bf1b2a6a7d615418766e609bc3f6f2fc1b25ac4699f6ff"
    "0xbb464dddb0acbb0918d129a7af62b8eec6d55c32bd63e943acc0138668a2acd9"
    "0xbe28ece4dc02ee6f5d2af9a5599746c168896b8161d4f1783c2e49d83ec28d1b"
    "0xcb06d3696ca4811a8fea64c0fda8b2b24280ddeefcd97595fdf4c4af0b172b3c"
    "0xcfd708dc2d7ffd6f7208195fbbe5a1eed0cfb76c4596ed161034acda38d66b0f"
    "0xd15e20cb7271e73725a67cc65fdb9c52367658030dd582b855d3887024d6cb2d"
    "0xd50d17d437012e822b6c122ce0f9fb6601ce0fe8a8a805a644ff32a62dcdc44e"
    "0xea7d2418908a1dff167c40140002d942dff4e5f0e70f0649bdbed5523c85cc7d"
    "0xfb273bd0bbab8456fbc05127cda5ffbee95cb3c2a158e20bb46e63110a47ad97"
)

# curl request receipt
for hash in "${hashes[@]}"
do
    echo "Requesting transaction receipt for hash: $hash"
    
    # curl 
    curl -X POST http://127.0.0.1:8545 \
    -H "Content-Type: application/json" \
    --data "{
      \"jsonrpc\":\"2.0\",
      \"method\":\"eth_getTransactionReceipt\",
      \"params\":[\"$hash\"],
      \"id\":1
    }"
    
    echo -e "\n"
done

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)

…n ID" error in the height where the chain ID was incorrect
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.34%. Comparing base (6d3c5c6) to head (1454a72).

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                  @@
##           canto-v8/develop      #21      +/-   ##
====================================================
+ Coverage             68.30%   68.34%   +0.04%     
====================================================
  Files                   117      117              
  Lines                 11240    11245       +5     
====================================================
+ Hits                   7677     7685       +8     
+ Misses                 3088     3086       -2     
+ Partials                475      474       -1     
Files with missing lines Coverage Δ
rpc/backend/tx_info.go 65.49% <100.00%> (+1.53%) ⬆️

@jasonsong0 jasonsong0 requested a review from dudong2 September 2, 2024 09:40
@jasonsong0 jasonsong0 marked this pull request as ready for review September 3, 2024 04:58
@jasonsong0 jasonsong0 merged commit 79be3ff into canto-v8/develop Sep 3, 2024
16 of 24 checks passed
dudong2 added a commit that referenced this pull request Sep 25, 2024
…xreceipt"

This reverts commit 79be3ff, reversing
changes made to 6d3c5c6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants