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

stake-pool: Remove unsafe pointer casts via Pod types #5185

Merged
merged 3 commits into from
Sep 14, 2023

Conversation

joncinque
Copy link
Contributor

Problem

#5179 was a quick fix to properly deserialize the stake pool types in-place, updating all contained types to align to 1. This works, but any other type aligned to an address greater than 1 can still expose undefined behavior.

Solution

Rather than parametrizing everything in BigVec to the Pack trait, change BigVec to use the bytemuck Pod trait, which is designed for this exact situation.

While going through this, I noticed that the custom iterator over BigVec was not very performant, and that it was much better to just deserialize the whole slice in-place. With this PR, we can once again support the big pool size from #5179.

@joncinque
Copy link
Contributor Author

Got a green light from auditors, moving forward with this

@joncinque joncinque merged commit 38212ea into solana-labs:master Sep 14, 2023
9 checks passed
@joncinque joncinque deleted the sppod branch September 14, 2023 11:36
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.

None yet

1 participant