Skip to content

test-validator: add --max-genesis-archive-size flag #7316

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

2501babe
Copy link
Member

@2501babe 2501babe commented Aug 5, 2025

Problem

solana-test-validator is broken in 3.0, at least on typical consumer machines. normal validators have a maximum archive size of 10Mib (MAX_GENESIS_ARCHIVE_UNPACKED_SIZE) but test validators allow it to be u64::MAX. there were some recent changes to how accounts-db memory allocation works where it appears to require that the maximum value be allocated up front. it attempts to adjust the maximum memory locks that can be taken based on this value. this means running the test validator does this:

cargo run --bin solana-test-validator -- -r
   Compiling agave-validator v3.0.0 (/home/hana/work/solana/agave/validator)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 14.26s
     Running `target/debug/solana-test-validator -r`
Ledger location: test-ledger
Log: test-ledger/validator.log
Error: failed to start validator: Failed to create ledger at test-ledger: io error: Error checking to unpack genesis archive: IO error: unable to set memory lock limit

Summary of Changes

use the default value that real validators use, and add a new flag to increase the value if desired. this seems philosophically more correct to me than setting a higher value, because we woudl like the test validator to behave in-line with real validators when practical

@2501babe 2501babe self-assigned this Aug 5, 2025
Comment on lines -402 to +403
genesis.max_genesis_archive_unpacked_size = Some(u64::MAX);
genesis.max_genesis_archive_unpacked_size =
value_t!(matches, "max_genesis_archive_size", u64).ok();
Copy link
Member Author

Choose a reason for hiding this comment

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

when this is None, in test-validator/src/lib.rs we fall back like so:

    971                 let _ = create_new_ledger(
    972                     ledger_path,                   
    973                     &genesis_config,                                 
    974                     config                            
    975                         .max_genesis_archive_unpacked_size                     
    976                         .unwrap_or(MAX_GENESIS_ARCHIVE_UNPACKED_SIZE),                                  
    977                     LedgerColumnOptions::default(),                                              
    978                 )

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.8%. Comparing base (1c9366c) to head (e1e81e1).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #7316     +/-   ##
=========================================
- Coverage    82.8%    82.8%   -0.1%     
=========================================
  Files         801      801             
  Lines      363392   363405     +13     
=========================================
+ Hits       300960   300969      +9     
- Misses      62432    62436      +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants