Skip to content

v3.1: Fix - Account shrinks in CPI but grows in deserialize_parameters_aligned() (backport of #9142)#9248

Merged
Lichtso merged 1 commit intov3.1from
mergify/bp/v3.1/pr-9142
Nov 25, 2025
Merged

v3.1: Fix - Account shrinks in CPI but grows in deserialize_parameters_aligned() (backport of #9142)#9248
Lichtso merged 1 commit intov3.1from
mergify/bp/v3.1/pr-9142

Conversation

@mergify
Copy link

@mergify mergify bot commented Nov 24, 2025

Problem

Currently the behavior of stricter_abi_and_runtime_constraints && !account_data_direct_mapping matches that of !stricter_abi_and_runtime_constraints, but should instead match that of stricter_abi_and_runtime_constraints && account_data_direct_mapping in the following case:

When a program shrinks an account before CPI and then restores to the original length before returning, then the slice between the actual account length and the final size which the caller requested should be zeroed out, but isn't.

Summary of Changes

Changes deserialize_parameters_aligned(), so that stricter_abi_and_runtime_constraints && !account_data_direct_mapping matches stricter_abi_and_runtime_constraints && account_data_direct_mapping and account_data_direct_mapping becomes an invisible change again.

Feature gate: https://github.com/anza-xyz/feature-gate-tracker/issues/16


This is an automatic backport of pull request #9142 done by Mergify.

…gned()` (#9142)

* Adds INVOKE_REALLOC_SHRINK_THEN_CPI_THEN_REALLOC_EXTEND to test_program_sbf_realloc_invoke().

* Zero the slice between post_len and the current account len when stricter_abi_and_runtime_constraints && !account_data_direct_mapping in deserialize_parameters_aligned().

* Revert "Zero the slice between post_len and the current account len when stricter_abi_and_runtime_constraints && !account_data_direct_mapping in deserialize_parameters_aligned()."

This reverts commit 3045db332cd1de077f058c66e2a137ac7afc150d.

* Zero the slice between prev_len and post_len in update_callee_account() when stricter_abi_and_runtime_constraints && !account_data_direct_mapping.

* Rekeys stricter_abi_and_runtime_constraints and account_data_direct_mapping.

(cherry picked from commit 5785317)
@mergify mergify bot requested a review from a team as a code owner November 24, 2025 10:46
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 78.18182% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.2%. Comparing base (5665e20) to head (99951db).

Additional details and impacted files
@@            Coverage Diff            @@
##             v3.1    #9248     +/-   ##
=========================================
- Coverage    83.2%    83.2%   -0.1%     
=========================================
  Files         865      865             
  Lines      375511   375567     +56     
=========================================
+ Hits       312592   312637     +45     
- Misses      62919    62930     +11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Lichtso Lichtso merged commit 5665731 into v3.1 Nov 25, 2025
44 checks passed
@Lichtso Lichtso deleted the mergify/bp/v3.1/pr-9142 branch November 25, 2025 09:00
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.

5 participants