* Add simulation detection countermeasure (#22880)
* Add simulation detection countermeasures
* Add program and test using TestValidator
* Remove incinerator deposit
* Remove incinerator
* Update Cargo.lock
* Add more features to simulation bank
* Update Cargo.lock per rebase
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
(cherry picked from commit c42b80f099)
# Conflicts:
# programs/bpf/Cargo.lock
# programs/bpf/Cargo.toml
* Update Cargo.lock
Co-authored-by: Michael Vines <mvines@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* Bumps solana_rbpf to v0.2.22
* Adjusts vm::Config and feature gates.
(cherry picked from commit 96c88d1a5e)
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
* Prevent rent-paying account creation (#22292)
* Fixup typo
* Add new feature
* Add new TransactionError
* Add framework for checking account state before and after transaction processing
* Fail transactions that leave new rent-paying accounts
* Only check rent-state of writable tx accounts
* Review comments: combine process_result success behavior; log and metrics before feature activation
* Fix tests that assume rent-exempt accounts are okay
* Remove test no longer relevant
* Remove native/sysvar special case
* Move metrics submission to report legacy->legacy rent paying transitions as well
(cherry picked from commit 637e366b18)
# Conflicts:
# runtime/src/bank.rs
# runtime/src/lib.rs
* Fix conflicts and rework for TransactionRefCells
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
* optimizes ReadOnlyAccountsCache LRU eviction implementation (#22403)
ReadOnlyAccountsCache is using a background thread, table scan and sort
to implement LRU eviction policy:
https://github.com/solana-labs/solana/blob/eaa52bc93/runtime/src/read_only_accounts_cache.rs#L66-L73https://github.com/solana-labs/solana/blob/eaa52bc93/runtime/src/read_only_accounts_cache.rs#L186-L191https://github.com/solana-labs/solana/blob/eaa52bc93/runtime/src/read_only_accounts_cache.rs#L222
DashMap internally locks each shard when accessed; so a table scan in
the background thread can create a lot of lock contention.
This commit adds an index-list queue containing cached keys in the order
that they are accessed. Each hash-map entry also includes its index into
this queue.
When an item is first entered into the cache, it is added to the end of
the queue. Also each time an entry is looked up from the cache it is
moved to the end of queue. As a result, items in the queue are always
sorted in the order that they have last been accessed. When doing LRU
eviction, cache entries are evicted from the front of the queue.
Using index-list, all queue operations above are O(1) with low overhead
and so above achieves an efficient implementation of LRU cache eviction
policy.
(cherry picked from commit a49ef49f87)
# Conflicts:
# Cargo.lock
# programs/bpf/Cargo.lock
# runtime/Cargo.toml
# runtime/src/accounts_db.rs
* removes backport merge conflicts
Co-authored-by: behzad nouri <behzadnouri@gmail.com>
* move `ExecuteTimings` from `runtime::bank` to `program_runtime::timings`
(cherry picked from commit 7d32909e17)
# Conflicts:
# core/Cargo.toml
# ledger/Cargo.toml
# programs/bpf/Cargo.lock
* Add execute metrics
(cherry picked from commit b25e4a200b)
* Add metrics for executor creation
(cherry picked from commit 848b6dfbdd)
* Add helper macro for `AddAssign`ing with saturating arithmetic
(cherry picked from commit deb9344e49)
* Use saturating_add_assign macro
(cherry picked from commit 72fc6096a0)
* Consolidate process instruction execution timings to own struct
(cherry picked from commit 390ef0fbcd)
Co-authored-by: Trent Nelson <trent@solana.com>
Co-authored-by: Carl Lin <carl@solana.com>
* Update tests to demonstrate that program id account info for CPI is optional
* Clean up comments that say that program id account info is required
(cherry picked from commit ec7536faf6)
Co-authored-by: Justin Starry <justin@solana.com>