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

change(rpc): return u64 from get_network_sol_ps and remove arbitrary_precision feature from serde #5829

Merged
merged 3 commits into from
Dec 9, 2022

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Dec 8, 2022

Motivation

Mining RPCs responding with the network solution rate added in #5808 are returning a u128, requiring the arbitrary_precision feature from serde.

There are issues open in serde about the arbitrary_precision feature (see serde-rs/json#505 and serde-rs/serde#1183). We haven't run into these issues but we only need u64 for any feasible solution rate that might be returned anyways, so we should use a u64 instead of a u128.

Solution

  • Cast solution_rate to a u64
  • Return a u64 from getnetworksolps, getnetworkhashps, and getmininginfo

Review

Anyone can review.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
    • Does it change concurrent code, unsafe code, or consensus rules?
  • How do you know it works? Does it have tests?

@arya2 arya2 added A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code P-Low ❄️ A-rpc Area: Remote Procedure Call interfaces C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG labels Dec 8, 2022
@arya2 arya2 requested a review from a team as a code owner December 8, 2022 20:09
@arya2 arya2 self-assigned this Dec 8, 2022
@arya2 arya2 requested review from dconnolly and removed request for a team December 8, 2022 20:09
@github-actions github-actions bot added C-enhancement Category: This is an improvement C-feature Category: New features C-removed labels Dec 8, 2022
@arya2 arya2 requested review from teor2345 and removed request for dconnolly December 8, 2022 20:09
@arya2 arya2 force-pushed the getmininginfo-use-u64 branch from 768a463 to dd272db Compare December 8, 2022 20:14
teor2345
teor2345 previously approved these changes Dec 8, 2022
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good.

as would be ok in this specific case, but since this module has consensus rules in it, we might want to avoid using it entirely here.

@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #5829 (dd272db) into main (77b85cf) will decrease coverage by 0.00%.
The diff coverage is n/a.

❗ Current head dd272db differs from pull request most recent head 4ec9969. Consider uploading reports for the commit 4ec9969 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5829      +/-   ##
==========================================
- Coverage   78.82%   78.81%   -0.01%     
==========================================
  Files         308      308              
  Lines       38742    38742              
==========================================
- Hits        30539    30536       -3     
- Misses       8203     8206       +3     

arya2 and others added 2 commits December 8, 2022 16:39
teor2345
teor2345 previously approved these changes Dec 8, 2022
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Thanks!

Does this also need a Cargo.lock update?
(CI will check that for us.)

@teor2345
Copy link
Contributor

teor2345 commented Dec 8, 2022

Oh, sorry about the rustfmt in my suggestion.

@arya2
Copy link
Contributor Author

arya2 commented Dec 8, 2022

Does this also need a Cargo.lock update? (CI will check that for us.)

Nope, it probably doesn't condition any dependencies on it.

Oh, sorry about the rustfmt in my suggestion.

No worries, thank you for the note and for the quick review.

mergify bot added a commit that referenced this pull request Dec 8, 2022
mergify bot added a commit that referenced this pull request Dec 9, 2022
@teor2345 teor2345 added C-cleanup Category: This is a cleanup and removed C-enhancement Category: This is an improvement C-feature Category: New features C-removed labels Dec 9, 2022
@mergify mergify bot merged commit 5ec6ad5 into main Dec 9, 2022
@mergify mergify bot deleted the getmininginfo-use-u64 branch December 9, 2022 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependency file updates A-rpc Area: Remote Procedure Call interfaces A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants