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

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
@joncinque joncinque deleted the sppod branch September 14, 2023 11:36
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant