Commit Graph

56 Commits

Author SHA1 Message Date
behzad nouri 4ec5ea6f7b
replaces assert!(matches!(...)) with assert_matches!(...) (#33068)
assert_matches!(...) provides more informative error message when it
fails and it is part of nightly rust:
https://doc.rust-lang.org/std/assert_matches/macro.assert_matches.html
2023-08-30 13:48:27 -04:00
Pankaj Garg e036a0375d
Handle closing of the program in the same slot as deployment (#33025) 2023-08-28 09:05:49 -07:00
Pankaj Garg dbe4017143
Prune programs deployed in duplicate unconfirmed slot (#32999)
* Prune programs deployed in duplicate unconfirmed slot

* unit test
2023-08-25 11:02:20 -07:00
Alexander Meißner 29bbda0c11
General cleanup (Part 2) (#32998)
* bucket-map: remove unused `mut`

* remove unnecessary explicit `into_iter()` calls

* don't default-construct unit-structs

* prefer `or_default()` to `or_insert_with(T::default())`

* replace "slow zero-filled vec initialization"

---------

Co-authored-by: Trent Nelson <trent@solana.com>
2023-08-25 19:07:38 +02:00
Alexander Meißner 3bd14cc1e1
Fix - Reordering in second level index of LoadedPrograms (#32973)
Replaces "swap_remove" => "remove".
2023-08-24 16:41:04 +02:00
Alexander Meißner be6d6fa5ae
Refactor - `LoadedPrograms::get_entries_sorted_by_tx_usage()` (#32874)
Factor get_entries_sorted_by_tx_usage() out of sort_and_unload().
2023-08-17 19:14:32 +02:00
Pankaj Garg c17b938204
Integrate program loader-v4 with bank (#32832)
* Integrate program loader-v4 with bank

* fix tests

* new struct for ProgramRuntimeEnvironments

* remove environment from program_runtime_environment_v

* move find_program_in_cache() to invoke_context

* cleanup
2023-08-16 10:50:23 -07:00
Pankaj Garg a1a0829a8b
Initialize and store PRv2 environment in cache (#32812)
* Initialize and store PRv2 environment in cache

* address review comments
2023-08-11 18:58:22 +00:00
Andrew Fitzgerald a7eda70ddb
Preliminary Changes for Updating Cargo (#32547) 2023-07-21 13:43:00 -07:00
Pankaj Garg c86e160438
Add runtime environment to FailedVerification tombstones (#31991)
* Add runtime environment to FailedVerification tombstones

* modify default variant

* prune update

* add DelayVisibility in prune_feature_set_transition
2023-06-06 22:24:39 +00:00
Alexander Meißner 89207a3fe5
Feature - Prune on feature set transition (#31945)
* Call create_program_runtime_environment() in Bank::apply_builtin_program_feature_transitions().

* Adds LoadedPrograms::prune_feature_set_transition().
2023-06-06 17:49:02 +02:00
Pankaj Garg 1b30de4f32
Retain runtime environment config for unloaded programs (#31953)
* Retain runtime environment config for unloaded programs
2023-06-03 09:38:11 +02:00
Pankaj Garg 37ebb709e6
Evict program cache using transaction usage counter (#31927)
* Evict program cache using tx usage counter

* address review feedback

* address review feedback
2023-06-02 11:26:56 -07:00
Alexander Meißner 3792204598
Bump solana_rbpf to v0.5.0 (#31943)
* Renames RBPF BuiltIn to Builtin.

* Bump solana_rbpf to v0.5.0
2023-06-02 16:34:01 +02:00
Pankaj Garg 29d7a57cce
Reset program cache stats after submit (#31929) 2023-06-02 01:16:49 -07:00
Pankaj Garg 29904bb06b
More metrics for LoadedPrograms cache (#31735) 2023-05-22 07:53:54 -07:00
Alexander Meißner 83f692ce67
Refactor - Share RBPF config and syscall registry globally (#31727)
* Adds LoadedPrograms::program_runtime_environment_v1.

* No need to explicitly remove precompiles from program_accounts_map.
2023-05-20 20:28:00 +02:00
Pankaj Garg 8fbe471cc8
Remove special handling of builtin while pruning (#31719) 2023-05-19 09:35:48 -07:00
Pankaj Garg e6d490708a
Do not overwrite builtin program in the same slot (#31718) 2023-05-19 05:26:31 -07:00
Trent Nelson a0850a7501
runtime: rename executor cache datapoint (#31716) 2023-05-18 20:37:01 +00:00
Alexander Meißner 520c647918
Refactor - Merges `BuiltinPrograms` into `LoadedPrograms` (#31654)
* Merges BuiltinPrograms into LoadedPrograms.

* Prevents built-ins from being pruned.
2023-05-18 22:18:28 +02:00
Pankaj Garg b03422968b
Remove Rc and RefCell to carry program cache in invoke_context (#31684) 2023-05-17 06:10:50 -07:00
Alexander Meißner 5c8b5a2a68
Bump solana_rbpf to v0.4.0 (#31594)
* Moves "disable_deploy_of_alloc_free_syscall" parameter inside create_loader().

* Removes the "is_abi_v2" flag.

* Bumps solana_rbpf to v0.4.0
2023-05-12 18:07:13 +02:00
Pankaj Garg a649459fc6
LoadedPrograms::extract() code cleanup and unit tests (#31604) 2023-05-12 08:55:03 -07:00
Alexander Meißner bbd8be6cbe
Refactor - Renames loader-v3 to loader-v4. (#31570)
Renames loader-v3 to loader-v4.
2023-05-11 08:29:06 +02:00
Pankaj Garg 04425b81ce
Add stats for LoadedPrograms (#31577) 2023-05-10 12:08:55 -07:00
Pankaj Garg ab89e2cb15
Remove executor cache from the codebase (#31566) 2023-05-10 07:11:04 -07:00
Pankaj Garg 2210af60ee
Replace executor cache usage with LoadedPrograms cache (#31462)
* Replace executor cache usage with LoadedPrograms cache

* clippy fixes

* update cache with updated programs

* fixes

* more cleanup

* update tx batch cache with the tx results

* address review comments

* handle program closing backward compatibility

* handle unloaded programs during extraction
2023-05-09 15:44:38 -07:00
Pankaj Garg 3fd3e6d4e1
Use current root slot to disambiguate pruning of old programs (#31548)
* Use current root slot to unambiguate pruning of old programs

* simplify the change

* address comment
2023-05-09 11:28:56 -07:00
Pankaj Garg 3845423e17
Generalize matching criteria for tombstone at boot up (#31547)
Generalize matching criteria for tombstone at bootup
2023-05-09 08:26:42 -07:00
Pankaj Garg b20024c705
Refactor implicit handling of delay visibility tombstones (#31537) 2023-05-08 09:15:04 -07:00
Pankaj Garg d98aaf0614
Programs deployed before the latest root available on all current forks (#31530)
* Programs deployed before the latest root available on all current forks

* remove special case of slot 0
2023-05-08 07:51:32 -07:00
Pankaj Garg 9c6e7e0435
Return implicit delay visibility tombstone (#31493) 2023-05-05 06:08:57 -07:00
Pankaj Garg de43ac44fd
Allow replacing tombstone with a non-tombstone (#31494) 2023-05-04 13:56:39 -07:00
Pankaj Garg 96e170bd37
Do not evict unloaded programs (#31465)
* Do not evict unloaded programs

* cleanup
2023-05-04 07:49:54 -07:00
Alexander Meißner ae75c7cb3f
Refactoring - Remove redundant definition of `BuiltinProgram` (#31429)
* Replaces BuiltinProgram in the program-runtime with the one from solana_rbpf.

* Adjusts the runtimes built-ins to use Arc<LoadedProgram>.

* Adjusts the tests and benchmarks.
2023-05-02 23:01:28 +02:00
Pankaj Garg 8eebf64464
Add a second level cache to contain tx batch specific programs (#31413)
* Add a second level cache to contain tx batch specific programs

* fix clippy

* address review comments
2023-05-01 09:09:43 -07:00
Pankaj Garg 94dc8fed55
Check program modification slots during cold start (#31331) 2023-04-28 06:22:14 -07:00
Alexander Meißner 7002c568fb
Cleanup - Removes the CLI option "no-bpf-jit" (#31329)
* Enables JIT everywhere by default.

* Removes the CLI argument "no-bpf-jit" and its plumbering through out the validator code base.

* Removes with_jit bpf_loader variants.

* Removes the to_builtin!() macro.
2023-04-25 19:04:11 +02:00
Pankaj Garg a35e31f269
Do not evict tombstones (#31311) 2023-04-21 16:36:22 -07:00
Pankaj Garg 9629ef3095
Fix finding ancestor during program cache pruning (#31118) 2023-04-20 04:45:05 -07:00
Pankaj Garg 12e3e8b467
Add provisions to unload a program from the cache (#31036) 2023-04-10 16:42:05 -07:00
Pankaj Garg 2613ad7d70
Fix unused import error in LoadedPrograms (#31116) 2023-04-08 00:31:23 -07:00
Pankaj Garg 83e17d8e44
Add expiration slot to loaded program cache entry (#31034) 2023-04-05 09:26:28 -07:00
Alexander Meißner 24a87f33a8
Refactor - Cleanup error handling in program runtime (#30693)
* Moves stable_log::program_invoke(), stable_log::program_success() and stable_log::program_failure() calls from bpf_loader into InvokeContext::process_executable_chain().

* Turns result of ProcessInstructionWithContext from InstructionError into Box<dyn std::error::Error>.

* Bump to solana_rbpf v0.3.0

* Removes Result from return type of EbpfVm::new().

* Turns EbpfError into Box<dyn std::error::Error>.

* Removes BpfError.

* Removes SyscallError::InstructionError.

* Adds a type alias for Box<dyn std::error::Error> in syscalls.
2023-04-05 15:50:34 +02:00
Alexander Meißner a6ad37f3ad
Cleanup - `load_and_get_programs_from_cache()` (#30959)
* Replaces assign_program() by replenish() in load_and_get_programs_from_cache().

* Replaces LoadedProgramEntry by a boolean.

* Only lock the global cache once all missing programs have been loaded

* Factors out call of self.rc.accounts.filter_executable_program_accounts().
2023-03-29 16:11:14 +02:00
Pankaj Garg f198d7426a
Use feature gate to set effective slot of loaded programs (#30950) 2023-03-29 04:47:49 -07:00
Pankaj Garg aebc191c38
Stop loading program accounts if program exists in cache (#30703)
* Stop loading program accounts if program exists in cache

* load accounts for upgradeable programs

* revert loader change to conditionally use program data account

* load instruction accounts

* generate TransactionExecutorCache from loaded programs

* cleanup account_found_and_dep_index variable

* address review comments

* handle tombstones in loader

* unify tombstone constructor

* handle multiple tombstones
2023-03-28 11:49:56 -07:00
Alexander Meißner c10f337f85
Feature - Loader built-in program v3 (#30464)
* Adds loader-v3 in SDK.

* Adds loader-v3 built-in program.

* Adds tests.
2023-03-23 18:13:47 +01:00
K-anon 36d773810a
Add Executor Cache Eviction Strategy (#30526)
Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-03-06 15:07:01 -07:00