Commit Graph

143 Commits

Author SHA1 Message Date
Jack May 4e27543415
Allow programs to realloc their accounts within limits (#19475) 2021-09-28 01:13:03 -07:00
Sean Young d714cf659c Proposal: log binary data for Solidity
The program_id is not needed on "Program return data: " because it
always preceeded by the program invoke message, so no need to repeat
the program id. Also rename this to "Program return: " since "data"
is redundant.
2021-09-22 07:59:06 +01:00
Alexander Meißner b507715d44
CPI without Account Refs (#20034)
* Removes search for accounts and unsafe lifetime transmute in InvokeContext::push().

* Replaces accounts by account_indices in verify_and_update() and process_cross_program_instruction().

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2021-09-21 14:41:02 +02:00
Alexander Meißner 36f46e1c31
CPI Account Reuse (#19762)
* Removes two account copy steps from InstructionProcessor::native_invoke().

* Moves gathering of keyed_accounts, caller_write_privileges and program_indices into InstructionProcessor::create_message().

* Explicitly routes the serialized account lengths to enable sharing of existing account structures.

* Recycles existing account structs in CPI syscall.
2021-09-18 08:09:47 +02:00
Jack May 7b0bf64404
cleanup old features (#19956) 2021-09-17 09:46:49 -07:00
Sean Young 098585234d Add return data implementation
This consists of:
 - syscalls
 - passing return data from invoked to invoker
 - printing to stable log
 - rust and C SDK changes
2021-09-10 14:25:54 +01:00
Alexander Meißner 88c1b8f047
Index loaders / executable accounts (#19469)
* Appends loaders / executable_accounts to accounts in transaction loading.

* Adds indices to loaders / executable_accounts.

* Moves MessageProcessor::create_keyed_accounts() into InvokeContext::push().

* Removes "executable_accounts",
now referenced by transaction wide index into "accounts".

* Removes create_pre_accounts() from InstructionProcessor,
as it is already in MessageProcessor.

* Collect program account indices directly in load_executable_accounts().
2021-09-10 08:36:21 +02:00
Jack May 778b2adbea
Check seed length before trying to cal program address (#19699) 2021-09-07 21:37:24 -07:00
Jack May 529fefc7cc
Remove native id check in pda creation (#19595) 2021-09-07 14:44:52 -07:00
Tyera Eulberg decec3cd8b
Demote write locks on transaction program ids (#19593)
* Add feature

* Demote write lock on program ids

* Fixup bpf tests

* Update MappedMessage::is_writable

* Comma nit

* Review comments
2021-09-04 03:05:30 +00:00
Jack May 5cf8d8795b
Feature cleanup (#19528) 2021-08-31 14:51:26 -07:00
Justin Starry 2d7f036afd
Add solana-program-runtime crate (#19438) 2021-08-27 00:30:36 +00:00
Jack May a89f180145
Allow closing upgradeable program accounts (#19319) 2021-08-24 10:05:54 -07:00
Jack May 9be988db41
Fix memoverlap check (#19232) 2021-08-16 16:16:52 -07:00
Alexander Meißner 0a63f65c03
Bumps solana_rbpf to v0.2.14 (#18869)
* Bumps solana_rbpf to v0.2.14

* Feature gate for verify_mul64_imm_nonzero as discussed in #17520.
2021-08-04 09:50:28 +02:00
Jack May 77861e2d40
Feature disable fees sysvar (#18981)
* Feature disable fees sysvar

* nudge
2021-08-02 00:31:11 +00:00
Jack May ef17cf3bdb
Cleanup loader features (#18977) 2021-07-29 15:03:00 -07:00
Jack May dfbb0c559b
deprecate fees sysvar (#18960) 2021-07-29 10:48:14 -07:00
Jack May 7fc4cfebc8
Rename BpfComputeBudget (#18768) 2021-07-22 10:18:51 -07:00
Trent Nelson abe5a0a349 gate libsecp256k1 upgrade to v0.5.0 2021-07-15 18:43:55 +00:00
s-medvedev 1f288ce527
Add ecrecover syscall (#17720)
Co-authored-by: Anton Lisanin <lisanin.anton@gmail.com>
2021-07-07 13:15:14 -07:00
Alexander Meißner 8d5c04e257
Bump solana_rbpf to version 0.2.13 (#18068)
* Moves syscall_registry into the rbpf Executable constructor.

* Adds the reject_unresolved_syscalls flag which is only set when deploying programs via the CLI.
2021-07-07 09:50:11 +02:00
Justin Starry 100fabf469
Remove feature switch for demoting sysvar write locks (#18373) 2021-07-06 21:22:22 +00:00
Alexander Meißner 7462c27d07
Refactoring: Unify account_deps and accounts (#17898)
* Changes ThisInvokeContext::get_account() to use accounts instead of pre_accounts.

* Adds explicit keys to accounts to make them symmetric to account_deps.

* Appends account_deps to accounts in transaction loading and removes account_deps everywhere else.
2021-07-05 13:49:37 +02:00
Sebastian Bor 3a4176aa3e
feat: remove set_upgrade_authority_via_cpi_enabled feature (#17933) 2021-06-22 10:05:33 +01:00
Alexander Meißner 6514096a67 chore: cargo +nightly clippy --fix -Z unstable-options 2021-06-18 10:42:46 -07:00
Dmitri Makarov 361c1bdd57
Fix file permissions (#17910) 2021-06-12 02:03:32 +00:00
Arthur Greef 28fdfed1ba
Blake3 syscall (#17358) 2021-06-08 11:04:10 -07:00
Jack May 2b50529265
Add memory operation syscalls (#16447) 2021-06-01 15:33:17 -07:00
Jack May a3240aebde
Always bail if program modifies a ro account (#17569) 2021-05-28 09:50:25 -07:00
Michael Vines 2c99b23ad7 Add get_sysvar() helper to sdk 2021-05-21 01:30:12 +00:00
Jack May 477898f682
Optimize aligned memory used by the runtime (#17324) 2021-05-19 13:43:59 -07:00
Tao Zhu 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
Jack May 8eb05d6ed4
Add Keccak256 syscall and sdk support (#16498) 2021-05-10 16:16:58 -07:00
Jeff Washington (jwash) 82e11588a5
lamports -> lamports() (#16915) 2021-04-28 14:55:55 -05:00
Jack May 9b3a59f030
Retain alloc'd and updated data in cpi (#16850) 2021-04-27 13:36:42 -07:00
Jeff Washington (jwash) 998cba74b5
AccountSharedData.executable() (#16835) 2021-04-27 09:12:17 -05:00
Jeff Washington (jwash) ca14c18998
owner -> owner() (#16782) 2021-04-23 22:49:47 +00:00
Jack May be4df39a4c
Remove unactivated ristretto syscall (#16727) 2021-04-22 09:29:42 -07:00
Sebastian Bor 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
Jack May 08d5253651
Enforce host aligned memory for program regions (#16590) 2021-04-20 11:07:30 -07:00
Alexander Meißner 9dfcb921cf
Refactoring: Move KeyedAccounts to InvokeContext (#15410)
Collects all parametric occurrences and the construction of keyed_accounts and puts them into InvokeContext.
2021-04-19 18:48:48 +02:00
Michael Vines f7eadd9d70
bump solana_rbpf from 0.2.5 to 0.2.7 (#16515) 2021-04-13 14:49:09 -07:00
Jack May fa83f3bd73
Return sysvars via syscalls (#16422) 2021-04-12 16:04:57 -07:00
François Garillot 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
Jack May ad7f8e7f23
Use more performant copy (#16282) 2021-03-31 16:52:58 -07:00
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