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: Align types to 1 for safe pointer cast #5179

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

joncinque
Copy link
Contributor

@joncinque joncinque commented Aug 31, 2023

Problem

Under Rust 1.72, the cast done by the stake pool program from raw bytes into a ValidatorStakeInfo panics because the underlying pointer might not be aligned to an address with a multiple of 8. See the offending line: https://github.com/solana-labs/solana-program-library/blob/c79c727f88710e565cd47bde0049f1b449aef0eb/stake-pool/program/src/big_vec.rs#L163C1-L163C80

And see https://github.com/solana-labs/solana/actions/runs/6029425589/job/16358927677?pr=32961 for a failing run.

Solution

It causes loads of churn, but do the right thing: use the alignment-safe PodU64 and PodU32 instead of u64 and u32, respectively.

Note: this is blocking the upgrade of the monorepo to 1.72 because of downstream build errors

@joncinque
Copy link
Contributor Author

Merging to unblock the monorepo

@joncinque joncinque merged commit 517be45 into solana-labs:master Aug 31, 2023
10 checks passed
@joncinque joncinque deleted the spalign branch August 31, 2023 07:53
@joncinque joncinque changed the title stake-pool: Use unaligned types for safe pointer cast stake-pool: Align types to 1 for safe pointer cast Aug 31, 2023
thlorenz added a commit to ironforge-cloud/solana-program-library that referenced this pull request Sep 4, 2023
* master: (719 commits)
  release: Bump token-2022 and all dependencies (solana-labs#5189)
  SPL errors from hashes (solana-labs#5169)
  stake-pool: Add comments about unnecessary ownership checks (HAL-01) (solana-labs#5084)
  stake-pool: Enforce that pool mint uses 9 decimal places (HAL-03) (solana-labs#5085)
  build(deps-dev): bump tsx from 3.12.7 to 3.12.8 in /single-pool/js (solana-labs#5188)
  account-compression: Fixup sdk doc deployment (solana-labs#5187)
  token-js: renamed `getExtraAccountMetaAccount` to `getExtraAccountMetaAddress` (solana-labs#5186)
  token-js: added an e2e test for transferring using a mint with a transfer hook extension (solana-labs#5138)
  Serde optional dependencies clean-up (solana-labs#5181)
  build(deps): bump chrono from 0.4.27 to 0.4.28 (solana-labs#5180)
  stake-pool: Use unaligned types for safe pointer cast (solana-labs#5179)
  spl-pod: make code docs more explicit (solana-labs#5178)
  token-js: added extra account resolution for transfer hook extension (solana-labs#5112)
  Fix incorrect code doc (solana-labs#5177)
  Move Pod types to separate library (solana-labs#5119)
  build(deps-dev): bump @typescript-eslint/eslint-plugin from 6.4.1 to 6.5.0 in /memo/js (solana-labs#5176)
  build(deps): bump chrono from 0.4.26 to 0.4.27 (solana-labs#5171)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token-swap/js (solana-labs#5174)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token/js (solana-labs#5172)
  build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /token-lending/js (solana-labs#5173)
  ...
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