Commit Graph

314 Commits

Author SHA1 Message Date
steviez 5de9be051f
Consolidate AccountsDb parameters (#3324)
Move shrink_ratio and account_indexes into AccountsDbConfig struct
2024-10-28 12:36:55 -05:00
Jon C 96955661f7
token-2022: Use mainnet-beta binary in all tools (#3165)
#### Problem

The binary of token-2022 bundled in program-test and fetch-spl.sh is
very out of date with what's currently running on mainnet.

#### Summary of changes

Update the shared object and version to fetch.
2024-10-15 11:55:39 +02:00
Kevin Heavey b4ed7a4a2d
Extract instruction crate (#2405)
* extract instruction crate

* remove thiserror

* make bincode optional in solana-instruction

* make serde optional in solana-instruction

* fix doc tests

* fmt

* harmonize features

* fmt Cargo.toml

* clippy

* fix syscalls.rs imports

* update digests

* update digest

* unused imports

* post-rebase fmt

* fix doc links

* use workspace lints

* fmt

* make rustc_version dep optional

* update digest

* update digest

* update import

* fmt

* fix dup import

* remove dev-context-only-utils (no longer needed)

* fmt

* remove unnecessary allow()

* fix overwriting instruction syscall stubs

* fmt

* move get_processed_sibling_instruction and get_stack_height back to solana-program to avoid breaking change

* fix path

* fix typo

* move the checked_add utility function back to solana-program

* move AccountMeta to its own file

* fix bad import

* move ProcessedSiblingInstruction to syscalls.rs

* move CompiledInstruction back to solana-program

* move ProcessedSiblingInstruction back into lib.rs

* make std optional in solana-instruction

* fix required features for frozen-abi

* update digest

* update digest

* missing import

* update digest

* don't assume std is imported in frozen-abi macros

* fix import warnings

* simplify cfg usage
2024-09-13 18:30:08 +02:00
Kevin Heavey 8116c10021
Extract feature-set crate (#2172)
* extract feature-set crate

* update feature_set dependents

* re-export with deprecation notice

* fix path after rebase

* fmt

* fmt after rebase

* fixes after rebase

* unused import

* fix import

* unused import

* post-rebase fixes

* fix path

* missing frozen-abi support

* update lock file

* use workspace lints

* fix paths

* fix import

* remove unused import

* remove unused deps

* consolidate imports

* add back dep (not unused after all)
2024-09-10 19:27:20 +02:00
mjain-jump a10cd5548d
Tweaks for transaction-level fuzzing (#2744)
Tweak register blockhash for tests + add optional feature set parameter into bank for fuzzing
2024-08-26 20:56:50 -03:00
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
Andrei Silviu Dragnea 52e73297d8
Program Test: Fix invoke_builtin_function unwinding (#2632) 2024-08-23 13:47:15 -07:00
Andrei Silviu Dragnea c6703cb6fb
Program Test: clean up invoke_builtin_function (#2694)
refactor: clean up invoke_builtin_function
2024-08-23 18:21:18 +02:00
Andrei Silviu Dragnea 1492119857
refactor: use less &mut self and more async-await in BanksClient (#2591)
* refactor: use less &mut self in BanksClient

* refactor: use async-await syntax instead of explicit Futures
2024-08-16 12:30:12 -04:00
Jon C 576fa44523
stake: Remove redelegate instruction (#2213)
* stake: Remove redelegate code and tests

* Mark stake flags as deprecated

* Remove usage of feature gate

* Add a changelog entry for the removal

* Remove repeated #[allow(deprecated)]s

* Re-add "redelegate-stake" command

* Remove feature

* Make CI happy -> `hidden_unless_forced()`
2024-07-29 18:27:58 +02:00
Kevin Heavey 78ae6c7df9
Extract timings crate (#2026)
* extract solana-timings crate

* update timings dependents

* remove now-unused deps

* fmt
2024-07-11 22:16:05 +00:00
Kevin Heavey ddee03e60d
Extract log collector crate (#2025)
* extract log-collector crate

* update log-collector dependents

* cargo sort

* fmt
2024-07-09 11:32:57 +08:00
Tyera efdbdc00ce
Remove assorted deprecated symbols (#1995)
* Remove deprecated method from program-test

* Remove deprecated programs stuff from TestValidator

* Remove deprecated method from TestValidator (deprecated in v1.11.0)

* Remove deprecated re-export from cluster_info
2024-07-03 14:07:35 -06:00
Tyera 6e4e82eb2a
Remove deprecated BanksClient methods and dependent ProgramTest methods (#1956)
* Remove deprecated Banks client/interface methods

* Remove dependent deprecated program-test methods
2024-07-02 00:01:20 -06:00
Lucas Ste 9ad1712561
Allow the registration of genesis hash and recent block hash for fuzzing (#1847) 2024-06-25 15:41:42 -03:00
Joe C 02f2861f7f
Program Test: Add BPF program account helpers (#1614)
* program-test: add program account helpers

* program-test: add test for Core BPF programs

* program-test: add BPF program fixture

* wrap into `add_upgradeable_program_to_genesis`

* wrap ELF loading into `add_upgradeable_program_to_genesis`

* cleanup
2024-06-06 10:59:22 -05:00
Joe C 62eb4cc068
Add Compute Budget Crate (#1121) 2024-06-01 01:38:19 -05:00
Yihau Chen f2f1a22ccc
chore: remove unused clippy attributes, unnecessary_wraps (#1514)
remove clippy unnecessary_wraps
2024-05-29 11:09:29 +00:00
Joe C 6631e5f4d9
Program-Test: Spport adding genesis accounts (#1418) 2024-05-18 05:46:45 -05:00
Joe C 1a37631629
Program-Test: Add test for BPF programs (#1416) 2024-05-18 05:46:17 -05:00
Yihau Chen 8f9fc2ada2
clippy: missing_transmute_annotations (#1343)
* clippy: missing_transmute_annotations

* Revert "clippy: missing_transmute_annotations"

This reverts commit 01b5fe5dabd8e8c860c8173840429204c4cca3b0.

* update types

* update types

* update types

* update types

* feedback

* add one more missing type

* Revert "feedback"

This reverts commit 420ee23489fe71b1b33a413e084d46204d7b8c9e.

* update types
2024-05-18 01:03:17 +08:00
Yihau Chen b42d8f68a4
clippy: allow dead_code for GraphVoteAccountModeError, DroppableTask and SubscriptionToken (#1246)
* clippy: allow dead_code for SubscriptionToken

* clippy: allow dead_code for GraphVoteAccountModeError

* clippy: allow dead_code for DroppableTask

* remove the string in the GraphVoteAccountModeError

* abort the joinhandle when drop

* only trace JoinHandle in the drop

* add comment
2024-05-13 10:45:37 +08:00
Pankaj Garg bbe470562b
SVM: Cleanup transaction processor construction (#974) 2024-04-22 14:29:20 -07:00
Alexander Meißner e43338f3d6
Refactor - Rename `LoadedProgram` to `ProgramCacheEntry` (#880)
LoadedProgramOwner => ProgramCacheEntryOwner.
LoadedProgramType => ProgramCacheEntryType.
LoadedProgram => ProgramCacheEntry.
LoadedProgramStats => ProgramCacheStats.
LoadedProgramMatchCriteria => ProgramCacheMatchCriteria.
LoadedProgramsForTxBatch => ProgramCacheForTxBatch.
2024-04-18 21:38:08 +02:00
carllin d5c291a934
Remove send snapshot hard unwrap (#326) 2024-04-11 12:18:52 -04:00
Kevin Heavey d06e3e95cb
program-test: move test-case to dev-dependencies (#710) 2024-04-10 10:22:28 -05:00
Lucas Steuernagel 4753a8aefa
Move `add_builtin` to SVM (#547) 2024-04-09 16:55:09 -03:00
Joe C 03ef611f0c
program-runtime: hoist `RuntimeConfig` up to SVM (#630)
program-runtime: hoist `RuntimeConfig` out into SVM
2024-04-07 10:45:57 -05:00
Tyera 9253c465d1
Persist EpochRewards sysvar (#572)
* Persist EpochRewards sysvar between reward intervals

* Adjust initial EpochRewards balance to ensure it is not debited out of existence

* Set EpochRewards::active = false at end of distribution

* Fix tests

* Extend test to 2 epochs, assert sysvar still exists

* Stop adjusting EpochRewards balance based on rewards

* Fix tests

* Review suggestions
2024-04-05 10:13:50 -06:00
Lucas Steuernagel 9f8a478c51
Use `&str` instead of `String` in `add_builtin` (#539) 2024-04-02 14:36:13 -03:00
sakridge e0e659680a
Remove duplicated token ids and use a shared inline-spl crate (#456) 2024-04-01 14:31:04 +02:00
Brooks 24fe473b46
clippy: Automated fixes for Rust 1.77.0 (#390) 2024-03-22 13:48:46 -04:00
HaoranYi 0f8f8cd970
Revert deprecate executable feature (#309)
* revert deprecate executable feature

* add native loader account transfer test

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-03-20 10:54:15 -05:00
Dmitri Makarov ba43f74dcf
[SVM] Move RuntimeConfig to program-runtime (#96)
RuntimeConfig doesn't use anything SVM specific and logically belongs
in program runtime rather than SVM.  This change moves the definition
of RuntimeConfig struct from the SVM crate to program-runtime and
adjusts `use` statements accordingly.
2024-03-07 10:16:16 -08:00
Pankaj Garg 46b9586630
SVM: Move SVM code to its own crate folder (#35119) 2024-02-06 16:06:32 -08:00
Pankaj Garg 3cf5dd2afb
SVM: Move RuntimeConfig to svm folder (#35085) 2024-02-05 13:49:36 -08:00
Tao Zhu 51eaa2b9cc
cleanup feature code after activation (#34695)
cleanup feature checking code
2024-01-12 14:28:50 -06:00
Tao Zhu 88f8d11da2
program-test consumes some units as native (#34714)
program-test consumes some units as native;
harden a unit test wrt if builtin consumes units;
2024-01-10 09:05:30 -06:00
Justin Starry 5f74fc4f16
Update genesis processing to have a fallback collector id for tests (#34135)
* Update genesis processing to have a fallback collector id for tests

* DCOU-ify the collector id for tests parameter (#1902)

* wrap test_collector_id in DCOU

* rename param to collector_id_for_tests

* fix program test

* fix dcou

---------

Co-authored-by: Brooks <brooks@prumo.org>
2024-01-10 08:34:41 +08:00
chalda 8330dee95d
[program-test] adding method warp_to_epoch (#34620)
* [program-test] adding method warp_to_epoch

* formatting fix
2024-01-03 10:58:22 -07:00
Justin Starry 88af74d1d0
refactor: optional `stake_history` arg is never `None` (#34556)
refactor: optional stake_history arg is never none
2023-12-22 10:44:28 +08:00
Jon Cinque 8a8466cd86
spl: Bump token-2022 to v1 (#34412)
* Update toml and lockfiles

* account-decoder: Add group and group member extensions

* transaction-status: Add token group + pointer extensions

* program-test: Update token-2022 binary
2023-12-21 20:19:10 -05:00
HaoranYi 531d69fd10
pass feature_set to BorrowedAccount (#34542)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-12-21 20:03:17 +01:00
Brooks 25f0f377c6
program-test uses Bank::new_with_paths() (#34549) 2023-12-21 07:00:28 -05:00
Ryo Onodera 0873705c1b
Define register_unique_recent_blockhash_for_test (#33880) 2023-10-27 12:30:45 +09:00
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
Ryo Onodera 5a963529a8
Add BankWithScheduler for upcoming scheduler code (#33704)
* Add BankWithScheduler for upcoming scheduler code

* Remove too confusing insert_without_scheduler()

* Add doc comment as a bonus

* Simplify BankForks::banks()

* Add derive(Debug) on BankWithScheduler
2023-10-21 15:56:43 +09: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
Justin Starry 3bfa0d291a
feature flag cleanup: cap_bpf_program_instruction_accounts (#33746) 2023-10-19 08:15:35 +08:00
Jon Cinque d33758171b
token-2022: Update to use program build with zk-ops enabled (#33747)
token-2022: Update to use version with zk-ops enabled
2023-10-18 21:39:01 +02:00