Skip to content

refactor: remove dead code, duplication and needless allocations - #448

Merged
Aursen merged 1 commit into
masterfrom
Aursen/rust-deslop
Oct 27, 2026
Merged

Aursen merged 1 commit into
masterfrom
Aursen/rust-deslop

Conversation

@Aursen

@Aursen Aursen commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Behavior-preserving cleanup across litesvm, persistence, token, loader and cpi-tree (−333 lines). The main change is the transaction pipeline:

 send_transaction / simulate_transaction
-  execute_transaction | execute_transaction_no_verify
-  execute_transaction_readonly | execute_transaction_no_verify_readonly
-    map_sanitize_result(sanitize_transaction[_no_verify][_inner])
-      execute_sanitized_transaction[_readonly]
-        check_and_process_transaction -> CheckAndProcessTransactionSuccess{Core}
-          process_transaction -> 6-tuple
+  sanitize_transaction(tx, self.sigverify)
+    check_and_process_transaction -> (ExecutionResult, payer)   // send_transaction then charges the fee
+      process_transaction -> ProcessedTransaction

Also: AccountsDb::load_program and try_program_elf_bytes share one ELF-extraction helper, the clock sysvar reuses handle_sysvar, and clones made only to read account metadata are now borrows.

Evidence

  • Before: 167 tests pass, clippy clean.
    After: 167 tests pass, cargo clippy --all-features --all-targets and cargo +nightly fmt --check clean, and the crate builds with default features.
  • Benches (simple_bench, max_perf, set_clock) show no difference beyond run-to-run noise. Two runs of the same code drifted by up to 5.5%.

Merge Danger

Door: two-way

Pure refactor, reverting is trivial.

Blast Radius: low

Things you might notice:

  • Some log::error! messages in accounts_db are worded differently.
  • persistence::save_to_file now serializes before it opens the file, so a failed serialization no longer leaves an empty file behind.

Collapse the transaction execution wrappers into one sanitize and one
check-and-process path, share program ELF extraction in AccountsDb, and
drop clones that only existed to read account metadata.
@Aursen
Aursen merged commit 4d86dec into master Oct 27, 2026
23 checks passed
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.

1 participant