Skip to content

Commit 54abc26

Browse files
committed
Pull in latest agave-v3.0.3 commits into agave-v3.1.0-beta.0 (#396)
* bump protosol crate version in gen cargo script (#390) * README: Include note on local Agave setup (#391) * elf: move to flatbuffers (#392) * elf: fix conversion script (#394) --------- Co-authored-by: ravyu-jump <[email protected]> Co-authored-by: mjain-jump <[email protected]> README: Include note on local Agave setup (#391) elf: move to flatbuffers (#392) elf: fix conversion script (#394) Agave v3.1 bump PR comments round one Add extra variable hint PR feedback adjust cargo toml to pull in dev feature add back tracing syscalls: fix mapping with custom memory module (#393) Agave v3.1 bump PR comments round one Add extra variable hint PR feedback adjust cargo toml to pull in dev feature add back tracing syscalls: fix mapping with custom memory module (#393) bump protosol crate version in gen cargo script (#390) README: Include note on local Agave setup (#391) Pull in latest agave-v3.0.3 commits into agave-v3.1.0-beta.0 (#396) * bump protosol crate version in gen cargo script (#390) * README: Include note on local Agave setup (#391) * elf: move to flatbuffers (#392) * elf: fix conversion script (#394) --------- Co-authored-by: ravyu-jump <[email protected]> Co-authored-by: mjain-jump <[email protected]> README: Include note on local Agave setup (#391) elf: move to flatbuffers (#392) elf: fix conversion script (#394) Agave v3.1 bump PR comments round one Add extra variable hint PR feedback adjust cargo toml to pull in dev feature add back tracing syscalls: fix mapping with custom memory module (#393) Agave v3.1 bump PR comments round one Add extra variable hint PR feedback adjust cargo toml to pull in dev feature add back tracing syscalls: fix mapping with custom memory module (#393) bump protosol crate version in gen cargo script (#390) README: Include note on local Agave setup (#391)
1 parent 7085b8c commit 54abc26

File tree

13 files changed

+2079
-1547
lines changed

13 files changed

+2079
-1547
lines changed

Cargo.lock

Lines changed: 1505 additions & 1198 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 202 additions & 193 deletions
Large diffs are not rendered by default.

docker

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

5-
docker build --platform=linux/amd64 -t agave-v3.0.3-patches .
6-
docker run -it -v $DIR:/app -w /app agave-v3.0.3-patches
5+
docker build --platform=linux/amd64 -t agave-v3.1.0-beta.0-patches .
6+
docker run -it -v $DIR:/app -w /app agave-v3.1.0-beta.0-patches

scripts/generate_cargo.py

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,22 @@
2424
def replace_path_with_git_rev(toml_data, git_url, rev):
2525
"""
2626
Recursively process the TOML data to replace path with git and rev,
27-
while keeping all other lines intact.
27+
while preserving all other fields including features.
2828
"""
2929
if isinstance(toml_data, dict):
3030
for key, value in list(toml_data.items()):
3131
if isinstance(value, dict):
3232
if "path" in value:
33-
# Replace path with git and rev
33+
# Replace path with git and rev, preserve other fields
3434
new_table = inline_table()
3535
new_table["git"] = git_url
3636
new_table["rev"] = rev
37+
# Preserve version if present
38+
if "version" in value:
39+
new_table["version"] = value["version"]
40+
# Preserve features as-is (don't add or modify)
41+
if "features" in value:
42+
new_table["features"] = value["features"]
3743
toml_data[key] = new_table
3844
else:
3945
replace_path_with_git_rev(value, git_url, rev)
@@ -46,16 +52,22 @@ def replace_path_with_git_rev(toml_data, git_url, rev):
4652

4753
def replace_path_with_local(toml_data, local_path):
4854
"""
49-
Recursively process the TOML data to replace path with git and rev,
50-
while keeping all other lines intact.
55+
Recursively process the TOML data to replace path with local path,
56+
while preserving all other fields including features.
5157
"""
5258
if isinstance(toml_data, dict):
5359
for key, value in list(toml_data.items()):
5460
if isinstance(value, dict):
5561
if "path" in value:
56-
# Replace path with local path
62+
# Replace path with local path, preserve other fields
5763
new_table = inline_table()
5864
new_table["path"] = os.path.join(local_path, value["path"])
65+
# Preserve version if present
66+
if "version" in value:
67+
new_table["version"] = value["version"]
68+
# Preserve features as-is (don't add or modify)
69+
if "features" in value:
70+
new_table["features"] = value["features"]
5971
toml_data[key] = new_table
6072
else:
6173
replace_path_with_local(value, local_path)
@@ -283,7 +295,33 @@ def main():
283295
if hasattr(values, 'items'):
284296
# It's a dictionary/table
285297
for k, v in values.items():
286-
toml_data[section][k] = v
298+
# Special handling for dependencies section: merge features
299+
if section == "dependencies" and k in toml_data[section]:
300+
existing_dep = toml_data[section][k]
301+
# If both are dicts (dependency specs), merge them
302+
if isinstance(existing_dep, dict) and isinstance(v, dict):
303+
# Preserve path/git/version from existing
304+
merged_dep = inline_table()
305+
for key in ["path", "git", "rev", "version"]:
306+
if key in existing_dep:
307+
merged_dep[key] = existing_dep[key]
308+
# Merge features from both
309+
merged_features = []
310+
if "features" in existing_dep:
311+
merged_features.extend(existing_dep["features"])
312+
if "features" in v:
313+
for feat in v["features"]:
314+
if feat not in merged_features:
315+
merged_features.append(feat)
316+
if merged_features:
317+
merged_dep["features"] = merged_features
318+
toml_data[section][k] = merged_dep
319+
else:
320+
# Not both dicts, just use the solfuzz_agave.toml value
321+
toml_data[section][k] = v
322+
else:
323+
# Not a dependency or not present in existing, just assign
324+
toml_data[section][k] = v
287325
else:
288326
# It's likely an Array of Tables or other non-dict type
289327
# Assign the entire values object directly
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f09a63f6b309e3d1407744d7f752874ab8bd5da4
1+
9bb89344a4dc427614fb3084946176170ea5313a

solfuzz_agave.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ lazy_static = "1.5.0"
1515
home = "0.5.11"
1616
flatbuffers = "25.9.23"
1717

18+
# Enable dev-context-only-utils for Agave dependencies that need it
19+
solana-runtime = { features = ["dev-context-only-utils"] }
20+
solana-accounts-db = { features = ["dev-context-only-utils"] }
21+
solana-svm = { features = ["dev-context-only-utils"] }
22+
solana-runtime-transaction = { features = ["dev-context-only-utils"] }
23+
solana-vote = { features = ["dev-context-only-utils"] }
24+
solana-transaction-context = { features = ["dev-context-only-utils"] }
25+
solana-vote-program = { features = ["dev-context-only-utils"] }
26+
solana-compute-budget-instruction = { features = ["dev-context-only-utils"] }
27+
solana-core = { features = ["dev-context-only-utils"] }
28+
solana-ledger = { features = ["dev-context-only-utils"] }
29+
solana-perf = { features = ["dev-context-only-utils"] }
30+
1831
[lib]
1932
crate-type = ["cdylib", "rlib"]
2033

src/block.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -405,23 +405,23 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
405405
ancestors.insert(current_slot.saturating_sub(1), 1);
406406
ancestors.insert(current_slot, 1);
407407

408-
/* Accounts DB config and initialization */
408+
/* Accounts DB config and initialization. Agave v3.1 uses a new Accounts
409+
interface, which is not compatible with the old one. */
409410
let index = Some(AccountsIndexConfig {
410411
bins: Some(2),
411412
num_flush_threads: Some(NonZeroUsize::new(1).unwrap()),
412413
index_limit_mb: IndexLimitMb::InMemOnly,
413414
..AccountsIndexConfig::default()
414415
});
415-
let accounts_db_config = Some(AccountsDbConfig {
416+
let accounts_db_config = AccountsDbConfig {
416417
index,
417418
storage_access: StorageAccess::File,
418419
skip_initial_hash_calc: true,
419-
num_hash_threads: Some(NonZeroUsize::new(1).unwrap()),
420420
..AccountsDbConfig::default()
421-
});
421+
};
422422
let accounts_db = AccountsDb::new_with_config(
423423
vec![],
424-
accounts_db_config,
424+
accounts_db_config.clone(),
425425
None,
426426
Arc::new(AtomicBool::new(false)),
427427
);
@@ -435,10 +435,16 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
435435
(pubkey, account_data)
436436
})
437437
.collect::<Vec<_>>();
438-
accounts.store_accounts_seq(
439-
(current_slot.saturating_sub(1), &accounts_to_store[..]),
440-
None,
441-
);
438+
439+
let storage_slot = slot_ctx.prev_slot;
440+
accounts.store_accounts_seq((storage_slot, &accounts_to_store[..]), None);
441+
// Add the root slot to the accounts DB
442+
// Now needed when calling Bank::new_from_snapshot() in Agave v3.1
443+
accounts.accounts_db.add_root(storage_slot);
444+
let accounts_data_size_initial: u64 = accounts_to_store
445+
.iter()
446+
.map(|(_, account)| account.data().len() as u64)
447+
.sum();
442448

