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

Improve estimate instant #3846

Merged
merged 1 commit into from
Apr 19, 2023
Merged

Improve estimate instant #3846

merged 1 commit into from
Apr 19, 2023

Conversation

damip
Copy link
Member

@damip damip commented Apr 19, 2023

Change following Security analysis.
This avoids potential overflows of Instant on certain platforms.

  • document all added functions
  • try in sandbox /simulation/labnet
  • unit tests on the added/changed features
    • make tests compile
    • make tests pass
  • add logs allowing easy debugging in case the changes caused problems
  • if the API has changed, update the API specification

🤖 Generated by Copilot at e1323db

Summary

🔧🧮🚫

Refactored estimate_instant method in massa-time to use saturating arithmetic. This simplifies the code and prevents underflow errors.

estimate_instant
Saturates, not checks, the time
Autumn leaves no errors

Walkthrough

  • Refactor estimate_instant to use saturating arithmetic instead of checked arithmetic (link). This simplifies the code and avoids potential underflow errors when subtracting two MassaTime values.

@damip damip changed the base branch from main to testnet_22 April 19, 2023 11:11
@damip damip marked this pull request as ready for review April 19, 2023 11:12
@damip damip self-assigned this Apr 19, 2023
@damip damip requested review from dr-chain and AurelienFT April 19, 2023 12:56
@damip
Copy link
Member Author

damip commented Apr 19, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 19, 2023

Build succeeded:

@bors bors bot merged commit a888340 into testnet_22 Apr 19, 2023
@dr-chain dr-chain deleted the improve_estimate_instant branch April 26, 2023 15:23
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.

2 participants