Commit Graph

23 Commits

Author SHA1 Message Date
Brooks Prumo d1ba42180d
clippy for rust 1.65.0 (#28765) 2022-11-09 19:39:38 +00:00
Dmitri Makarov 34865d032c chore: update Solana docs and code comments that specify "BPF" to "SBF" 2022-10-31 14:14:25 -04:00
Alexander Meißner a43098a428
Feature - Check syscall outputs do not overlap (#28599)
* Extends is_nonoverlapping() to be able to deal with two different lengths.

* Uses is_nonoverlapping() for syscall output parameters.

* Feature gates the new throws of SyscallError::CopyOverlapping.

* Adds tests which trigger SyscallError::CopyOverlapping.
2022-10-27 19:11:18 +02:00
Alexander Meißner 547f07526b
Refactor - create_executor() to be usable outside of bpf_loader (#28369)
* Moves disable_deploy_of_alloc_free_syscall parameter inside create_executor().

* Lets register_syscalls() take &FeatureSet only instead of the entire InvokeContext.

* Uses ic_logger_msg!() instead of ic_msg!() inside create_executor().
Inlines map_ebpf_error().

* Adds register_syscalls_us to executor_metrics::CreateMetrics.

* Moves timings accumulation into executor_metrics::CreateMetrics::submit_datapoint().

* Moves &invoke_context.feature_set into a variable.

* Lets create_executor() return executor_metrics::CreateMetrics via a mutable parameter.

* Dissolves invoke_context parameter in create_executor().

* Pulls assignment of create_executor_metrics.program_id outside of create_executor().

* Makes create_executor() take a byte slice instead of a BorrowedAccount.

* Adds create_executor_from_account().
2022-10-18 10:22:39 +02:00
samkim-crypto 3f63283eda
add curve25519 multiscalar multiplication syscall (#28216)
* add curve25519 multiscalar multiplication syscall

* update compute unit costs

* update tests

* add update to compute budget

* add syscall call function

* update compute costs in tests

* update syscall syntax
2022-10-12 14:43:02 +09:00
Alexander Meißner 30b0a13ba9
Bump solana_rbpf to 0.2.34 (#28198)
* Bumps solana_rbpf to 0.2.34

* Removes generic UserError from EbpfError.

* Uses ProgramResult for syscalls.
Removes use sites of the question_mark! macro by wrapping the call method of SyscallObjects.

* Uses InvokeContext as syscall context object directly.

* Replaces bind_syscall_context_object() by a parameter in the constructor.

* Inlines bind_syscall_context_objects() at its only call site.
2022-10-06 20:31:58 +02:00
Alessandro Decina 7469ce7ba1
Bump solana_rbpf to 0.2.33 (#28121) 2022-09-28 19:52:19 +01:00
Alexander Meißner 71aee4fcaf
Feature: Explicitly limit `TransactionContext::instruction_trace_capacity` (#27938)
* Renames instruction_stack_capacity => instruction_stack_capacity.

* Replaces number_of_instructions_at_transaction_level by instruction_trace_capacity.

* Adds MaxInstructionTraceLengthExceeded.

* Adjusts TransactionContext::new() parameter.

* Adds feature gate limit_max_instruction_trace_length.

* Adds test_max_instruction_trace_length().
2022-09-26 10:47:16 +02:00
samkim-crypto 751ec864da
Add syscall curve group ops tests (#27937)
* resolve rebase conflict

* fix logic when group ops fail

* update bpf loader id
2022-09-21 09:50:47 +09:00
samkim-crypto 4de25897a3
Add curve validation syscall tests (#27936)
* add syscall test for curve validation

* add edwards point validation syscall tests

* rename ristretto test
2022-09-21 06:50:49 +09:00
Alexander Meißner 12d2147efa
Adds `IndexOfAccount` type (#27599)
Adds the type `IndexOfAccount`.
2022-09-06 11:31:40 +02:00
Alexander Meißner 6f2e556b16
Cleanup: `TransactionContext` (#27595)
* Lets instruction_accounts_lamport_sum() have the &InstructionContext as parameter directly.

* Updates docu comments.

* Uses accessors methods instead of accessing private properties of other structs.

* Adds #![deny(clippy::indexing_slicing)].

* Has get_signers() return a Result instead of using unwrap().

* Removes InvokeContext::get_key_of_account_at_index().
2022-09-05 16:29:02 +02:00
Alexander Meißner 0b94d5af18
Refactor: `InstructionContext::configure()` (#27400)
* Replaces InstructionContext::new() by InstructionContext::configure().
Adds TransactionContext::get_next_instruction_context().

* Switch back to using references as parameters.

* Hoists InstructionContext::configure() from TransactionContext::push() into InvokeContext::push().

* Moves InstructionContext::config() to the beginning of InvokeContext::push().

* Hoists InstructionContext::configure() from InvokeContext::push() into InvokeContext::process_instruction().

* Review feedback: Updates docu comments.
2022-09-03 10:34:57 +02:00
Alexander Meißner 0367c1a60c
Feature: `SyscallSetAccountProperties` (#27444)
* Adds TransactionContextAttribute.

* Adds SyscallSetAccountProperties.

* Adds AccountPropertyUpdate factory methods to BorrowedAccount.

* Categorizes syscalls exclusive to ABIv0/v1 and ABIv2.
2022-09-02 12:42:06 +02:00
Alexander Meißner a8543ad992
Feature: `stop_sibling_instruction_search_at_parent` (#27290)
* Adds stop_sibling_instruction_search_at_parent.

* Adds test_syscall_sol_get_processed_sibling_instruction().
2022-08-23 23:55:56 +02:00
Alexander Meißner 55d18e8463
Refactor: Flattens `TransactionContext::instruction_trace` (#27109)
* Flattens TransactionContext::instruction_trace.

* Stop the search at transaction level.

* Renames get_instruction_context_at => get_instruction_context_at_nesting_level.

* Removes TransactionContext::get_instruction_trace().
Adds TransactionContext::get_instruction_trace_length() and TransactionContext::get_instruction_context_at_index().

* Have TransactionContext::instruction_accounts_lamport_sum() accept an iterator instead of a slice.

* Removes instruction_trace from ExecutionRecord.

* make InstructionContext::new() private
2022-08-20 11:20:47 +02:00
Justin Starry 7d765e3d67
clean feature: `prevent_calling_precompiles_as_programs` (#27100)
* clean feature: prevent_calling_precompiles_as_programs

* fix tests

* fix test

* remove comment

* fix test

* feedback
2022-08-18 05:21:16 +00:00
Alexander Meißner f76f8d5d41
Bumps solana_rbpf to v0.2.32 (#27059) 2022-08-15 16:04:48 +02:00
Alexander Meißner 85a679b098
Feature: disable CPI setting `is_executable` and `rent_epoch` (#26987)
* Adds the feature disable_cpi_setting_executable_and_rent_epoch.

* Adds the feature gate for disable_cpi_setting_executable_and_rent_epoch.

* Removes TEST_EXECUTABLE_LAMPORTS.

* Test that is_executable and rent_epoch are ignored.
2022-08-10 00:22:23 +02:00
Richard Patel 35f04db0b0
bpf-loader: make syscalls pub (#26918) 2022-08-06 14:31:47 +00:00
Richard Patel a9a3c62907
Fix sol_get_processed_sibling_instruction on 32-bit hosts (#26522) 2022-08-05 12:06:03 -07:00
Justin Starry 2335f6908a
Loosen CPI restrictions and charge compute for ix data len (#26653)
* Loosen CPI restrictions and charge compute for ix data len

* Address feedback

* use explicit casting

* more feedback
2022-07-24 20:20:16 +02:00
Justin Starry 07d7c938b9
Refactor: split up syscalls module (#26637)
* Refactor: split up syscalls module

* fix ci script

* fix visibility
2022-07-16 19:33:57 +02:00