443449
/* Build the stakes separately */
444450
let current_epoch = epoch_schedule.get_epoch(current_slot);
@@ -543,23 +549,19 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
543549
};
544550

545551
let bank_rc = BankRc::new(accounts);
546-
let mut bank = Bank::new_from_fields(
552+
let mut bank = Bank::new_from_snapshot(
547553
bank_rc,
548554
&genesis_config,
549555
Arc::new(RuntimeConfig::default()),
550556
bank_fields,
551557
None,
552-
None,
553-
false,
554-
0,
558+
accounts_data_size_initial, // precomputed above
555559
Some(feature_set),
556560
);
557561

558-
// Seed initial accounts into the bank
559-
for account in &context.acct_states {
560-
let pubkey = Pubkey::new_from_array(account.address.clone().try_into().unwrap());
561-
let account_data = AccountSharedData::from(account);
562-
bank.store_account(&pubkey, &account_data);
562+
// Store the accounts in the bank using the new interface.
563+
for (pubkey, account_data) in &accounts_to_store {
564+
bank.store_account(pubkey, account_data);
563565
}
564566

565567
let leader_schedule = LeaderScheduleCache::new_from_bank(&bank);
@@ -581,6 +583,7 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
581583
bank.distribute_partitioned_epoch_rewards();
582584

583585
bank.get_transaction_processor().reset_sysvar_cache();
586+
584587
bank.update_slot_hashes();
585588
bank.update_stake_history(Some(parent_epoch));
586589
bank.update_clock(Some(parent_epoch));

src/elf_loader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ pub fn load_elf(
1818
let feature_set = FeatureSet::from(features.unwrap_or(&proto::FeatureSet::default()));
1919
let program_runtime_environment_v1 = create_program_runtime_environment_v1(
2020
&feature_set.runtime_features(),
21-
&SVMTransactionExecutionBudget::default(),
21+
&SVMTransactionExecutionBudget::new_with_defaults(
22+
feature_set.runtime_features().raise_cpi_nesting_limit_to_8, // simd_0268_active
23+
),
2224
deploy_checks,
2325
std::env::var("ENABLE_VM_TRACING").is_ok(),
2426
)

0 commit comments

Comments
 (0)