* Removes is_duplicate().
* Replaces use sites of visit_each_account_once().
* Removes visit_each_account_once().
* cargo fmt
* Adds comments to clarify the order of pre_accounts and instruction_accounts.
* Simplify control flow.
* Removes the offset InstructionContext::get_number_of_program_accounts() from InstructionAccount::index_in_caller.
* Removes unreachable SyscallError::InvalidLength in orig_data_lens.get().
* Introduces result return types to get_data_mut(), set_data() and set_data_length() of BorrowedAccount.
* Introduces result return types to set_owner(), set_lamports() and set_executable() of BorrowedAccount.
* - get prioritization fee from compute_budget instruction;
- update compute_budget::process_instruction function to take instruction iter to support sanitized versioned message;
- updated runtime.md
* update transaction fee calculation for prioritization fee rate as lamports per 10K CUs
* review changes
* fix test
* fix a bpf test
* fix bpf test
* patch feedback
* fix clippy
* fix bpf test
* feedback
* rename prioritization fee rate to compute unit price
* feedback
Co-authored-by: Justin Starry <justin@solana.com>
* zk-token-sdk: implement group ops trait for curve25519
* zk-token-sdk: extend syscall trait implementation for group ops for ristretto
* zk-token-sdk: register curve25519 group ops to bpf loader
* zk-token-sdk: update curve25519_syscall_enabled address
* zk-token-sdk: add curve25519 basic ops
* zk-token-sdk: add bpf operations for curve25519 ops
* zk-token-sdk: rebase
* zk-token-sdk: add tests for curve25519 opertions
* zk-token-sdk: rustfmt
* zk-token-sdk: organize syscalls by trait
* zk-token-sdk: organize syscalls by trait
* zk-token-sdk: cleaning up
* zk-token-sdk: rename mods
* zk-token-sdk: cargo fmt
* zk-token-sdk: fix tests for edwards and ristretto
* zk-token-sdk: add Syscall object for curve point validation
* zk-token-sdk: docs for curve syscall traits
* zk-token-sdk: fix errors from rebase
* zk-token-sdk: update Vec to slice
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* zk-token-sdk: use enum with num-derive for curve ids
* zk-token-sdk: update vec to slice
* zk-token-sdk: make curve25519 tests be deterministic
* zk-token-sdk: rebase
* token-2022: re-organizing curve point validation
* token-2022: cargo fmt
* zk-token-sdk: minor
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* Adds transaction_context and instruction_context where invoke_context.get_keyed_accounts() is used.
* Use instruction_context.get_instruction_data() instead of an explicit parameter.
* Removes instruction_data parameter from Executor::execute().
* Removes instruction_data parameter from ProcessInstructionWithContext.
* Replaces all use sites of get_sysvar_with_account_check by get_sysvar_with_account_check2.
* Removes get_sysvar_with_account_check.
* Renames get_sysvar_with_account_check2 to get_sysvar_with_account_check.
* Use visit_each_account_once() in CPI syscall to prevent duplicate accounts from being translated twice.
* remove unwrap() from runtime
Co-authored-by: Jack May <jack@solana.com>
This change prevents zero-cost computation of hash functions on
unbound number of zero-length slices of data. The cost for each slice
is at least equal to the base cost of a memory operation, but could be
more for longer slices.
* Adds get_sysvar_with_account_check2 for ABIv2.
* Replaces get_signers() and get_sysvar_with_account_check() in system_instruction_processor.
* Replaces KeyedAccount by BorrowedAccount in nonce_keyed_account.
* Moves TransactionContext::get_program_key() to InstructionContext::get_program_key().
* Removes TransactionContext::get_loader_key().
* Test full program and loader executable account chain in BPF loader.
* Moves stack_height of the instruction_trace into InstructionContext.
* Uses nesting_level instead of stack_height internally in transaction_context.rs
* Uses the instruction_trace instead of the instruction_context_stack internally.
* Adds feature gate: record_instruction_in_transaction_context_push.
* Adds BorrowedAccount::check_sysvar().
* Adds BorrowedAccount::get_data_mut().
* Implements account resizing in BorrowedAccount.
* Exposes is_signer() and is_writable() in InstructionContext.
* Removes AccountMeta and get_instruction_accounts_metas().
* Makes throwing errors in BorrowedAccount optional.
* Removes result return values from BorrowedAccount.
* Replaces from_keyed_account() by SysvarCache in stake instruction.
* Replaces from_keyed_account() by SysvarCache in system instruction processor.
* Removes from_keyed_account().
Moves check_sysvar_keyed_account() into sysvar_cache.rs
* Removes tests which test for incorrectly serialized sysvars.
* Unifies SysvarCache filling in the runtime and tests.
Removes new_mock_with_sysvars_and_features()
Removes mock_process_instruction_with_sysvars().
Replaces from_keyed_account() by SysvarCache in vote processor.
* Replaces from_keyed_account() by SysvarCache in BPF loader.
* Adds TEST_DUPLICATE_PRIVILEGE_ESCALATION_SIGNER and TEST_DUPLICATE_PRIVILEGE_ESCALATION_WRITABLE.
* Moves CPI privilege verification out of deduplication loop.
* Makes error handling in BorrowedAccount optional.
Adds BorrowedAccount ::get_rent_epoch().
Exposes InstructionContext::get_index_in_transaction().
Turns accounts and account_keys into pinned boxed slices.
* Introduces "unsafe" to InvokeContext::push().
* Turns &TransactionContext into &mut TransactionContext in InvokeContext.
* Push and pop InstructionContext in InvokeContext.
Makes test_process_cross_program and test_native_invoke symmetric.
Removes the borrow check from test_invoke_context_verify.
* Removes keyed_accounts from prepare_instruction()
* Removes usage of invoke_stack.
* Removes keyed_accounts from program-test.
* Removes caller_write_privileges.
* Removes keyed_accounts from BPF parameter (de-)serialization.
* Turns compute_units_consumed of ProcessInstructionResult into a &mut parameter.
* Removes second nesting level from test_process_instruction_compute_budget().
* Makes test_process_cross_program and test_native_invoke symmetric.
* Unifies test_process_cross_program(), test_native_invoke() and test_process_instruction_compute_budget() into test_process_instruction().
* Adds TransactionContext, InstructionContext and BorrowedAccount.
* Redirects the usage of accounts in InvokeContext through TransactionContext.
Also use the types declared in transaction_context.rs everywhere.
* Adjusts all affected tests.
* Unifies all InstructionRecorders of a transaction into one.
* Stops explicitly compiling CPI instructions for recording,
uses the indices gathered from instruction_accounts instead.
* Removes message::Message from invoke_context.rs completely.
* Simplifies sol_invoke_signed() of program-test
* Start search for non program accounts at front (instead of the back).
Program and programdata accounts use rposition(), everything else uses position().
* Introduces InstructionAccount which is like AccountMeta but uses an index instead of a Pubkey
* Renames InvokeContext::create_message() to InvokeContext::prepare_instruction()
* Removes Message and CompiledInstruction from InvokeContext interfaces.
* Resolves TODOs of sol_invoke_signed() in program-test.
* Moves CompiledInstruction::visit_each_account() into invoke_context.rs
* Partial revert "Updates documentation around what needs to be passed in CPI. (#21633)"
* Enforces the program_id being passed explicitly by removing it from get_instruction_keyed_accounts().
* instruction_accounts => instructions_account
* Removes Rc from Rc<RefCell<AccountSharedData>> in the program-runtime.
* Adjusts tests in bpf_loader, system_instruction_processor, config_processor, vote_instruction and stake_instruction
* Removes Rc and RefCell from PreAccount
* Splits get_account() into find_index_of_account() and get_account_at_index()
in order to remove Rc from return type.
program-runtime: add LogCollector::new_ref_with_limit()
LogCollector::new_ref_with_limit(limit: Option<usize>) can be used to
initialize a collector with the given bytes limit. The limit can be None, in
which case logs are never truncated.
new_ref_with_limit(None) is used by cargo-run-bpf-tests so that the output of
cargo test --target=bpfel-unknown-unknown is not truncated.
- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().
* Moves create_message(), native_invoke() and process_cross_program_instruction()
from the InstructionProcessor to the InvokeContext so that they can have a useful "self" parameter.
* Moves InstructionProcessor into InvokeContext and Bank.
* Moves ExecuteDetailsTimings into its own file.
* Moves Executor into invoke_context.rs
* Moves PreAccount into its own file.
* impl AbiExample for BuiltinPrograms
* Moves the Executor dyn Trait to instruction_processor.rs
* Moves the Logger dyn Trait as well as the ic_msg and ic_logger_msg macros to log_collector.rs,
and moves the stable_log to stable_log.rs
* Moves the ComputeMeter dyn Trait to invoke_context.rs
* Moves the InvokeContext dyn Trait and the ProcessInstructionWithContext type to invoke_context.rs
* Updates cargo files.
* Re-export InvokeContext in program-test
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* Move blockhash and fee_calculator in ThisInvokeContext instead of using a reference.
* Moves tx_wide_compute_cap into InvokeContext::push().
* Adds ThisInvokeContext::new_mock() constructor.
* Adds missing loader account in uses of MockInvokeContext.
* Use keyed_account_at_index() when accessing keyed_accounts.
* Makes sysvar interface consistent between ThisInvokeContext and MockInvokeContext,
in order to add InvokeContext::get_sysvars().
* Adds InvokeContext::set_blockhash() and InvokeContext ::set_fee_calculator().
* Adds new_mock_with_features.
* Makes ancestors optional in ThisInvokeContext.
* Adds prepare_mock_invoke_context() and mock_process_instruction().
* Replaces program_id field in InvokeContextStackFrame by index.
* Swaps order of program account and programdata account.
* Removes program_id parameter from InvokeContext::push().
* Adds first_instruction_account parameter to process_instruction().
* Removes InvokeContext::remove_first_keyed_account() from all BPF loaders.
* Removes InvokeContext::remove_first_keyed_account() from all builtin programs.
* Removes InvokeContext::remove_first_keyed_account() from all mock ups.
* Deprecates InvokeContext::remove_first_keyed_account().
* Documents index base of keyed_account_at_index().
* Adds dynamic offset to call sites of "keyed_account_at_index()".
* Inlines MessageProcessor::execute_instruction() in MessageProcessor::process_message().
* Moves MessageProcessor::create_pre_accounts() into ThisInvokeContext::push().
* Move instruction_recorders slice into InvokeContext.
* Makes account_indices optional in InvokeContext::push().
* Separates initial InvokeContext::push() from ThisInvokeContext::new().
* invoke_context.pop() the base invocation frame.
* Zip message.instructions.iter() and program_indices.iter().
* Moves ThisInvokeContext::new() to the beginning of the loop inside MessageProcessor::process_message().
* Hoists ThisInvokeContext::new() out of loop inside MessageProcessor::process_message().
* Removes unnecessary clone() from ThisInvokeContext::new() in MessageProcessor ::process_message().
* Stop ignoring errors from MessageProcessor::create_pre_accounts().
* Moves MessageProcessor::verify_account_references() and MessageProcessor::verify() into InvokeContext::verify().
* Inlines MessageProcessor::execute_instruction() in MessageProcessor::process_message().
* Moves MessageProcessor::create_pre_accounts() into ThisInvokeContext::push().
* Hoists ThisInvokeContext::new() out of loop inside MessageProcessor::process_message().
* Moves MessageProcessor::verify_account_references() and MessageProcessor::verify() into InvokeContext::verify().
* 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>
* 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.
* 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().