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

Reuse rpcv6 BlockHeader for v7 and v8 #2448

Merged
merged 6 commits into from
Feb 14, 2025
Merged

Conversation

hudem1
Copy link
Contributor

@hudem1 hudem1 commented Feb 10, 2025

clean rpc pkgs according to issue #2437

  • rpcv7's Header is the same as v6, so, i just removed it and reused v6's entirely.
  • rpcv8's Header just has one more field L2GasPrice. So, I embedded rpcv6.Header into rpcv8.Header. Let me know whether it is ok to do that. I thought it could be nice as it reuses v6's Header and reduces code dup and makes it clear what new fields have been added, but when instantiating a v8 Header, we have to define an rpcv6 Header field inside, so it might be a bit strange maybe? ie:
rpcv8.BlockHeader {
   BlockHeader: rpcv6.BlockHeader { ... },
   L2GasPrice: ...,
}

And also, as you can see in the tests (in file subscriptions_test.go) that i had to fix, it changes the order of the fields in the stringified json. Could that be an issue ? I don't think so but still asking to make sure it's fine!

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.52%. Comparing base (6248280) to head (1b81f50).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
rpc/v8/block.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2448      +/-   ##
==========================================
+ Coverage   73.44%   73.52%   +0.07%     
==========================================
  Files         140      140              
  Lines       17143    17138       -5     
==========================================
+ Hits        12591    12601      +10     
+ Misses       3671     3655      -16     
- Partials      881      882       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hudem1 hudem1 merged commit 27b9384 into main Feb 14, 2025
14 checks passed
@hudem1 hudem1 deleted the hudem1/rpc-cleanup-BlockHeader-type branch February 14, 2025 10:22
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.

3 participants