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

Removing totalDifficulty field from BlockForRpc class while returning… #7434

Conversation

ssonthal
Copy link
Contributor

Resolves #7397

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • Removes totalDifficulty field from BlockForRpc class
  • Removes the property from the expected response.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • [] Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

@ssonthal
Copy link
Contributor Author

@smartprogrammer93 could you suggest if these changes are in the right direction?

@smartprogrammer93
Copy link
Contributor

@shubham-sonthalia looks like it is.

@smartprogrammer93
Copy link
Contributor

Keep you PR in Draft mode until it is ready for review please 🙏

@ssonthal ssonthal marked this pull request as draft September 15, 2024 10:02
@ssonthal
Copy link
Contributor Author

Does the scope of the issue involve removing totalDifficulty from the entire solution? Or only for the scope of Rpc modules?

@smartprogrammer93
Copy link
Contributor

@shubham-sonthalia only RPC for now

@ssonthal
Copy link
Contributor Author

I have removed all occurences of totalDifficulty in Nethermind.JsonRpc module as well as test files -

image

I also ran all the tests for the RPC related modules. They are all passing -

image

I think all changes for the scope of the issue is done. Please let me know your thoughts.

@ssonthal ssonthal marked this pull request as ready for review September 15, 2024 11:42
@LukaszRozmej
Copy link
Member

#7397 (comment)

Copy link
Contributor

@MarekM25 MarekM25 left a comment

Choose a reason for hiding this comment

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

Because total difficulty is not needed in some cases, we can use BlockTreeLookupOptions.TotalDifficultyNotNeeded. For example, if we are reading a block by its hash and do not require TD, we can avoid reading from the blockInfo database.

@MarekM25 MarekM25 self-requested a review September 16, 2024 10:39
@MarekM25
Copy link
Contributor

#7397 (comment)

Yes, it would be good to confirm with blockscout team. On the other hand, not sure if it is used at all for various chains (besides block explorers)

@LukaszRozmej
Copy link
Member

LukaszRozmej commented Sep 16, 2024

To be honest I wouldn't merge that PR. Just because Main Ethereum doesn't need it (and spec is about main Ethereum), doesn't mean we should remove it because our clients are using other consensus algorithms and may still need it. Just let it be until proven unnecessary.

@ssonthal
Copy link
Contributor Author

@LukaszRozmej @smartprogrammer93 Shall I close this PR?

@smartprogrammer93
Copy link
Contributor

@shubham-sonthalia, unfortunately, i agree with lukasz as his point makes sense. So we need to close this for now.

@ssonthal ssonthal closed this Sep 21, 2024
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.

Remove totalDifficulty from block in json reponse
4 participants