Commit Graph

2291 Commits

Author SHA1 Message Date
Lucas Steuernagel b97b3dd4ab
Use BankForks on tests - Part 3 (#34248)
* Add BankForks to core tests

* Refactor functions under DCOU
2023-12-01 13:47:22 -03:00
Andrew Fitzgerald 2294801954
Do not derive Copy for EpochSchedule and Rent (#32767) 2023-12-01 07:57:25 -08:00
HaoranYi f2878c0c51
fix merge error (#34195)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-11-21 17:29:54 +00:00
HaoranYi 57dc7adda1
move PROGRAM_OWNERS to sdk (#34193)
* move PROGRAM_OWNERS to sdk

* Update sdk/src/account.rs

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
2023-11-21 09:49:33 -06:00
samkim-crypto a8863bd9fe
[zk-token-proof] Feature gate transfer with fee related proofs (#34103)
feature gate zk-token-proof transfer with fee
2023-11-17 09:21:08 +09:00
Brooks 9a78924c4b
clippy: Uses .into() when .try_into() is infallible (#34119) 2023-11-16 15:28:49 -05:00
HaoranYi 60fdd85aed
Add a feature to disable rent collection (#33945)
* add a feature to disable rent collection

* fix a test

* fix a test

* rekey

* should collect rent

* Update runtime/src/bank/fee_distribution.rs

Co-authored-by: Brooks <brooks@prumo.org>

* expand tests to cover both rent collection disabled and enabled

* feedbacks

* reviews - move should collect rent check out of rent collector into bank

* enforce rent_epoch to u64:max when rent collection is disabled

* review feedbacks and fix a test
When rent fee collection is disabled, we won't collect rent for any account. If there are any rent paying accounts, their `rent_epoch` won't change too.

* revise comments

* update rent_epoch for rent exempted account

* rebase

* set rent_epoch in rent collection for rent exempted account

* revert test change

* don't assert

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Brooks <brooks@prumo.org>
2023-11-16 08:57:49 -06:00
Tao Zhu e790f098b8
Create runtime-transaction crate to build transaction types with state for runtime use (#33471)
* Create runtime-transaction crate to host transaction type for runtime that comes with metadata

* create separate structs for runtime in different state, add corresponding traits for transaction_meta

* share simple-vote checking code

* not to expose private fields to outside of sdk

---------

Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
2023-11-15 22:29:37 -06:00
Justin Starry 2573b7acc9
clean feature: libsecp256k1_0_5_upgrade_enabled (#34080) 2023-11-16 09:59:53 +08:00
Lijun Wang aa991b6ab7
Adjust receive window to make them linear to the count of streams (#33913)
Adjust receive window to make them linear to the count of streams to reduce fragmentations
2023-11-14 10:55:16 -08:00
Brooks 725ab37bf4
clippy: Replaces .get(0) with .first() (#34048) 2023-11-13 17:22:17 -05:00
vadorovsky 67f8daf6e9
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
2023-11-10 16:00:10 +09:00
HaoranYi 75e598ece3
rekey stake redelegate feature (#33957)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-11-06 17:57:54 +00:00
Justin Starry ebe8afb0c3
Burn fees collected into invalid accounts (#33887)
* refactor: create bank::fee_distribution module

* feature: add checks to fee distribution

* refactor: move Bank::deposit fn into test_utils

* feedback

* feedback 2

* add datapoints

* change to datapoint_warn

* typo
2023-11-06 10:02:22 +08:00
Joe C ecd674bd92
revert programify feature gate (#33897) 2023-10-27 18:28:13 +02:00
Kevin Heavey af7fd32f4c
chore: fix some typos (#33833)
* fix spelling of "retrieved"
* fix spelling of "should"
* fix spelling of "comparisons"
2023-10-25 16:21:53 +02:00
Yihau Chen 7d56c3484c
test: check the existence of target_path_parent before detelting (#33812) 2023-10-23 14:14:34 +00:00
Dmitri Makarov 8260ffc1ef
Bump platform-tools to v1.39 (#33804) 2023-10-21 16:22:16 -04:00
ripatel-fd 6798e05b0a
Fix typo in feature_set.rs (#33777)
Co-authored-by: Richard Patel <ripatel@jumptrading.com>
2023-10-20 10:26:13 +02:00
Joe C 6b1e9b8974
SDK: update error variants in `Feature::from_account_info` (#33750) 2023-10-20 07:35:22 +02:00
Joe C 37d093a30e
program error: add `ArithmeticOverflow` (#33767) 2023-10-20 07:33:21 +02:00
Joe C 4cb5065e0d
program error: add `InvalidAccountOwner` (#33766) 2023-10-19 18:15:51 +02:00
Brooks c1353e172c
Removes cap_accounts_data_allocations_per_transaction featurization (#33754) 2023-10-19 07:01:15 -04:00
Illia Bobyr 84c2f9de55
program::message::AccountKeys: `Clone`, `Default`, `Debug`, `Eq` (#33749)
It is a pretty standard set of traits to implement on most types.  Both `Pubkey`
and `LoadedAddresses` contained within the `AccountKeys` already implement them.
Doing the same for `AccountKeys` could simplify unit tests and/or some common
value manipulation logic.
2023-10-18 10:22:33 -07:00
Illia Bobyr b5b48eeb72
Cargo.toml: Sort dependency and feature lists (#33670)
Keeping these sorted reduces merge conflicts.
2023-10-17 01:12:15 -07:00
Pierre 8a20e7f8de
sdk: fix broken C examples (#33701)
fix C broken example
2023-10-16 23:53:03 +02:00
Brennan b36d051b51
Update hashes per tick with feature gates (#33600)
* Update hashes per tick with feature gates
2023-10-11 09:58:06 -07:00
Alexander Meißner cb695c7b32
Cleanup - Feature Gate of `enable_early_verification_of_account_modifications` (#33579)
Cleans up the feature gate of enable_early_verification_of_account_modifications:
- Removes PreAccount
- Removes InvokeContext::pre_accounts and InvokeContext::rent
- Removes InvokeContext::verify() and InvokeContext::verify_and_update()
- Removes TransactionContext::is_early_verification_of_account_modifications_enabled()
- Removes TransactionAccounts::is_early_verification_of_account_modifications_enabled
- No longer optional: TransactionContext::rent
2023-10-10 17:26:17 +02:00
Ryo Onodera 95810d876a
Enable frozen_abi on banking trace file (#33501)
* Enable frozen_abi on banking trace file

* Fix ci with really correct bugfix...

* Remove tracker_callers

* Fix typo...

* Fix AbiExample for Arc/Rc's Weaks

* Added comment for AbiExample impl of SystemTime

* Simplify and document EvenAsOpaque with new usage

* Minor clean-ups

* Simplify SystemTime::example() with UNIX_EPOCH...

* Add comment for AbiExample subtleties
2023-10-07 13:15:38 +09:00
Sammy Harris 41ed9ab6d9
Fix: handle `-- --target-dir` arg in `cargo build-sbf` (#33555)
* fix: handle target dir override in build-sbf cargo args

* fix: refactor to canonicalize target arg for workspace absolute paths

* fix: nightly linting
2023-10-06 13:48:12 -07:00
Joe C 25460f76e7
Bank: Add function to replace empty account with upgradeable program on feature activation (#32783)
* replace program account

* modify for all cases

* remove non-data swap

* address tests & conditional feedback

* get the rent involved

* mix in owner & executable

* feature-related cases

* stripped back to feature-specific case only

* added feature

* address initial feedback

* added more lamport checks

* condense tests

* using test_case

* add fail cases to tests

* more cleanup

* add verifiably built program

* update program account state

* cleaned up serializing logic

* use full word capitalization

* rename old & new to dst & src

* swap src and dst in parameters

* add warnings and errors

* rename feature to programify

* test suite description clarity

* remove strings from datapoints

* spell out source and destination

* more verbose comments in account replace functions

* move lamport calculation

* swap lamport check for state check

* move replace functions to helper module

* make replace_account methods fallible

* refactor error handling

* add test for source program state
2023-10-04 19:54:59 +02:00
Andrew Fitzgerald 5a95e5676e
Manually add lookup table addresses instead of sanitizing (#33273) 2023-10-04 08:04:43 -07:00
Will Hickey c6ee69e0dc
Update version to v1.18.0 (#33487) 2023-10-03 10:20:24 -05:00
ch9xy 9f6ef2fe62
Typo fix in instruction.rs (#33473)
Typo fix
2023-09-30 06:05:05 +00:00
Yihau Chen 0b2beba357
chore(bpf): remove unused deps (#33435)
chore: remove unused deps
2023-09-28 11:16:16 +00:00
HaoranYi d25d53e979
Fix bug of same-epoch stake deactivation after stake redelegation (#32606)
* fix stake deactivation in the same epoch after redelegation bug

add tests

refactor common code into fn

avoid early return

add feature gate for the new stake redelegate behavior

move stake tests out of cli

add stake-program-test crate

reimplemnt stake test with program-test

remove stake-program-test crate

reviews

add setup.rs

remove clippy

reveiws

* reviews

* review comments

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-09-25 16:35:40 -05:00
samkim-crypto 08aba38d35
[feature-id] add poseidon compression syscall feature id (#33392)
add poseidon compression syscall feature id
2023-09-25 09:26:17 -07:00
ananas-block 997aa0a3f8
Feat(syscall): add altbn128 g1 & g2 compression (#32870)
* solana-program - altbn128: add g1 & g2 compression

still fixing tests for point of infinity

feat: proof compression syscall working

add rust test to ci

remove prints

added c test

added sycall pricing

* fixed ci checks

* refactored altbn128 and compression
2023-09-25 05:43:34 -07:00
Trent Nelson 1840fd7ab3
Feature - better error codes for tx lamport check (#33343)
Replaces `TransactionError::InstructionError(0, InstructionError::UnbalancedInstruction)` with `TransactionError::UnbalancedTransaction`.

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
2023-09-22 23:58:05 +00:00
Trent Nelson 7c545b0ae9
bump rust stable to 1.72.1 (#33333)
* bump rust stable to 1.72.1

* bump rust nightly to 2023-09-20

* fix nightly lint -- unused doc comment

-- rustdoc does not generate documentation for expression fields

* fix nightly lint -- unnecessarily eager cloning of iterator items

* fix nightly lint -- loop never actually loops
2023-09-20 23:53:36 -06:00
Tyera bca41edf20
Make active stake consistent in split (#33295)
* Add feature gate

* Add helper fn

* Require split destination to be rent-exempt if it is active

* Update cli to prefund split accounts

* cli: require rent param with sign-only

* Update tokens to prefund split accounts

* Update split tests with sysvar accounts

* Fix test_split_to_account_with_rent_exempt_reserve

* Fix test_staked_split_destination_minimum_balance

* Fix test_split_more_than_staked

* Fix test_split_minimum_stake_delegation and remove misleading StakeState::Initialized case

* Fix test_split_from_larger_sized_account

* Add test for pre-/post-activation behavior splitting some or all of stake account

* Assert active stake

* Fix runtime test

* Ignore stake-pool downstream

* Review comments

* Feature gate sysvar reads
2023-09-20 06:00:51 +00:00
Kevin Heavey 92ab3827fd
program: move array-bytes to dev-dependencies (#33277)
* program: move array-bytes to dev-dependencies

* run cargo-for-all-lock-files.sh tree
2023-09-19 09:07:35 -07:00
Alexander Meißner bc38ef27d8
Feature - Enable Program-Runtime-v2 and Loader-v4 (#33294)
* Adds a new feature `enable_program_runtime_v2_and_loader_v4`.

* Adds a feature gated builtin entry for the solana_loader_v4_program.
2023-09-19 16:29:52 +02:00
Pankaj Garg 5dbc19ccbf
Processors to compile and send LoaderV4 CLI commands (#33228)
* Processors to compile and send LoaderV4 CLI commands

* suppress unused code warning

* clippy fixes

* redeploy program using source buffer

* unify deploy and redeploy to a single function

* clippy fixes

* fixes after testing the CLI frontend
2023-09-18 06:43:33 -07:00
Brooks 6481496564
Derives Pod and Zeroable on Hash (#33256) 2023-09-15 07:27:30 -04:00
behzad nouri c1090d3959
moves new_warmup_cooldown_rate_epoch outside iterators and for loops (#33259)
Recalculating new_warmup_cooldown_rate_epoch for each item is redundant
and wasteful and instead can be done only once outside the iterators and
for loops.
Also NewWarmupCooldownRateEpoch is unnecessary and verbose and is
removed in this commit.
2023-09-15 00:06:34 +00:00
Yihau Chen 99b24bd741
check source_path before delete it (#33255) 2023-09-14 18:44:12 +00:00
Christian Kamm 525e59f01a
sdk, programs/bpf_loader: add sol_remaining_compute_units syscall (#31640)
bpf_loader: add sol_remaining_compute_units syscall

Co-authored-by: jonch <9093549+jon-chuang@users.noreply.github.com>
2023-09-13 08:57:08 -06:00
bji bdf7207eec
Implement timely vote credits feature. (#32957) 2023-09-12 10:40:04 -07:00
Alexander Meißner bbb57be0a5
Refactor - Move interfaces of address-lookup-table into the program SDK (#33165)
* Adds a module `address_lookup_table` to the SDK.

* Adds a module `address_lookup_table::instruction` to the SDK.

* Adds a module `address_lookup_table::error` to the SDK.

* Adds a module `address_lookup_table::state` to the SDK.

* Moves AddressLookupTable into SDK as well.

* Moves AddressLookupTableAccount into address_lookup_table.

* Adds deprecation messages.

* Disentangles dependencies across cargo files.
2023-09-11 21:10:40 +02:00