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

feat: fix wrong cache key on eth_getBlockByHash #3232

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

natanasow
Copy link
Collaborator

@natanasow natanasow commented Nov 7, 2024

Description:

The mainnet log shows incorrectness in the cache key.

Returning cached value eth_getBlockByHash_undefined_false:

{
   "timestamp":"0x672b8a43",
   "difficulty":"0x0",
   "extraData":"0x",
   "gasLimit":"0x1c9c380",
   "baseFeePerGas":"0x19077fd3000",
   "gasUsed":"0x128e00",
   "logsBloom":"0x00000000000000102001000000000000000000000000000100000000000000100000000000000000804000000000800000000000000020000000004040220000010040000000200800000000000000000000000200000001000208000000000000000000120000000040000000200800000000002000000000200040000800000000a00000000000000800200000100000000000000000000000000000000000020080000004000000000000000000000000000000000000000000000000000000082001000000000000000000000000000200000000000000000020000020000010000000012004000000000000000000000000000080100000000000000010",
   "miner":"0x0000000000000000000000000000000000000000",
   "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
   "nonce":"0x0000000000000000",
   "receiptsRoot":"0xcc412e69626441a403e43f13ec98131d07cd2447b5a14fedf73c944dabc6e166",
   "sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
   "size":"0x954",
   "stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
   "totalDifficulty":"0x0",
   "transactions":[
      "0xd6116fb5f24a499ea5f20fb610d3e2d9ae20c3a8c3c9832dc31e822bad1daf53"
   ],
   "transactionsRoot":"0x057c1438ce427869a7aee23fad82c8718ba275662dfcdbf9ce3d3c4594c170b0",
   "uncles":[
      
   ],
   "withdrawals":[
      
   ],
   "withdrawalsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000",
   "number":"0x43ef5f9",
   "hash":"0x057c1438ce427869a7aee23fad82c8718ba275662dfcdbf9ce3d3c4594c170b0",
   "parentHash":"0x75a8fdf0df809c00a27de852177012330dc2f1946aaf5abcc1a7496f8a4d584b"
}

on eth_GetBlockByHash

Related issue(s):

Fixes #3231

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@natanasow natanasow self-assigned this Nov 7, 2024
@natanasow natanasow added the bug Something isn't working label Nov 7, 2024
Copy link

github-actions bot commented Nov 7, 2024

Test Results

 17 files   -  2  230 suites   - 15   29m 48s ⏱️ - 1m 54s
607 tests  -  2  603 ✅ ± 0  4 💤 ±0  0 ❌  - 2 
623 runs   - 63  619 ✅  - 60  4 💤  - 1  0 ❌  - 2 

Results for commit cdf0020. ± Comparison against base commit acc4538.

This pull request removes 2 tests.
"before all" hook in "@precompile-calls Tests for eth_call with HTS" ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS "before all" hook in "@precompile-calls Tests for eth_call with HTS"
"before each" hook for "should execute "eth_getStorageAt" request to get old state with passing specific block" ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests "before each" hook for "should execute "eth_getStorageAt" request to get old state with passing specific block"

♻️ This comment has been updated with latest results.

@natanasow natanasow added this to the 0.60.0 milestone Nov 7, 2024
victor-yanev
victor-yanev previously approved these changes Nov 7, 2024
@natanasow natanasow marked this pull request as ready for review November 7, 2024 12:31
Copy link
Contributor

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

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

Can we add a test for this?

Copy link

sonarcloud bot commented Nov 7, 2024

Copy link
Contributor

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

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

LG.

@natanasow natanasow merged commit fe9fcf0 into main Nov 7, 2024
47 checks passed
@natanasow natanasow deleted the 3231-cache-key-on-eth_getBlockByHash-is-incorrect branch November 7, 2024 16:12
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.88%. Comparing base (acc4538) to head (cdf0020).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3232      +/-   ##
==========================================
- Coverage   83.17%   82.88%   -0.29%     
==========================================
  Files          66       69       +3     
  Lines        4314     4475     +161     
  Branches      843      881      +38     
==========================================
+ Hits         3588     3709     +121     
- Misses        483      497      +14     
- Partials      243      269      +26     
Flag Coverage Δ
config-service 98.14% <ø> (ø)
relay 85.29% <100.00%> (ø)
server 83.52% <ø> (ø)
ws-server 36.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/relay/src/lib/eth.ts 83.68% <100.00%> (+1.41%) ⬆️

... and 12 files with indirect coverage changes

ebadiere pushed a commit that referenced this pull request Nov 7, 2024
* chore: fix wrong passed param

Signed-off-by: nikolay <[email protected]>

* chore: modify existing test to handle block_ properties as well

Signed-off-by: nikolay <[email protected]>

---------

Signed-off-by: nikolay <[email protected]>
ebadiere pushed a commit that referenced this pull request Nov 7, 2024
* chore: fix wrong passed param

Signed-off-by: nikolay <[email protected]>

* chore: modify existing test to handle block_ properties as well

Signed-off-by: nikolay <[email protected]>

---------

Signed-off-by: nikolay <[email protected]>
Signed-off-by: Eric Badiere <[email protected]>
ebadiere added a commit that referenced this pull request Nov 7, 2024
* chore: fix wrong passed param



* chore: modify existing test to handle block_ properties as well



---------

Signed-off-by: nikolay <[email protected]>
Signed-off-by: Eric Badiere <[email protected]>
Co-authored-by: Nikolay Atanasow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache key on eth_getBlockByHash is incorrect
5 participants