1749 Commits

Author SHA1 Message Date
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
878e52f0b9 Fix cargo-build/test-bpf --workspace (#16431) 2021-04-07 17:22:55 -07:00
92f4018b07 Cleanup unsupported sysvars (#16390)
* Cleanup unsupported sysvars

* fix ser description
2021-04-06 00:08:03 -07:00
1359bceb5d Bump bpf-tools to version v1.5 (#16331)
The new version of bpf-tools eliminates the separate
rust-bpf-sysroot. The Rust standard libraries for the BPF target are
built in tree when the compiler is built.  The standard libraries code
is slightly more optimized and some reduction of compute budget can be
expected with this version of bpf-tools.
2021-04-04 13:04:22 +00:00
bcd89dd34c Fix BPF ELF layout (#16256)
* Fix BPF ELF layout

* whitespace
2021-03-31 08:51:19 +00: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
abada56ba1 Print the rust version when building bpf programs (#16181) 2021-03-29 14:17:08 +08:00
aabe186e3f sdk: Use u32::MAX from std to unbreak BPF builds (#16171) 2021-03-27 15:53:25 +00:00
433f1ead1c Rpc: enable getConfirmedBlock and getConfirmedTransaction to return confirmed (not yet finalized) data (#16142)
* Add Blockstore block and tx apis that allow unrooted responses

* Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender

* Track highest slot with tx-status writes complete

* Rename and unpub fn

* Add commitment to GetConfirmed input configs

* Support confirmed blocks in getConfirmedBlock

* Support confirmed txs in getConfirmedTransaction

* Update sigs-for-addr2 comment

* Enable confirmed block in cli

* Enable confirmed transaction in cli

* Review comments

* Rename blockstore method
2021-03-26 16:47:35 -06: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
658ddd1c9c Bump bpf-tools to version v1.4 (#16152) 2021-03-26 19:21:41 +00:00
07273bfa9e Show bpf-tools download progress 2021-03-25 12:23:51 -07:00
66c42f62d8 make AccountSharedData.data private to abstract storage (#16091)
* format

* 2 more tests

* use
2021-03-25 11:04:20 -05: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
664ed76523 Bump bpf-tools to version v1.3 (#16068)
* Bump bpf-tools to version v1.3

This brings in the fix for increased compute budget that wasn't caught
when bpf-tools v1.2 were released.

* Adjust BPF test programs instruction counts
2021-03-24 07:16:38 +00:00
2d24d13046 AccountsSharedData: data copy on write (#15800)
* Arc<AccountData>

* try custom serializer

* adapt test from Behzad's change

* clippy

* simplify serialization

* remove abi example derive

* refactor 'take'

* remove serialization

* remove serialize calls

* remove account_data

* remove intos

* remove left over file
2021-03-23 15:19:31 -05: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
14e45155e4 Bump bpf-tools to v1.2 and get rid of xargo 2021-03-19 12:09:15 +01:00
4c5660ba7a Santize instruction index when loading instruction from sysvar (#15942) 2021-03-19 09:32:41 +08:00
9760fded2d remove old code (#15988) 2021-03-18 17:51:49 +00: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
5b2b824a53 Sdk: remove integer arithmetic (#15962)
* Fix timing

* Fix secp256k1_instruction

* Fix secp256k1 tests
2021-03-18 01:33:50 +00:00
bf33ce8906 sdk: Add accessor for signer pubkeys of a tx message 2021-03-16 22:09:46 -06:00
806bfdd67b set_data_from_slice (#15854)
* data_ensure_equal_to_slice

* rename and change to copy
2021-03-16 16:56:26 -05:00
eb19e11688 Add cargo-bpf-test --no-run flag, matching cargo-test 2021-03-16 08:23:03 +00:00
a2eb655322 =1.7.0 2021-03-16 07:51:07 +00:00
5760cf0f41 nit: fix spelling (#15908) 2021-03-15 23:47:57 -07: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
ad9901d7c6 Charge compute budget for bytes passed via cpi (#15874) 2021-03-15 22:41:44 -07:00
8567b41d5f Improve Instruction::new deprecation warning 2021-03-15 20:04:20 -07:00
c09ea2c314 More AccountSharedData construction (#15844)
* one more AccountSharedData construction

* one more construct
2021-03-15 19:27:17 -05:00
c1ba265dd9 Wallclock BankingStage Throttle (#15731) 2021-03-15 17:11:15 -07:00
60e5fd11c9 Display actual account length (#15875) 2021-03-15 14:17:56 -07:00
0c9ca5522c Bump version to v1.7.0 2021-03-13 09:01:21 +00:00
f2865dfd63 requires stakes for propagating crds values through gossip (#15561) 2021-03-12 15:50:14 +00:00
e5b644e830 Add trait for saturating arithmetic (#15812)
* Add SaturatingArithmetic trait

* Use Duration saturating arithmetic

* Use new macro to fix poh_config
2021-03-12 06:22:40 +00:00
cc38ae72e7 Skip deserialization of readonly accounts (#15813) 2021-03-11 19:28:21 -08:00
4bbeb9c033 Remove old feature: simple_capitalization (#15763)
* Remove old feature: simple_capitalization

* Fix another failing test in core

* Finish up test cleanup

* Further clean up a bit
2021-03-12 11:12:40 +09:00
3419a5446e AccountSharedData.set_data (#15781)
* account.set_data and resize_data

* remove data_resize
2021-03-11 16:40:45 -06:00
79ac1997de sdk: add macro for unchecked div with const denominator 2021-03-11 08:44:36 +00:00