Commit Graph

585 Commits

Author SHA1 Message Date
mergify[bot] 8561902444
v2.0: Scheduler: Improve TTL (backport of #3161) (#3179)
* Scheduler: Improve TTL (#3161)

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
(cherry picked from commit 7b0a57316d)

# Conflicts:
#	accounts-db/src/accounts.rs
#	core/src/banking_stage/consumer.rs
#	core/src/banking_stage/immutable_deserialized_packet.rs
#	core/src/banking_stage/latest_unprocessed_votes.rs
#	core/src/banking_stage/transaction_scheduler/scheduler_controller.rs
#	runtime/src/bank/address_lookup_table.rs

* resolve conflicts

---------

Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
2024-10-17 12:52:12 -05:00
mergify[bot] a829deae22
v2.0: SIMD-0118: fix `total_rewards` for recalculation (backport of #2780) (#2794)
* SIMD-0118: fix `total_rewards` for recalculation (#2780)

* Add new feature key

* Wrap existing code with new feature

* Extend test harness

* Make test fail

* Populate EpochRewards::total_rewards from PointValue

* Remove superfluous struct field

* Fixup tests

(cherry picked from commit 4470f6d96e)

# Conflicts:
#	programs/bpf_loader/src/syscalls/mod.rs
#	sdk/src/feature_set.rs

* Fix conflicts

---------

Co-authored-by: Tyera <tyera@anza.xyz>
2024-09-03 10:31:12 -06:00
mergify[bot] e86b3cdcfc
v2.0: fix: borrow stakes delegation during snapshot serialization (backport of #2455) (#2500) 2024-08-14 07:41:36 +08:00
mergify[bot] 792c5d6fff
v2.0: stake-program: `MoveStake` and `MoveLamports` (backport of #1415) (#1928)
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>
2024-07-17 16:39:44 -07:00
mergify[bot] 2e5f5d5b4d
v2.0: Remove deprecated address_lookup_table_account re-export (backport of #1972) (#1990)
* Remove deprecated address_lookup_table_account re-export (#1972)

* Remove deprecated re-export

* Remove deprecated stuff from example_mocks

* Remove deprecated programs/alt re-export

(cherry picked from commit f681fe87d5)

# Conflicts:
#	sdk/program/src/lib.rs

* Fix conflict

---------

Co-authored-by: Tyera <tyera@anza.xyz>
2024-07-03 18:38:30 +00:00
mergify[bot] 8ac1a4547b
v2.0: Handle deprecated Instructions sysvar methods (backport of #1959) (#1979)
* Handle deprecated Instructions sysvar methods (#1959)

* Remove deprecated legacy-message methods (deprecated in v1.9)

* Unpub deprecated method load_current_index; dedupe

* Unpub deprecated method load_instruction_at; dedupe

* Remove allow(deprecated) tags

* Make load_instruction_at available to benches

(cherry picked from commit adb9d9e3c9)

# Conflicts:
#	sdk/program/Cargo.toml
#	sdk/program/src/sysvar/instructions.rs

* Fix conflicts

---------

Co-authored-by: Tyera <tyera@anza.xyz>
2024-07-03 10:40:11 -06:00
mergify[bot] 262706a176
v2.0: Remove deprecated symbols from solana-program (backport of #1958) (#1977)
Remove deprecated symbols from solana-program (#1958)

* Remove SLOT_MS

* Remove deprecated Pubkey methods

* Remove deprecated info! macro

* Delete deprecated and dangling borsh 0.9 module

* Remove deprecated UpgradeableLoaderState methods

* Remove FeeCalculator deprecated method

* Remove deprecated Instruction ctor

* Remove deprecated legacy-message methods (deprecated in v1.9)

(cherry picked from commit 2f85940326)

Co-authored-by: Tyera <tyera@anza.xyz>
2024-07-02 20:10:48 -06:00
mergify[bot] c21767a8e1
v2.0: vote: remove deprecated ixs (backport of #1906) (#1917)
vote: remove deprecated ixs (#1906)

(cherry picked from commit e42e7fd692)

Co-authored-by: Ashwin Sekar <ashwin@anza.xyz>
2024-06-28 14:33:11 -04:00
Kevin Heavey 6cf32250ee
use bytemuck_derive 1.7.0 explicitly in sdk and program (#1793)
* use bytemuck_derive 1.7.0 explicitly in sdk and program

* explicitly activate the derive feature of bytemuck in zk-sdk
2024-06-20 09:42:37 +02:00
Kevin Heavey 2bdba73ee6
program: move itertools to dev-dependencies (#1782)
* 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>
2024-06-19 23:08:19 +02:00
Kevin Heavey 25ec30452c
sdk: Only compile wasm-bindgen when target_arch = "wasm32" (#1658)
* move wasm-bindgen dep under cfg(target_arch = "wasm32") in sdk and program

* remove wasm_bindgen_stub (we don't need it where we're going)

* put wasm_bindgen usage behind #[cfg(target_arch = "wasm32")]

* remove doc comments from skippeed fields

* add missing attribute

* another missing attribute

* add doc comments explaining duplicated structs

* fmt

* fix wasm comments

* Update sdk/program/src/instruction.rs

---------

Co-authored-by: Jon C <me@jonc.dev>
2024-06-18 14:54:41 +02:00
Kevin Heavey 988647d814
remove unused build dep `cc` from solana-program (#1659)
* remove unused build dep `cc` from solana-program

* remove cc from workspace
2024-06-17 08:13:54 -05:00
Kevin Heavey 7e0688341e
remove superfluous usage of allow(dead_code) (#1669) 2024-06-13 22:52:49 +08:00
Joe C a6035da45e
SDK: Slot Hashes: Add queries using `sol_get_sysvar` (#1622)
* sysvars: add `get_sysvar` handler

* sysvars: add `SlotHashesSysvar` trait

* use bytemuck slices for binary search

* refactor get_sysvar API

* add tests

* add pointer alignment check

* make the API a struct

* move allocation check

* use `PodSlotHash` for layout

* cleanup
2024-06-12 22:39:16 +00:00
Jon C 67c4278706
program: Add "hmac" feature to libsecp256k1 for doctests (#1695)
program: Add "hmac" feature to libsecp256k1
2024-06-12 13:02:44 +02:00
Joe C b1508010c0
Syscall: `GetEpochStake` (#1152)
* SVM: add `get_vote_accounts` callback

* program-runtime: invoke context: add `vote_accounts`

* sdk: add feature gate for sol-get-epoch-stake

* syscall: get-epoch-stake

* syscall: get-epoch-stake: tests

* drop `get_compute_meter`

* refactor for total stake

* refactor API for total stake
2024-06-11 09:28:31 -05:00
Alexander Meißner e6902be43c
Refactor - Adds `StableVec::len()` (#1645)
Adds StableVec::len().
2024-06-11 10:20:38 +02:00
Jon C 1756c61283
sdk: Remove borsh usage from Pubkey test (#1633) 2024-06-06 17:59:18 +00:00
Kevin Heavey f807911531
Make borsh optional in sdk and program crates (#1576)
* make borsh optional in sdk and program

* fmt

* don't include borsh in dev-context-only-utils
2024-06-05 22:30:00 +02:00
hana 9ac6b0d0fd
solana-program: stake to program error (#1580)
implement ProgramError conversion for StakeError
2024-06-04 12:35:12 -07:00
Kevin Heavey f954fba969
Extract solana-poseidon crate from solana-program (#999)
* extract solana-poseidon crate

* update imports and lock files

* remove now-unused light-poseidon dep from program crate

* add missing posiedon dep when target_os = "solana"

* set solana-poseidon version to 2.0.0

* sort workspace members

* use workspace version in Cargo.toml

Co-authored-by: Joe C <joecaulfield29@yahoo.com>

* move syscall definition to solana-poseidon crate

Co-authored-by: Joe C <joecaulfield29@yahoo.com>

* finish moving sol_poseidon defn to solana-poseidon crate

* update imports in examples

---------

Co-authored-by: Joe C <joecaulfield29@yahoo.com>
2024-05-30 13:34:23 -05:00
Yihau Chen 1f3ef3325f
chore: bump rust stable to v1.78.0, nightly to 2024-05-02 (#1309)
* bump stable to v1.78.0

* bump nightly to 2024-05-02

* clippy: non_local_definitions
2024-05-29 11:58:31 +08:00
Jon C c9a02c0340
sdk: Remove support for borsh 0.9 (#1440) 2024-05-21 12:10:28 +02:00
hana d8e9da5b5d
implement SyscallGetSysvar (#1307)
generic mechanism to fetch arbitrary slices of account data for a specially selected list of sysvars
2024-05-16 15:08:15 -07:00
Justin Starry 7474e4722b
Deprecate `is_key_passed_to_program` in favor of `is_instruction_account` (#1374)
Deprecate is_key_passed_to_program in favor of is_instruction_account
2024-05-16 00:20:54 +00:00
Justin Starry 537a3b75f3
Deprecate `is_non_loader_key` message methods (#1219)
deprecate is_non_loader_key methods
2024-05-15 17:42:19 -05:00
Yihau Chen ec9bd79849
clippy: fix legacy_numeric_constants (#1314)
clippy: legacy_numeric_constants
2024-05-15 11:29:19 +08:00
Kevin Heavey 59e3eaafb5
Prefer explicitly using serde_derive instead of the "derive" feature of serde (#1329)
* use serde_derive instead of the derive feature of serde

* make serde_derive version match serde version

* remove serde dep entirely from programs/address-lookup-table

* replace remaining usage of serde "derive" feature

* update lock files

* explicitly use serde_derive in svm and frozen-abi

* add comments about serde and serde_derive versions matching
2024-05-15 01:11:31 +02:00
Kevin Heavey b06a2c776a
program: remove unused zeroize dep (#1330) 2024-05-14 13:31:18 +02:00
Kevin Heavey 7d7e0d468e
program: remove unused libc dep (#1331) 2024-05-14 12:41:18 +02:00
Kevin Heavey a645623ae7
program: remove unnecessary activation of serde feature of curve25519-dalek (#1327)
* remove unnecessary activation of serde feature of curve25519-dalek

* zk-sdk actually does need serde in curve25519-dalek
2024-05-14 12:40:33 +02:00
Kevin Heavey 5a9906ebf4
solana-program: Make frozen-abi optional (#1222)
* make frozen-abi optional in solana-program

* fix syntax error

* activate solana-program's frozen-abi feature in dev deps of program and sdk

* undo putting solana-program itself in solana-program dev deps

* add missing whitespace

Co-authored-by: Tyera <teulberg@gmail.com>

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2024-05-08 23:06:24 +02:00
ripatel-fd 749dec626c
Don't panic the vote program (#1248)
Co-authored-by: Richard Patel <ripatel@jumptrading.com>
2024-05-08 14:19:41 -04:00
Yihau Chen f050705f98
clippy: unnecessary_get_then_check (#1242) 2024-05-09 00:17:18 +08:00
Kevin Heavey 4ae2ca1eaf
program: remove unused tiny_bip39 dep (#1087)
* program: remove unused tiny_bip39 dep

* add wasm-bindgen feature for wasm builds of solana-sdk

* make rand version explicit

* remove line specifying rand version for wasm32

* sdk: Enable wasm-bindgen feature on getrandom

---------

Co-authored-by: Jon C <me@jonc.dev>
2024-05-07 14:04:08 +02:00
Justin Starry b78d2550d2
refactor: simplify fee payer determination (#1198)
* refactor: simplify fee payer determination

* feedback
2024-05-07 12:31:29 +08:00
Brooks fbbae8a59a
clippy: clone_from() (#1177)
```
error: assigning the result of `Clone::clone()` may be inefficient
   --> bucket_map/src/bucket.rs:979:17
    |
979 |                 hashed = hashed_raw.clone();
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `hashed.clone_from(&hashed_raw)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `-D clippy::assigning-clones` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::assigning_clones)]`
```
2024-05-03 15:21:10 +00:00
Tyera 4672efa1c1
Add StakeError index comments (#1012) 2024-04-24 00:32:36 +00:00
Brooks 0f939c1b08
Removes deprecated MINIMUM_STAKE_DELEGATION (#963) 2024-04-22 16:48:17 -04:00
Justin Starry 25be2be4fc
Deprecate static lists of reserved keys (#833) 2024-04-17 01:15:53 +08:00
Justin Starry 2e911559d0
Deprecate `is_builtin_key_or_sysvar` function (#788) 2024-04-16 10:03:13 +08:00
Justin Starry 056bfcede7
Deprecate `is_sysvar_id` function (#789)
Deprecate is_sysvar_id
2024-04-16 06:22:52 +08:00
Justin Starry f27f91bed7
Deprecate `solana_program::sdk_ids` module (#790)
Deprecate solana_program::sdk_ids module
2024-04-16 06:21:20 +08:00
Kevin Heavey 76502b40d0
program: remove unused serde_json dep (#800)
remove unused serde_json dep from solana-program
2024-04-14 16:08:22 -06:00
Justin Starry 09241ae9c3
Use reserved account keys list to restrict tx write locks (#541)
* Plumb through reserved account keys set

* Plumb through tests
2024-04-13 09:37:58 +08:00
ripatel-fd 4b6d274887
Fix crash if vote state is malformed (#715)
* Fix crash if vote state is malformed

* Fix vote program crash if clock rewinds

Return an instruction error instead of panicking if the vote
program detects the vote program's vote authority history is
newer than the current clock.

---------

Co-authored-by: Richard Patel <ripatel@jumptrading.com>
2024-04-10 17:12:56 -04:00
Tyera 2470b45468
Check EpochRewards::active within the Stake Program (#617)
* Add new StakeError variant

* Add closure to return error if EpochRewards::active

* Use error_during_epoch_rewards for Instructions that mutate stake accounts

* Use try instead of manually matching Ok/Err

* Consolidate error_during_epoch_rewards check

* Add new test helper

* Add test demonstrating which ix return StakeError::EpochRewardsActive

* Remove single-use fn
2024-04-09 17:29:50 -06:00
Ashwin Sekar f975e92eba
ff cleanup: reduce_stake_warmup_cooldown (#470)
* ff cleanup: reduce_stake_warmup_cooldown

* update instruction comments to indicate stake config is unused
2024-04-04 18:03:35 +00:00
Emanuele Cesena 64260fc831
Simd 129: alt_bn128 syscalls - simplified error code (#294)
* alt_bn128: simplify errors in sycalls (alt_bn128, compress, poseidon)

* add TODO for feature gate. remove validate from compress

* add feature gate

* fix one more error case

* all changes under feature gate

* revert removing from()

* return unexpected errors in lib

* add comment to remove error types, once the feature gate is activated

* remove unnecessary/impossible error

* fix mispelled comments
2024-04-03 09:09:54 +09:00
Ashwin Sekar a468ff2999
vote: add TowerSync ix (#365)
* vote: add TowerSync ix

* fork_id -> block_id
2024-04-02 10:02:10 -07:00