* Upgrade sbf tests to use bpf loader v3 (#34691)
* update sbf test to use bpf_loader v2
* update test_program_sbf_invoke_sanity test
* update test bpf program owner
* update test_program_sbf_invoke_upgradeable_via_cpi
* update test_program_sbf_disguised_as_sbf_loader
* update test_program_reads_from_program_account
* update test_program_sbf_program_id_spoofing
* update test_program_sbf_caller_has_access_to_cpi_program
* update 3 more tests
* fix program buffer size in minimul for rent exempt calculation
* more test updates
* more update
* more test updates
* comments
* undo c format
* typo
* add sol_alloc_free not deployable and deployable tests
* comments
* review feedback - move buffer_keypair and program_keypair inside callee
fn.
* more refactor
* delete sof_alloc_free_syscall enabled tests
* revert lamport change
---------
Co-authored-by: HaoranYi <haoran.yi@solana.com>
(cherry picked from commit 8869d0c8a0)
# Conflicts:
# programs/sbf/tests/programs.rs
* fix merge conflicts
* update tests to avoid using the new test api from 1.18
* manually backport #34722 to fix a test
* Ignore failing benchmark tests and fix compilation
---------
Co-authored-by: HaoranYi <haoran.yi@gmail.com>
Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: haoran <haoran@mbook>
Co-authored-by: Stephen Akridge <sakridge@gmail.com>
[zk-token-proof] include `VerifyBatchRangeProofU256` in the `enable_zk_transfer_with_fee` feature gate (#34747)
include `VerifyBatchRangeProofU256` in the `enable_zk_transfer_with_fee` feature
(cherry picked from commit bc136423b4)
Co-authored-by: samkim-crypto <skim13@cs.stanford.edu>
* Disables verification-less reloading.
* Refactors LoadedPrograms::extract() to use a mutable parameter instead of returning the list of missing entries.
* cargo fmt
* 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.
chore: Update light-poseidon to 0.2.0 (#33923)
That new release contains an important change which prevents a
potential DDoS.
* Lightprotocol/light-poseidon#32
Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.
The update and mentioned change fixes the same issue as #33363 aims
to address.
The new release contains also few other less important changes like:
* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39
(cherry picked from commit 67f8daf6e9)
Co-authored-by: vadorovsky <vadorovsky@protonmail.com>
Fix `solana-address-lookup-table-program` compilation (#34353)
* Add checks to decide which SDK crate to use
* Make module only available in non-program environments
* Remove `solana-sdk` export and only export from `solana-program`
(cherry picked from commit 46921b3135)
Co-authored-by: acheron <98934430+acheroncrypto@users.noreply.github.com>
direct_mapping: disable stack frame gaps (#34254)
Gaps don't work with direct mapping which assumes a 1:1 mapping between virtual
and host addresses.
(cherry picked from commit a0df9def91)
Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
cpi: direct_mapping: always zero spare capacity if account alloc changes (#34141)
If the vector holding an account is reallocated during execution of a callee,
we must zero the spare capacity regardless of whether the account size changed,
because the underlying vector might contain uninitialized memory in the spare
capacity.
Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
direct_mapping: fix iter_memory_pair_chunks in reverse mode (#34204)
iter_memory_pair_chunks was iterating regions in reverse, but not memory
_within_ regions in reverse.
This commit fixes the issue and simplifies the implementation by removing
nested loops which made control flow hard to reason about.
(cherry picked from commit 09088822e7)
Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
cpi: fix capacity check in update_caller_account (#34064)
reserve(additional) reserves additional bytes on top of the current _length_
not capacity. Before this fix we could potentially reserve less capacity than
required.
(cherry picked from commit d009d7304a)
Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
[zk-token-proof] Round compute units to nice numbers (#33910)
round zk-token-proof compute units to nice numbers
(cherry picked from commit b0bf24b6fc)
Co-authored-by: samkim-crypto <skim13@cs.stanford.edu>
* updated inner_call for hashing fn to follow generic approach (#33128)
* updated inner_call for hashing fn to follow generic approach
* different hash compute budget values for all digests
* fixed conflicts
* reverted changes to compute_budget.rs and added 3method to trait to get compute budget values
* updated type for result fn for HasherImpl
* using Hash directly in result fn, got rid of HASH_BYTES and removed comment form compute_budget
* updated import statement
* cargo fmt -all
* removed unused import and reference related warning
* oops forgot semicolon
* removed trailing white space
(cherry picked from commit a60d1857bf)
* 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.
(cherry picked from commit a5c7c999e2)
---------
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Fix - CPI interface `bool` masking (#33623)
Adds masking of booleans in CPI interface to disable_cpi_setting_executable_and_rent_epoch.
(cherry picked from commit 1262ff7589)
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>