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

Fix integer overflow and underflow in DeferralKey methods and add corresponding tests #20387

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Nov 22, 2024

  1. Update transaction_deferral

    Fix integer overflow in range_for_up_to_consensus_round
    Prevent integer underflow in transaction_deferral_within_limit
    xiaodi007 authored Nov 22, 2024
    Configuration menu
    Copy the full SHA
    de286d0 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2024

  1. Update transaction_deferral.rs

    Add a debug_assert! to enforce the invariant during object creation; and adjust future_round to be at least deferred_from_round in release builds to maintain the invariant without panicking in new_for_consensus_round
    Add debug_assert!(future_round >= deferred_from_round); and use saturating_sub in transaction_deferral_within_limit.
    xiaodi007 authored Nov 23, 2024
    Configuration menu
    Copy the full SHA
    cea3d0b View commit details
    Browse the repository at this point in the history
  2. Update transaction_deferral.rs

    Revert the change in range_for_up_to_consensus_round to keep checked_add(1).unwrap()
    xiaodi007 authored Nov 23, 2024
    Configuration menu
    Copy the full SHA
    18532e6 View commit details
    Browse the repository at this point in the history
  3. Update transaction_deferral.rs

    import debug_fatal
    xiaodi007 authored Nov 23, 2024
    Configuration menu
    Copy the full SHA
    fb426e5 View commit details
    Browse the repository at this point in the history