Skip to content

Fix - Missing resize at loader-v1 deserialization with direct mapping#6994

Merged
Lichtso merged 1 commit intoanza-xyz:masterfrom
Lichtso:fix/direct_mapping_loader_v1_deserialization_resize
Jul 17, 2025
Merged

Fix - Missing resize at loader-v1 deserialization with direct mapping#6994
Lichtso merged 1 commit intoanza-xyz:masterfrom
Lichtso:fix/direct_mapping_loader_v1_deserialization_resize

Conversation

@Lichtso
Copy link
Copy Markdown

@Lichtso Lichtso commented Jul 16, 2025

Problem

The original direct mapping implementation (solana-labs#28053) forgot to resize accounts at loader-v1 deserialization in the direct mapping enabled branch of the feature gate. Meaning the last CPI callee would be controlling the account size instead.

https://github.com/solana-labs/solana/pull/28053/files#diff-c53636d36ed15b806b0a727e1e5ab040475674798ddf036903133dc1447c45b4R365 is where the else branch should have been.

Summary of Changes

Adds the missing resize logic and adjusts test_cpi_account_data_updates.

@Lichtso Lichtso requested a review from a team as a code owner July 16, 2025 09:58
.ok_or(InstructionError::InvalidArgument)?;
// The redundant check helps to avoid the expensive data comparison if we can
match borrowed_account.can_data_be_resized(data.len()) {
match borrowed_account.can_data_be_resized(pre_len) {
Copy link
Copy Markdown
Author

@Lichtso Lichtso Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a non-functional change because data.len() == pre_len. Just for the sake of readability and consistency with the other three places here and in the aligned derserialization.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 16, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.2%. Comparing base (d35248b) to head (69a5416).
⚠️ Report is 2949 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6994     +/-   ##
=========================================
- Coverage    83.2%    83.2%   -0.1%     
=========================================
  Files         856      856             
  Lines      376882   376884      +2     
=========================================
- Hits       313781   313770     -11     
- Misses      63101    63114     +13     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Lichtso Lichtso merged commit a86cc4b into anza-xyz:master Jul 17, 2025
41 checks passed
@Lichtso Lichtso deleted the fix/direct_mapping_loader_v1_deserialization_resize branch July 17, 2025 11:16
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.

3 participants