255 Commits

Author SHA1 Message Date
2ae57c172a Bump bpf-tools version to 1.9
- upgrade rustc to 1.52.1 and clang to 12.0
2021-05-20 11:35:37 +02:00
0781fe1b4f Upgrade Rust to 1.52.0 (#17096)
* Upgrade Rust to 1.52.0
update nightly_version to newly pushed docker image
fix clippy lint errors
1.52 comes with grcov 0.8.0, include this version to script

* upgrade to Rust 1.52.1

* disabling Serum from downstream projects until it is upgraded to Rust 1.52.1
2021-05-19 09:31:47 -05:00
8eb05d6ed4 Add Keccak256 syscall and sdk support (#16498) 2021-05-10 16:16:58 -07:00
4b60b2863e sdk: Add get_instance_packed_len for variable-size types (#17092)
* sdk: Add get_instance_packed_len for variable-size types

* Add comment for get_packed_len

* Add more tests
2021-05-10 23:31:02 +02:00
cfc1cb1aee SDK: Factor out pubkey on-curve test to a helper 2021-04-28 20:10:19 -06:00
9b7120bf73 SDK: More conversions for Pubkey 2021-04-27 17:54:02 -06:00
8ce4a8d6ab Annotate clock constants with computed values for quick refeerence (#16812) 2021-04-25 22:05:00 +08:00
1500011fc6 get_packed_len() now correctly handles u32/i32 types 2021-04-23 13:39:42 -07:00
48c07d32f0 WritableAccount.add/subtract_lamports (#16750)
* add/sub lamports

* make add/sub return Result

* sample replacements

* cleanup

* fix up a few tests as examples

* move enum, cleanup, impl from

* fmt

* cleanup

* add lamports.rs
2021-04-23 20:20:48 +00:00
1a658c7f31 Allow SetUpgradeAuthority instruction in CPI calls (#16676)
* feat: allow SetAuthority in CLI calls

* chore: clippy match_like_matches_macro

* chore: clippy match_like_matches_macro

* chore: rename CLI to CPI

* chore: move check for cpi authorised instruction to syscalls

* chore: add set_upgrade_authority cpi test

* chore: assert upgrade authority was changed

* feat: gate set_upgrade_authority via cpi with a feature

* chore: move feature to the end of the list

* chore: remove white spaces

* chore: remove white spaces

* chore: update comment to rerun build
2021-04-22 00:06:59 +01:00
01786f684e Remove unwrap (#16652) 2021-04-19 20:17:56 -07:00
a911ae00ba clippy 2021-04-18 20:55:02 -07:00
f641429056 Remove blake3 from bpf program dependencies (#16506) 2021-04-13 10:06:05 +00:00
85eb37fab0 Merge pull request from GHSA-8v47-8c53-wwrc
* Track transaction check time separately from account loads

* banking packet process metrics

* Remove signature clone in status cache lookup

* Reduce allocations when converting packets to transactions

* Add blake3 hash of transaction messages in status cache

* Bug fixes

* fix tests and run fmt

* Address feedback

* fix simd tx entry verification

* Fix rebase

* Feedback

* clean up

* Add tests

* Remove feature switch and fall back to signature check

* Bump programs/bpf Cargo.lock

* clippy

* nudge benches

* Bump `BankSlotDelta` frozen ABI hash`

* Add blake3 to sdk/programs/Cargo.lock

* nudge bpf tests

* short circuit status cache checks

Co-authored-by: Trent Nelson <trent@solana.com>
2021-04-13 00:28:08 -06:00
fa83f3bd73 Return sysvars via syscalls (#16422) 2021-04-12 16:04:57 -07:00
b08cff9e77 Simplify some pattern-matches (#16402)
When those match an exact combinator on Option / Result.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).
2021-04-08 12:40:37 -06:00
92f4018b07 Cleanup unsupported sysvars (#16390)
* Cleanup unsupported sysvars

* fix ser description
2021-04-06 00:08:03 -07:00
f84e88f0a2 Cleanup nits (#16211) 2021-03-30 12:16:21 -07:00
54c68ea83f Drop write lock on sysvars (#15497)
* Drop write lock on sysvars

* adds env var for demoting sysvar write lock demotion

* moves demote logic to is_writable

* feature gates sysvar write lock demotion

* adds builtins to write lock demotion

* adds system program id to builtins

* adds Feature111...

* adds an abi-freeze test

* mvines set of builtin program keys

Co-authored-by: Michael Vines <mvines@gmail.com>

* update tests

* adds bpf loader keys

* Add test sysvar

* Plumb demote_sysvar to is_writable

* more plumbing of demote_sysvar_write_locks to is_writable

* patches test_program_bpf_instruction_introspection

* hard codes demote_sysvar_write_locks to false for serialization/encoding methods

* Revert "hard codes demote_sysvar_write_locks to false for serialization/encoding methods"

This reverts commit ae3e2d2e777437bddd753933097a210dcbc1b1fc.

* change the hardcoded ones to demote_sysvar_write_locks=true

* Use data_as_mut_slice

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Co-authored-by: Michael Vines <mvines@gmail.com>
2021-03-30 10:05:09 -07:00
9ba9d2a8ae Allow incomplete features in frozen-abi 2021-03-30 02:32:53 +00:00
aabe186e3f sdk: Use u32::MAX from std to unbreak BPF builds (#16171) 2021-03-27 15:53:25 +00:00
cffa851e0f sdk: Add try_from_slice_unchecked for Borsh (#16098)
* sdk: Add try_from_slice_unchecked for Borsh

* Add tests

* Rename + clarify comment

* Rename back to unchecked
2021-03-26 23:37:35 +01:00
6d5c6c17c5 Simplify account.rent_epoch handling for sysvar rent (#16049)
* Add some code for special local testing

* Add comment to store_account_and_update_capitalization

* Simplify account.rent_epoch handling for sysvar rent

* Introduce *_for_test functions

* Add deprecation messages to existing api
2021-03-25 15:23:20 +09:00
8b3de72e2a program: Correct clamp in Message::signer_keys() 2021-03-24 23:27:24 -06:00
6bc858a888 Refactored ShortU16Visitor::visit_seq() to reject overflows, extra leading zeros and ensure one-to-one encoding. 2021-03-24 21:53:35 -06:00
9153cb9237 sdk: ShortU16 - rename variables for clarity
ShortU16's implementation embeds its usage as the length of a
ShortVec, confusingly referring to both a 'len' and a 'size'
at the same time.
2021-03-24 21:53:35 -06:00
cc6dcb48d4 sdk: Add ShortU16 deser test 2021-03-24 21:53:35 -06:00
6f5d8d18e9 remove new alloc on deserialization (#15636) 2021-03-23 14:52:59 -05:00
482c027d3b sq: optimize 2021-03-22 12:01:57 -06:00
4c5660ba7a Santize instruction index when loading instruction from sysvar (#15942) 2021-03-19 09:32:41 +08:00
7f500d610c Add Close instrruction and tooling to upgradeable loader (#15887) 2021-03-17 21:39:29 -07:00
12399157f5 SDK: Allow integer math in bump allocator 2021-03-17 22:23:18 -06:00
854e6766ce SDK: Ovf in epoch_schedule 2021-03-17 22:23:18 -06:00
98d7673a03 sdk/program: switch allow to mod-level for integer_arithmetic lint 2021-03-17 22:23:18 -06:00
bf33ce8906 sdk: Add accessor for signer pubkeys of a tx message 2021-03-16 22:09:46 -06:00
a2eb655322 =1.7.0 2021-03-16 07:51:07 +00:00
74aa32175b Show flags for accounts in tx by solana confirm (#15804)
* Show flags for accounts in tx by solana confirm

* Address review comments

* Improve comment a bit

* Apply suggestions from code review

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

* Further apply review suggestions

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2021-03-16 14:44:48 +09:00
8567b41d5f Improve Instruction::new deprecation warning 2021-03-15 20:04:20 -07:00
c1ba265dd9 Wallclock BankingStage Throttle (#15731) 2021-03-15 17:11:15 -07:00
0c9ca5522c Bump version to v1.7.0 2021-03-13 09:01:21 +00:00
79ac1997de sdk: add macro for unchecked div with const denominator 2021-03-11 08:44:36 +00:00
24d18b3cf2 docs: add docs links for crates published to crates.io 2021-03-11 08:38:18 +00:00
e3e8179f2d Sdk: start to appease clippy's integer arithmetic check (#15736)
* Move to module-level clippy allowance

* Fix stake_weighted_timestamp math

* Fix genesis_config

* Fix shred_version

* Fix hard_forks

* Fix process_instruction

* Add ArithmeticOverflow ix error

* Fix nonce_keyed_account

* Update BankSlotDelta frozen abi due to new ix error
2021-03-08 18:37:57 -07:00
b53cb8eb2d Deprecate Instruction::new (#15695) 2021-03-04 05:46:48 +00:00
4a05210d8e Clarify Instruction::new (#15686)
Not related to local-cluster, merging
2021-03-03 17:39:04 -08:00
8399851d11 check program owners (#15495)
* check program owners

* BankSlotDelta should change because InstructionError variant added

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-02-26 22:21:34 +00:00
fd3b71a2c6 cargo fmt 2021-02-19 20:08:41 -08:00
995bd0cb6b Rename IOError to BorshIoError 2021-02-19 10:54:39 -08:00
0f6f6080f3 sdk: Add Borsh support for types and utilities (#15290)
* sdk: Add Borsh to Pubkey

* Add serialization error for easier borsh integration

* Add Borsh usage to banks-client and sdk

* Rename SerializationError -> IOError

* Add new errors to proto

* Update Cargo lock

* Update Cargo.lock based on CI

* Clippy

* Update ABI on bank

* Address review feedback

* Update sanity program instruction count test
2021-02-18 11:14:56 +01:00
7f7370c306 Re-allow clippy::integer_arithmetic at crate-level 2021-02-17 13:55:08 -07:00