solana/program-test/tests
Jon C 71eb1d86c6
sdk: Add `deserialize_into` to entrypoint to avoid heap allocations (#2618)
* sdk: Add `deserialize_into` to entrypoint

#### Problem

The main entrypoint for Solana programs allocates a vector on the heap
and pushes AccountInfos to it. Allocation is expensive.

#### Summary of changes

Add a new version of `deserialize` called `deserialize_into`, which
expects a slice of `MaybeUninit<AccountInfo>`. The entrypoint can
allocate a maximum array of AccountInfos on the stack and then pass it
in. This new version of the entrypoint saves roughly 30 CUs per unique
account passed to the program.

In an earlier version, I had the new function return the array itself,
but this used slightly more CUs, and didn't work for an array with 64
elements. Let me know how it looks!

* Call instruction processor in non-inlined function

* Add test for max supported accounts in a transaction

* Refactor extracting account infos and instruction data

* Changes required from rebase

* Add clippy allow

* Add panic message if too many accounts provided

* Add `entrypoint_no_alloc!` and revert behavior in entrypoint!

* Use entrypoint_no_alloc! everywhere except noop

* Comment why noop program works the way it does

* Add limit in doc-string

* CHANGELOG: Add entry for entrypoint
2024-08-26 19:47:08 +02:00
..
fixtures Program Test: Add BPF program account helpers (#1614) 2024-06-06 10:59:22 -05:00
bpf.rs sdk: Add `deserialize_into` to entrypoint to avoid heap allocations (#2618) 2024-08-26 19:47:08 +02:00
builtins.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
compute_units.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
core_bpf.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
cpi.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
fuzz.rs chore: remove unused clippy attributes, unnecessary_wraps (#1514) 2024-05-29 11:09:29 +00:00
genesis_accounts.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
lamports.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
panic.rs Program Test: Fix invoke_builtin_function unwinding (#2632) 2024-08-23 13:47:15 -07:00
realloc.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
return_data.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
setup.rs Fix bug of same-epoch stake deactivation after stake redelegation (#32606) 2023-09-25 16:35:40 -05:00
spl.rs refactor: use less &mut self and more async-await in BanksClient (#2591) 2024-08-16 12:30:12 -04:00
sysvar.rs Persist EpochRewards sysvar (#572) 2024-04-05 10:13:50 -06:00
sysvar_last_restart_slot.rs
warp.rs [program-test] adding method warp_to_epoch (#34620) 2024-01-03 10:58:22 -07:00