Commit Graph

384 Commits

Author SHA1 Message Date
Dmitri Makarov 1d89ea01cc Rename LoadedPrograms to ProgramCache for readability (#339) 2024-03-20 16:28:38 -05:00
HaoranYi 304333405c Revert deprecate executable feature (#309)
* revert deprecate executable feature

* add native loader account transfer test

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-03-20 16:28:38 -05:00
Brennan 5ab9808a9e Loaded program test robustness (#59)
* tests robust to prog entry count
2024-03-15 22:25:14 -05:00
Dmitri Makarov 264f4dfdd0 [SVM] Move RuntimeConfig to program-runtime (#96)
RuntimeConfig doesn't use anything SVM specific and logically belongs
in program runtime rather than SVM.  This change moves the definition
of RuntimeConfig struct from the SVM crate to program-runtime and
adjusts `use` statements accordingly.
2024-03-09 13:27:11 -06:00
Brennan 54b44a382f fix typo (#57) 2024-03-09 13:26:34 -06:00
Alexander Meißner ccc6a6bf6f
Fix - `test_feature_activation_loaded_programs_recompilation_phase()` (#35299)
* Fixes test_feature_activation_loaded_programs_recompilation_phase() to trigger the recompilation phase before the epoch boundary.

* Adds a direct check of the cached entries around recompilation.
2024-03-02 06:55:53 -08:00
Pankaj Garg 990ca1d0b8
Add limit to looping in banking-stage (#35342) 2024-02-28 17:36:45 -08:00
Justin Starry 312f786abf
Rename `SanitizedMessage::try_from` to `try_from_legacy_message` (#35338)
* Simplify and refactor tx message creation in tests

* Rename SanitizedMessage::try_from to try_from_legacy_message
2024-02-29 08:25:22 +08:00
Alexander Meißner e6f8cdce01
Refactor - `LoadedPrograms::assign_program()` (#35233)
* Forbids all program replacements except for reloads and builtins.

* Adds test_assign_program_failure() and test_assign_program_success().

* Explicitly disallows LoadedProgramType::DelayVisibility to be inserted in the global cache.
2024-02-28 09:20:11 +01:00
Illia Bobyr c98ff7a6da
loaded-programs: Remove unnecessary `allow(unused_mut)` (#35284)
Only the `executable` might need to be mutable.  This
`allow(unused_mut)` is probably a leftover from a previous version.
2024-02-22 12:11:00 -08:00
Alexander Meißner 1752202169
Refactor - Adds check that only loaded programs can be unloaded (#35146)
* Adds check that only loaded programs can be unloaded.

* Removes unused code.

* Adds test_unloaded().
2024-02-14 17:28:58 +01:00
Ryo Onodera 4b77ee5a1c
Report lost_insertions metrics correctly (#35191) 2024-02-14 21:27:52 +09:00
Alexander Meißner 716ad5441b
Refactor - `LoadedPrograms::replenish()` (#35145)
* Replace LoadedPrograms::replenish() with LoadedPrograms::assign_program().

* Removes LoadedPrograms::replenish().

* Defines replacement by having the same loaded program type.

* Implements a proper insertion sort with a two key comparison operator.
2024-02-14 12:13:53 +01:00
Alexander Meißner 070a5a36b8
Cleanup - Removes `LoadedProgram::maybe_expiration_slot` (#35023)
Removes LoadedProgram::maybe_expiration_slot.
2024-02-07 01:38:21 +00:00
Andrew Fitzgerald 9dca15a5b7
Rename priority to compute_unit_price (#35062)
* rename several priorities to compute_unit_price

* TransactionPriorityDetails -> ComputeBudgetDetails

* prioritization_fee_cache: fix comment

* transaction_state: fix comments and variable names

* immutable_deserialized_packet: fix comment
2024-02-05 16:41:01 -08:00
Pankaj Garg bf95f65ce1
Fix: decayed_counter can overflow if shifted more than 63 (#35054) 2024-02-02 10:10:43 -08:00
Alexander Meißner 5dd9609aea
Fix - LoadedPrograms statistics (#35026)
Fixes hits, misses.
Adds reloads, lost_insertions.
Removes prunes_expired.
2024-02-02 13:35:36 +01:00
Alexander Meißner 2c98399afd
Docs - for loaded_programs.rs (#34715)
Adds doc comments to loaded_programs.rs
2024-01-25 18:02:38 +01:00
Tao Zhu 51eaa2b9cc
cleanup feature code after activation (#34695)
cleanup feature checking code
2024-01-12 14:28:50 -06:00
Brooks e9a6bb35e2
Removes remaining unused accounts data len bits (#34732) 2024-01-10 18:16:56 -05:00
Brooks fb35552f5b
Removes AccountsDataMeter (#34727) 2024-01-10 15:07:14 -05:00
Brooks dc5af2c615
Removes AccountsDataMeter from InvokeContext (#34698) 2024-01-10 12:36:29 -05:00
Brooks 58432a6c69
checks: Removes unnecessary braces (#34681) 2024-01-08 07:13:15 -05:00
HaoranYi 5a3a10e847
Deprecate account meta executable read/update in bpf loaders (#34194)
* use PROGRAM_OWNER + program data for account executable

mock account data with executable_meta in precompiled program and update
test_bank_hash_consistency test

pr: return const slice and add comments

pr: use ReadableAccount

use const to get rid of magic number

add featuregate disable_bpf_loader_instructions to disable bpf loader management instructions, and deprecate_executable_meta_update_in_bpf_loader to deprecate executable flag update in bpf loader

deprecate usage of executable in Account

fix a test

fix sbp bench

fix sbf program tests

add feature gate to account and borrowed account apis

fix tests

more test fixes

* restore bpf_loader v2 tests

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-01-03 15:11:48 -06:00
Nick Frostbutter fc2a8794be
[docs] updated readme and fix links (#34565)
* feat: updated readme

* fix: updated links

* fix: proposal links

* fix: more links

* fix: json-rpc links

* fix: more links

* fix: zk links

* fix: managing forks

* fix: links for deprecated methods
2024-01-03 09:06:06 -05:00
HaoranYi 531d69fd10
pass feature_set to BorrowedAccount (#34542)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-12-21 20:03:17 +01:00
Pankaj Garg 6f0133bd43
Improve cache eviction policy for LoadedPrograms (#34391)
* Use 2's random selection to evict program cache

* implement decaying of usage counter

* replace RwLock with AtomicU64

* address review comments

* remove -> swap_remove
2023-12-18 14:51:36 -08:00
Alexander Meißner 22bfcd92e0
Feature - Cooperative Program Loading (#34407)
* Disables verification-less reloading.

* Refactors LoadedPrograms::extract() to use a mutable parameter instead of returning the list of missing entries.

* Refactors LoadedPrograms::extract() to use a mutable parameter instead of returning a LoadedProgramsForTxBatch.

* Adds explicit SecondLevel structure to LoadedPrograms.

* Adds cooperative_loading_task.

* Implements cooperative loading in the bank.

* Fixes fork graph in tests.

* Adds LoadingTaskWaiter.

* Environment mismatch needs to just skip the entry.
2023-12-18 16:24:50 +01:00
Tao Zhu 86c88d7ff6
Remove feature set from compute budget processor (#34472)
remove feature_set from compute_budget_processor
2023-12-15 15:01:02 -06:00
Tao Zhu f214a8220f
cleanup feature code after mainnet-beta activation (#34208)
* cleanup feature code after mainnet-beta activation
* rebase then cleanup references to activated feature
2023-12-15 13:14:51 -06:00
Pankaj Garg 47dab26857
Set root slot/epoch in cache constructor (#34447) 2023-12-14 11:49:36 +01:00
Tao Zhu 39f2866a10
cleanup feature code after mainnet-beta activation (#34289)
* cleanup feature code after mainnet-beta activation
* add comment for reserved enum
2023-12-12 18:06:49 -06:00
Lucas Steuernagel 4b762320cb
Remove WorkingSlot (#34342)
* Remove WorkingSlot
2023-12-11 16:02:53 -03:00
Jon Cinque cfb16ab76a
sdk: Upgrade to borsh 1.2.1 (#34355)
* sdk: Update to borsh 1, revert borsh 0.9 / 0.10

* Restore borsh 0.10 and 0.9 support

* Update sbf lockfile

* Add borsh 0.10 implementations for stake types

* Fix weirdness on whitespace

* Update to borsh 1.2.1

* Update changelog

* compute-budget: Move `pack` under dev-context-only-utils

* Revert test to use HashMap

* transaction-status: Add comment about borsh version
2023-12-08 13:18:10 +01:00
Alexander Meißner cf0c52c207
Cleanup - program runtime (#34318)
* Removes retain() from prune_by_deployment_slot() as that is covered in remove_programs_with_no_entries() already.

* Removes remove_programs_with_no_entries() from sort_and_unload().

* Fixes ix_usage_counter in LoadedProgram::to_unloaded().

* Fixes doc comment of LoadedProgram::ix_usage_counter.

* Removes unused num_total_programs from test_eviction().

* Replaces .as_ref() in lambda with std::option::Option::as_ref.

* Replaces .for_each() with a for-loop.

* Uses .retain() instead of iter().filter().cloned().collect().
2023-12-06 22:05:26 +01:00
Lucas Steuernagel 1877fdb273
Use BankForks on tests - Part 4 (#34271)
* Use BankForks on tests - Part 4

* Ensure the correct slot is set
2023-12-06 13:32:04 -03:00
Alexander Meißner f70d5481bc
Fix - Uses `fetch_add()` to accumulate usage counters in `LoadedPrograms` (#34319)
Uses fetch_add() to accumulate usage counters.
2023-12-05 23:21:06 +01:00
Alexander Meißner 4ee5078e5f
Refactor - `ExtractedPrograms` (#34205)
* Puts ExtractedPrograms into Arc<Mutex<>>.

* Merges ExtractedPrograms::missing and ExtractedPrograms::unloaded.

* Unifies missing entry insertion in LoadedPrograms::extract().
2023-11-23 09:17:21 +01:00
Alexander Meißner c0a4fc870c
Fix - Removes redundant `TotalBatchesLen` from `ThreadExecuteTimings::accumulate()` (#34179)
Removes redundant TotalBatchesLen from ThreadExecuteTimings::accumulate().
2023-11-20 19:21:01 +01:00
Pankaj Garg 3368579eff
Do not prune cache entry if the runtime environment is different (#34100) 2023-11-18 22:00:51 +01:00
Alexander Meißner b168cadeea
Cleanup - Feature gate of `check_slice_translation_size` (#34084)
Cleans up feature gate of check_slice_translation_size.
2023-11-15 20:58:10 +01:00
Alexander Meißner ffa462dd3a
Cleanup - Feature gate of `delay_visibility_of_program_deployment` (#34087)
* Cleans up feature gate of delay_visibility_of_program_deployment.

* Removes programs_updated_only_for_global_cache.
2023-11-15 18:29:31 +01:00
Brooks 725ab37bf4
clippy: Replaces .get(0) with .first() (#34048) 2023-11-13 17:22:17 -05:00
Alexander Meißner a9509f56b7
Feature - Epoch boundary recompilation phase (#33477)
* Adds LoadedPrograms::upcoming_environments.

* Moves LoadedPrograms::prune_feature_set_transition() into LoadedPrograms::prune().

* Adds parameter recompile to Bank::load_program().

* Sets latest_root_slot/epoch and environments in Bank::finish_init().

* Removes FEATURES_AFFECTING_RBPF list.

* Adjusts test_feature_activation_loaded_programs_recompilation_phase().
2023-11-09 13:10:59 +01:00
Tao Zhu 510b6b949f
Split compute budget instructions process from struct (#33852)
* Split compute budget instruction processing from ComputeBudget struct itself, so CB instructions can be processed elsewhere without involving ComputeBudget

* updated tests

* avoid built ComputeBudget from dated ComputeBudgetLimits in this refactoring PR

* Clean-up program-runtime/src/compute_budget_processor.rs

* Add test for a corner case that deprecated instruction is used to request units greater than max limit;
* Update code to handle the corner case.
2023-10-26 22:12:56 -05:00
Pankaj Garg 78c31aa6b8
Use program cache fork graph in extract() (#33806)
* Use program cache fork graph instead of WorkingSlot trait

* Fix deadlocked tests

* keep WorkingSlot trait for now
2023-10-25 06:04:38 -07:00
Pankaj Garg 9d42cd7efe
Initialize fork graph in program cache during bank_forks creation (#33810)
* Initialize fork graph in program cache during bank_forks creation

* rename BankForks::new to BankForks::new_rw_arc

* fix compilation

* no need to set fork_graph on insert()

* fix partition tests
2023-10-23 09:32:41 -07:00
Pankaj Garg abf3b3e527
Custom debug impl for LoadedPrograms cache (#33808) 2023-10-22 05:51:14 -07:00
Alexander Meißner a5c7c999e2
Bump solana_rbpf to v0.8.0 (#33679)
* Bumps solana_rbpf to v0.8.0

* Adjustments:
Replaces declare_syscall!() with declare_builtin_function!().
Removes Config::encrypt_runtime_environment.
Simplifies error propagation.
2023-10-20 21:39:50 +02:00
Pankaj Garg 59cb3b57ee
Set a global fork graph in program cache (#33776)
* Set a global fork graph in program cache

* fix deadlock

* review feedback
2023-10-20 08:47:03 -07:00