Skip to content

Conversation

@brooksprumo
Copy link

@brooksprumo brooksprumo commented Dec 3, 2025

Problem

Bank::replace_program_account() is dead code.

OLD:

When replacing a program via Bank::replace_program_account(), it incorrectly updates the accounts data size.

The fn basically overwrites the old account with the new account. Initially both accounts exist, and afterwards only the new account exists (just now at the old address). So the change in accounts data size is the removal of the old account.

Summary of Changes

Remove it.

@brooksprumo brooksprumo self-assigned this Dec 3, 2025
@brooksprumo brooksprumo force-pushed the accounts-data-size/replace-program-account branch 2 times, most recently from 33224fc to a70ae9e Compare December 3, 2025 16:38
@brooksprumo brooksprumo marked this pull request as ready for review December 3, 2025 17:05
@brooksprumo
Copy link
Author

@buffalojoec - requesting your review because git blame tells me you're the (potential) author.
@igor56D - requesting your review as someone looking into the accounts data size stuff.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.5%. Comparing base (7fa607c) to head (029fef6).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #9396     +/-   ##
=========================================
- Coverage    82.5%    82.5%   -0.1%     
=========================================
  Files         895      895             
  Lines      322472   322425     -47     
=========================================
- Hits       266223   266163     -60     
- Misses      56249    56262     +13     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Yeah, this looks correct to me!

I'm pretty sure we can actually axe this code. I was talking to @Lichtso yesterday and he said this is no longer a safe operation for Loader v2 programs due to the global program cache architecture.

EDIT: I guess I can approve if we plan to keep it, otherwise we can just cut it here.

@Lichtso
Copy link

Lichtso commented Dec 4, 2025

The function is dead_code from two years ago, just delete it.

@brooksprumo brooksprumo force-pushed the accounts-data-size/replace-program-account branch from a70ae9e to 029fef6 Compare December 4, 2025 21:39
@brooksprumo brooksprumo changed the title Fixes accounts_data_size update in replace_program_account() Removes Bank::replace_program_account() Dec 4, 2025
@brooksprumo brooksprumo added this pull request to the merge queue Dec 4, 2025
Merged via the queue into anza-xyz:master with commit e9052f0 Dec 4, 2025
47 checks passed
@brooksprumo brooksprumo deleted the accounts-data-size/replace-program-account branch December 4, 2025 23:46
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.

4 participants