Commit Graph

197 Commits

Author SHA1 Message Date
Jack May f84e88f0a2
Cleanup nits (#16211) 2021-03-30 12:16:21 -07:00
sakridge 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
Jack May ad9901d7c6
Charge compute budget for bytes passed via cpi (#15874) 2021-03-15 22:41:44 -07:00
Jeff Washington (jwash) 952c3bcbb7
AccountSharedData construction (#15790) 2021-03-11 18:09:04 -06:00
Jack May 478518308d
Share RO and Executable accounts within invocations (#15799) 2021-03-10 23:04:00 -08:00
Jack May 369e13b111
cleanup old runtime features (#15787) 2021-03-10 09:48:41 -08:00
Jeff Washington (jwash) 52e54e1100
account.data -> data() (#15778) 2021-03-09 22:31:33 +00:00
Jeff Washington (jwash) 8a3135d17b
Account->AccountSharedData (#15691) 2021-03-09 15:06:07 -06:00
Jack May b53cb8eb2d
Deprecate Instruction::new (#15695) 2021-03-04 05:46:48 +00:00
Michael Vines 5df36aec7d Pacify clippy 2021-02-19 20:08:41 -08:00
Jack May 02432a548f
Cleanup old features (#15391) 2021-02-18 09:56:11 -08:00
Jack May 6650fbf443
Add per-byte logging cost (#15279) 2021-02-12 00:55:17 +00:00
Mrmaxmeier ebbaa1f8ea
Fix integer overflow in degenerate invoke_signed BPF syscalls (#15051) 2021-02-03 13:32:38 -08:00
Jack May 73d9186502
More rich runtime logging (#14938) 2021-02-01 11:40:49 -08:00
Alexander Meißner d026da4a1b
Ignore syscalls which are not registered in cached rbpf executable. (#14898) 2021-01-29 12:30:10 +01:00
Jack May 0b1015f7d3
Richer runtime failure logging (#14875) 2021-01-28 10:04:54 -08:00
Jack May 77572a7c53
Track account writable deescalation (#14626) 2021-01-22 15:28:01 -08:00
Jack May 6e8a1ba7de
Load executable accounts from invoke context (#14574) 2021-01-14 00:19:22 -08:00
Jack May ec48631fc5
Bail on all CPI errors (#14500)
* Bail on all CPI errors

* whitespace
2021-01-09 02:27:39 +00:00
Jack May 5eacc5d08d
Enable program upgrades via CPI (#14449) 2021-01-06 14:31:14 -08:00
Jack May a8b5a32b50
Gate cpi program account passing (#14443) 2021-01-05 21:53:41 +00:00
Jack May 2d8dacb72b
Gate CPI authorized programs (#14361) 2020-12-30 18:13:37 -08:00
Jack May 5524938a50
Limit CPI instruction size (#14317) 2020-12-29 01:14:17 +00:00
Jack May b1d702a618
Don't use caller passed executable account (#14276) 2020-12-23 14:34:14 -08:00
Jack May 0b479ab180
Limit CPI from calling loader or native programs (#14252) 2020-12-23 10:44:34 -08:00
Jack May ab205b682a
Upgradeable programs called same as non-upgradeable (#14239)
* Upgradeable programs called same as non-upgradeable

* nudge
2020-12-22 09:26:55 -08:00
Jack May e8cc0bef6c
Add CPI support for upgradeable loader (#14193) 2020-12-17 15:39:49 -08:00
Jack May 025f886e10
check for resize access violations (#14142) 2020-12-15 23:21:08 -08:00
Jack May ab98c1f2d4
Add try_find_program_address syscall (#14118) 2020-12-15 08:15:01 -08:00
Jack May 83fda2d972
Clean invoke in prep for native invoke (#14055) 2020-12-10 18:25:57 -08:00
Jack May 5ea80e673f
Fix priv escalation test (#14046) 2020-12-10 22:36:33 +00:00
Alexander Meißner 201637b326
Updates rbpf to v0.2.2 (#14036)
* Updates rbpf to v0.2.2
2020-12-10 16:32:54 +01:00
Jack May e1a4251b07
Cap CPI signers (#14021) 2020-12-09 02:14:53 -08:00
Jack May f1fd999bb0
Translate data length as mutable (#13956) 2020-12-04 05:47:22 +00:00
Jack May 661ca52135
Cap seeds not signers (#13941) 2020-12-03 09:58:25 -08:00
Jack May 1c51711c75
Invoke with empty account slice (#13931) 2020-12-03 07:06:26 -08:00
Jack May 3f841df7cf
Cap number of program address seeds (#13924) 2020-12-02 22:25:06 +00:00
Jack May 841c7a0f71
Cleanup memory translation APIs (#13921) 2020-12-02 20:03:36 +00:00
Jack May 85bec37be4
Translate data length and owner as writable (#13914) 2020-12-02 09:05:42 -08:00
Jack May 733fcbaa6c
Check that the program was granted access to program_id (#13890) 2020-12-01 07:35:07 -08:00
Jack May 2d62f2ad03
Re-fix arithmetic overflow and add better test (#13870) 2020-11-30 22:39:03 +00:00
Michael Vines cc78667118 Record instructions after account translation 2020-11-28 10:54:09 -08:00
Alexander Meißner c833ede4af
Rbpf v0.2.1 (#13732)
* Refactoring to match rbpf-v0.2.1 and add JIT compilation caching.

* Removes obsolete bpf-trace.py which has been replaced by the rbpf CLI tool.
2020-11-24 18:00:19 +01:00
Jack May 8c922a0198
fix arithmetic overflow in slice translation (#13624)
* fix arithmetic overflow in slice translation

* nudge
2020-11-17 00:13:01 +00:00
Michael Vines baa6b3a261 Add stable program logging for BPF and native programs 2020-11-14 08:26:01 -08:00
Jack May 461ae40eea
provide full Rust panic messages in BPF and add memory optimizations (#13455) 2020-11-09 13:40:26 -08:00
Alexander Meißner 4999fe298b
Rbpf v0.2.0 (#13365)
* Updates rbpf to v0.2.0,
which unifies the interfaces of the interpreter and the JIT.
However, the JIT is not enabled yet.
2020-11-04 18:46:26 +01:00
Michael Vines 9263ae1c60 Simplify CPI interface into MessageProcessor 2020-10-30 09:20:09 +00:00
Michael Vines da9548fd12 de-mut some InvokeContext methods 2020-10-30 09:20:09 +00:00
Michael Vines da361afbb9 Revert "Updates rbpf to v0.2.0, (#12951)"
This reverts commit 6606590b81.
2020-10-29 21:45:24 -07:00
Michael Vines 7d686b72a0 Add Bank::set_bpf_compute_budget() 2020-10-29 21:45:24 -07:00
Michael Vines 66e51a7363 Add sol_log_compute_units syscall 2020-10-29 21:45:24 -07:00
Michael Vines 2664a1f7ef Remove MessageProcessor::loaders 2020-10-29 21:45:24 -07:00
Michael Vines df8dab9d2b Native/builtin programs now receive an InvokeContext 2020-10-29 21:45:24 -07:00
Alexander Meißner 6606590b81
Updates rbpf to v0.2.0, (#12951)
which unifies the interfaces of the interpreter and the JIT.
However, the JIT is not enabled yet.
2020-10-29 11:34:52 -07:00
Alexander Meißner 65ee3a6bdd
Refactors the common code of test and bench targets into the solana_runtime::bpf_test_utils module. (#13203) 2020-10-29 10:04:47 +01:00
Michael Vines 1b343665a1 Move KeyedAccount out of solana-program. Native programs are not supported by solana-program 2020-10-26 18:54:54 -07:00
Michael Vines 7bc073defe Run `codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand` 2020-10-21 19:08:13 -07:00
Jack May 3f9e6a600b
program log pubkey as base58 (#12901) 2020-10-15 09:11:54 -07:00
Jack May 973f0965e1
Add ristretto multiply syscall (#12699) 2020-10-06 23:52:13 -07:00
Jack May d0aa8a6446
Fix zero-len slice translations (#12642) 2020-10-02 17:45:39 -07:00
Jack May adeb06e550
Check CPI program is executable (#12644) 2020-10-02 13:55:22 -07:00
Jack May 058bca6632
add sha256 syscall (#12569) 2020-09-29 23:29:20 -07:00
Jack May 74fcb184b2
Pipe FeatureSet though InvokeContext (#12536)
* Pipe FeatureSet though InvokeContext

* gate program size cap

* nit
2020-09-29 21:36:30 +00:00
Jack May 2ff983647f
Move process_instruction defs to runtime (#12507) 2020-09-29 01:36:46 -07:00
Jack May d00453f747
Drain the entire compute budget (#12478) 2020-09-25 18:08:10 +00:00
Jack May b8c4b88188
Cleanup names, fix line dependent test (#12477) 2020-09-25 09:00:06 -07:00
Justin Starry 6601ec8f26
Record and store invoked instructions in transaction meta (#12311)
* Record invoked instructions and store in transaction meta

* Enable cpi recording if transaction sender is some

* Rename invoked to innerInstructions
2020-09-24 22:36:22 +08:00
Jack May 3278d78f08
Cache re-usable work performed by the loader (#12135) 2020-09-14 17:42:37 -07:00
Jack May ae7b15f062
Gate pointer alignment enforcement (#12176) 2020-09-11 11:07:03 -07:00
Jack May ea179ad762
Bump compute budget (#11864)
* Bump compute budget

* nudge
2020-08-26 21:48:51 +00:00
Jack May c2e5dae7ba
Gate aligned program heap (#11808) 2020-08-24 13:21:34 -07:00
Jack May 8d362f682b
The constraints on compute power a program can consume is limited only to its instruction count (#11717) 2020-08-21 15:31:19 -07:00
Jack May 46830124f8
CPI support for bpf_loader_deprecated (#11695) 2020-08-18 11:26:29 -07:00
Jack May e9b610b8df
Add SystemInstruction::CreateAccount support to CPI (#11649) 2020-08-17 13:38:42 -07:00
Jack May 750e5344f1
Return an error from create_program_address syscall (#11658) 2020-08-17 09:49:40 -07:00
Jack May f8606fca4f
Aligned program heap (#11657) 2020-08-17 09:49:21 -07:00
Jack May 4196686acf
Feature check CPI up front (#11652) 2020-08-16 23:12:22 -07:00
Jack May 768b386f0a
fix region checks (#11651) 2020-08-16 23:11:52 -07:00
Jack May 9290e561e1
Align host addresses (#11384)
* Align host addresses

* support new program abi

* update epoch rollout

* Enforce aligned pointers in cross-program invocations
2020-08-11 16:11:52 -07:00
Jack May 4ac75a8558
Realloc not supported (#11424) 2020-08-06 19:14:12 +00:00
Jack May 03263c850a
Force program address off the curve (#11323) 2020-08-05 16:35:54 -07:00
Jack May 2dbed80e48
Disable cross-program invocations for OperatingMode::Stable (#11272) 2020-07-29 15:29:52 -07:00
Greg Fitzgerald 1c498369b5
Remove fee-payer guesswork from Message and Transaction (#10776)
* Make Message::new_with_payer the default constructor

* Remove Transaction::new_[un]signed_instructions

These guess the fee-payer instead of stating it explicitly
2020-06-24 14:52:38 -06:00
Jack May 73586c1aad
Use &[u8] for program address seeds rather then &str (#10744) 2020-06-22 16:51:43 -07:00
Jack May b6a9573748
Route all loader messages to log collector (#10528) 2020-06-13 13:20:08 -07:00
Michael Vines 7e2651ca51
RPC simulateTransaction endpoint now returns program log output (#10432) 2020-06-06 10:18:28 -07:00
Michael Vines a4cd96609c
Add built-in programs to InvokeContext (#10383)
automerge
2020-06-03 12:48:19 -07:00
Jack May 03abd3ddd7
Prevent privilege escalation (#10232)
automerge
2020-05-26 01:02:31 -07:00
Jack May 4a72c2b054
Support cross-program invocation to native programs (#10136) 2020-05-20 09:24:57 -07:00
Greg Fitzgerald 5e89bd8868
Panic if no fee-payer found via Message::new() (#10050)
automerge
2020-05-15 12:23:09 -07:00
Kristofer Peterson 58ef02f02b
9951 clippy errors in the test suite (#10030)
automerge
2020-05-15 09:35:43 -07:00
Justin Starry 5cc252d471
Remove hash field from account (#9915) 2020-05-12 23:39:46 +08:00
Jack May af84dff9ef nudge 2020-05-11 09:06:05 -07:00
Jack May 97e17f9b32 Programs can only sign their accounts 2020-05-11 09:06:05 -07:00
Jack May 7678af6300
Cleanup BPF helper symbols (#9804) 2020-04-30 11:29:11 -07:00
Jack May de9d8cd849
Rename BPF helper to syscall (#9819)
automerge
2020-04-30 01:43:11 -07:00