Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

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
@brooksprumo brooksprumo requested a review from HaoranYi 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
@brooksprumo brooksprumo deleted the rolling-bit-field/default branch November 7, 2023 20:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants