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

solana: Configure clippy to deny possible truncation #285

Merged

Conversation

johnsaigle
Copy link
Collaborator

@johnsaigle johnsaigle commented Mar 8, 2024

Adds a clippy rule that blocks the inclusion of code that can result in truncation problems (i.e. denies <T> as <U> conversions where T has a greater capacity than U)

Adds linting directive to existing instances in the code and add comments about why they are safe

Also adds some unit test on the bitmap struct to make its edge-cases more legible.

@johnsaigle johnsaigle requested review from kcsongor and a5-pickle March 8, 2024 17:38
a5-pickle
a5-pickle previously approved these changes Mar 8, 2024
@johnsaigle
Copy link
Collaborator Author

Converted to Draft as this needs a rebase and possibly a different approach now that #311 is merged

@johnsaigle
Copy link
Collaborator Author

johnsaigle commented Mar 15, 2024

Blocked by #314 which resolves the truncation warning flagged by clippy merged

@nik-suri nik-suri added the solana Change to Solana programs label Mar 25, 2024
@johnsaigle johnsaigle force-pushed the solana/clippy-truncation branch from 68989f0 to 4033532 Compare April 10, 2024 16:14
@johnsaigle johnsaigle marked this pull request as ready for review April 10, 2024 16:14
@johnsaigle johnsaigle self-assigned this Apr 25, 2024
@johnsaigle johnsaigle force-pushed the solana/clippy-truncation branch from 1efa3b9 to 9bafb77 Compare May 6, 2024 13:59
@nik-suri nik-suri requested a review from a5-pickle May 8, 2024 17:49
@johnsaigle johnsaigle force-pushed the solana/clippy-truncation branch from 387f4b9 to e068db2 Compare May 28, 2024 17:43
@nvsriram nvsriram force-pushed the solana/clippy-truncation branch from e068db2 to d74cac0 Compare August 19, 2024 18:03
Adds a clippy rule to block the inclusion of code that can result in
truncation (i.e. `as T` conversions)
Adds linting directive to existing instances in the code and add
comments about why they are safe
Add a unit test on bitmap length to confirm that the maximum possible
number of votes (i.e. maximum "length" of the bitmap) is within the
limits of u8.
@nvsriram nvsriram force-pushed the solana/clippy-truncation branch from d74cac0 to 5563089 Compare August 21, 2024 15:36
@nvsriram nvsriram merged commit 51130bc into wormhole-foundation:main Aug 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 solana Change to Solana programs tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants