Commit Graph

64 Commits

Author SHA1 Message Date
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
Alexander Meißner a3f85aba21
Refactor - LoadedPrograms part 2 (#33694) 2023-10-13 12:59:48 -07:00
Alexander Meißner 8033be333e
Refactor - `LoadedPrograms` (#33482)
* Adds type ProgramRuntimeEnvironment.

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

* Adds Stats::prunes_environment and renames Stats::prunes_orphan and Stats::prunes_expired.

* Adds LoadedPrograms::latest_root_epoch.

* Typo fix, authored-by: Dmitri Makarov <dmakarov@users.noreply.github.com>
2023-10-02 19:01:23 +02:00
Pankaj Garg 5562f79cc5
Do not unnecessarily re-verify unloaded program (#32722)
* Do not unnecessarily re-verify unloaded program

* clippy fixes

* new unit test for extract

* fixes after rebase

* fixes after rebase

* address review comments

* fix clippy
2023-09-13 06:25:56 -07:00
Alexander Meißner 424666e341
Bump solana_rbpf to v0.7.0 (#33104)
* Upgrades RBPF in Cargo.toml

* Adjustments to updated interfaces.
2023-09-06 10:54:15 +02:00
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