stake-program: `MoveStake` and `MoveLamports` (#1415)
implement two new instructions for moving delegated stake and undelegated lamports, respectively, between accounts with the same Authorized and Lockup using the Staker authority
(cherry picked from commit 361ade4439)
Co-authored-by: hana <81144685+2501babe@users.noreply.github.com>
blockstore: only consume duplicate proofs from root_slot + 1 on startup (#1971)
* blockstore: only consume duplicate proofs from root_slot + 1 on startup
* pr feedback: update test comments
* pr feedback: add pub behind dcou for test fns
(cherry picked from commit 2a48564b59)
Co-authored-by: Ashwin Sekar <ashwin@anza.xyz>
Clean up disable_fees_sysvar feature (#2003)
* Clean up disable_fees_sysvar
* Remove bank fees test
* Remove unused rpc response types
* Fixup sysvar_cache tests
* Remove fees-sysvar from bootstrap_validator_stake_lamports; no longer included
* Update account counts, since fees no longer touched
* Update bank hashes in test, since fees sysvar is not populated
* Remove test case passing fees sysvar as account
(cherry picked from commit 1c34908d03)
Co-authored-by: Tyera <tyera@anza.xyz>
* Refactor and additional metrics for cost tracking (#1888)
* Refactor and add metrics:
- Combine remove_* and update_* functions to reduce locking on cost-tracker and iteration.
- Add method to calculate executed transaction cost by directly using actual execution cost and loaded accounts size;
- Wireup histogram to report loaded accounts size;
- Report time of block limits checking;
- Move account counters from ExecuteDetailsTimings to ExecuteAccountsDetails;
* Move committed transactions adjustment into its own function
(cherry picked from commit c3fadacf69)
* rename cost_tracker.account_data_size to better describe its purpose is to tracker per-block new account allocation
---------
Co-authored-by: Tao Zhu <82401714+tao-stones@users.noreply.github.com>
Co-authored-by: Tao Zhu <tao@solana.com>
* Rename ComputeBudget::max_invoke_stack_height to max_instruction_stack_depth
The new name is consistent with the existing
ComputeBudget::max_instruction_trace_length.
Also expose compute_budget:MAX_INSTRUCTION_DEPTH.
* bpf_loader: use an explicit thread-local pool for stack and heap memory
Use a fixed thread-local pool to hold stack and heap memory. This
mitigates the long standing issue of jemalloc causing TLB shootdowns to
serve such frequent large allocations.
Because we need 1 stack and 1 heap region per instruction, and the
current max instruction nesting is hardcoded to 5, the pre-allocated
size is (MAX_STACK + MAX_HEAP) * 5 * NUM_THREADS. With the current
limits that's about 2.5MB per thread. Note that this is memory that
would eventually get allocated anyway, we're just pre-allocating it now.
* programs/sbf: add test for stack/heap zeroing
Add TEST_STACK_HEAP_ZEROED which tests that stack and heap regions are
zeroed across reuse from the memory pool.
* port join from itertools and use it in program_stubs.rs
* move itertools to dev-dependencies of solana-program
* add comment to join fn
* more concise replacement for join fn
Co-authored-by: Jon C <me@jonc.dev>
* remove join fn
---------
Co-authored-by: Jon C <me@jonc.dev>
* Removes ProgramTest from simulation tests.
* Removes ProgramTest from sysvar syscall tests.
* Workaround for rustc crash caused by 16 byte aligned memcpy.
* Deduplicates test_program_sbf_sanity.
* Moves mem and remaining_compute_units into test_program_sbf_sanity().
* Removes unused dev-dependencies in Cargo.toml.
* Removes crate-type = lib from Cargo.tomls.
* Adds SBF_OUT_DIR env to CI script.
* Adds "sysvar" to build.rs.
Consider this scenario:
- Program increases length of an account
- Program start CPI and adds this account as a read-only account
- In fn update_callee_account() we resize account, which may change
the pointer
- Once CPI finishes, the program continues and may read/write from
the account. The mapping must be up-to-date else we use stale
pointers.
Note that we always call callee_account.set_data_length(), which
may change the pointer. In testing I found that resizing a vector
from 10240 down to 127 sometimes changes its pointer. So, always
update the pointer.
* extract curve25519 crate
* remove obsolete comment
* fix Cargo.toml files
* fix imports
* update lock file
* remove unused deps from zk-token-sdk
* fmt
* add solana-curve25519 patch
* add missing override to programs/sbf/Cargo.toml
* copy over an allow()
* move new crate to curves dir
* use workspace version
* add back missing dev dep
* add missing dependencies to programs/sbf
* fmt
* move dep to the correct dependency table
* remove #[cfg(not(target_os = "solana"))] above errors mod
* local program cache: add `modified_entries` field
* use `modified_entries` for modified program cache
* invoke context: make `program_cache_for_tx_batch` mutable
* invoke context: unify local program cache instances
* remove `find_program_in_cache` alias