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

Removes Default from RollingBitField #33969

Merged

Conversation

brooksprumo
Copy link
Contributor

Problem

RollingBitField derives Default, but this is not safe nor valid.

A default RollingBitField will have max_width set to zero. One of the RollingBitField's invariants is that max_width is greater than zero. This is because max_width is used with modulo to compute the address from a given key, and zero is not allowed here.

Summary of Changes

Do not derive Default.

@brooksprumo brooksprumo self-assigned this Nov 7, 2023
@brooksprumo brooksprumo marked this pull request as ready for review November 7, 2023 16:52
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #33969 (60d28b3) into master (d04ad65) will increase coverage by 0.0%.
Report is 37 commits behind head on master.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           master   #33969   +/-   ##
=======================================
  Coverage    81.9%    81.9%           
=======================================
  Files         811      811           
  Lines      218163   218163           
=======================================
+ Hits       178734   178765   +31     
+ Misses      39429    39398   -31     

Copy link
Contributor

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

lgtm

@brooksprumo brooksprumo merged commit 6f213c3 into solana-labs:master Nov 7, 2023
32 checks passed
@brooksprumo brooksprumo deleted the rolling-bit-field/default branch November 7, 2023 20:58
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