Commit Graph

393 Commits

Author SHA1 Message Date
Alexander Meißner d448c4e5f0
Fix - `ProgramCache::assign_program()` Closed => Loaded in same slot (#673)
* Refactors test_add_builtin() to use LoadedProgram::new_builtin() and ProgramCache::extract().

* Revert Closed => Loaded transition

* Adds more loaded programs deployment tests
2024-04-12 14:59:51 +02:00
Kevin Heavey e04dbaa305
move ThreadExecuteTimings to solana-ledger (#690)
* move ThreadExecuteTimings to solana-ledger
* run cargo-for-all-lock-files tree
* move ThreadExecuteTimings below BatchExecutionTiming
* remove ReplaySlotStats to solana-ledger
* remove  `#![recursion_limit = "2048"]` from program-runtime
2024-04-11 17:59:16 +02:00
Joe C 03ef611f0c
program-runtime: hoist `RuntimeConfig` up to SVM (#630)
program-runtime: hoist `RuntimeConfig` out into SVM
2024-04-07 10:45:57 -05:00
Alexander Meißner 55c05c5ea5
Fix - `FailedVerification` and `Closed` tombstones (#419)
* Only the verifier can cause FailedVerification, everything else is Closed

* Removes the environments parameter from load_program_accounts().

* cargo fmt

* Simplify invocation of deployed program

* Attempt to invoke a program before it is deployed

* Attempt to invoke a buffer before it is used in a deployment

* Escalates Option return value of load_program_accounts() to load_program_with_pubkey().

* Review feedback
2024-04-05 13:03:18 +02:00
Joe C 526979d589
program-runtime: hoist `MessageProcessor` up to SVM (#586) 2024-04-04 18:20:01 -05:00
Andrew Fitzgerald 65f54bec88
Add ProgramCacheUs to execute timings (#473) 2024-04-02 10:03:55 -05:00
Illia Bobyr 8cb7000973
loaded-programs: Use `Measure::end_as_us()` (#81)
It is a bit nicer API, compared to the `stop()/as_us()` pair.  Does not require the value to be `mut`.
2024-04-02 06:31:24 -07:00
Joe C 005c1375f8
Program Runtime: Refactor `InvokeContext` out of `MessageProcessor::process_message` (#509) 2024-04-02 05:06:13 -05:00
Pankaj Garg 91b1ee3df6
Fix: deploy program on last slot of epoch during environment change (#101)
* Fix: deploy program on last slot of epoch during environment change

* solana-runtime: deploy at last epoch slot test

* disable deployment of sol_alloc_free

* Move tx-batch-constructor to its own function

* use new_from_cache

---------

Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
2024-03-22 07:43:28 -07:00
Dmitri Makarov 09ae5872b3
Rename LoadedPrograms to ProgramCache for readability (#339) 2024-03-20 15:26:45 -04:00
HaoranYi 0f8f8cd970
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 10:54:15 -05:00
Brennan 81075e60b3
Loaded program test robustness (#59)
* tests robust to prog entry count
2024-03-13 08:21:54 -07:00
Dmitri Makarov ba43f74dcf
[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-07 10:16:16 -08:00
Brennan 184b31c6b7
fix typo (#57) 2024-03-06 14:03:25 -08: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