Pankaj Garg
fb6e02c46c
Retain usage counter on program upgrade ( #31142 )
...
* Retain usage counter on program upgrade
* cleanup as per feedback
* fix clippy
2023-04-11 09:43:42 -07:00
Alexander Meißner
0cd57addcf
Cleanup - mock_process_instruction() ( #31088 )
...
* Uses declare_process_instruction!() in all tests.
* Adds post_adjustments to mock_process_instruction().
Removes "solana_sbf_rust_external_spend" from assert_instruction_count() as it panics.
2023-04-07 12:53:19 +02:00
Pankaj Garg
83e17d8e44
Add expiration slot to loaded program cache entry ( #31034 )
2023-04-05 09:26:28 -07:00
Alexander Meißner
24a87f33a8
Refactor - Cleanup error handling in program runtime ( #30693 )
...
* Moves stable_log::program_invoke(), stable_log::program_success() and stable_log::program_failure() calls from bpf_loader into InvokeContext::process_executable_chain().
* Turns result of ProcessInstructionWithContext from InstructionError into Box<dyn std::error::Error>.
* Bump to solana_rbpf v0.3.0
* Removes Result from return type of EbpfVm::new().
* Turns EbpfError into Box<dyn std::error::Error>.
* Removes BpfError.
* Removes SyscallError::InstructionError.
* Adds a type alias for Box<dyn std::error::Error> in syscalls.
2023-04-05 15:50:34 +02:00
Alexander Meißner
911489d373
Feature - Stop truncating strings in syscalls ( #31030 )
...
* Adds the feature gate stop_truncating_strings_in_syscalls.
* Removes the truncation of everything after the first NULL byte in translate_string_and_do().
2023-04-04 19:33:53 +02:00
Alexander Meißner
a0c7fde90e
Cleanup - mock InvokeContext ( #31007 )
...
* Turns with_mock_invoke_context() into a macro.
* Removes prepare_mock_invoke_context().
* Replaces InvokeContext::new_mock() with with_mock_invoke_context().
* Removes InvokeContext::new_mock().
* Removes Cow from InvokeContext::sysvar_cache.
* Removes override parameters from mock_process_instruction().
* cargo fmt
2023-04-03 17:23:24 +02:00
Pankaj Garg
f198d7426a
Use feature gate to set effective slot of loaded programs ( #30950 )
2023-03-29 04:47:49 -07:00
Pankaj Garg
aebc191c38
Stop loading program accounts if program exists in cache ( #30703 )
...
* Stop loading program accounts if program exists in cache
* load accounts for upgradeable programs
* revert loader change to conditionally use program data account
* load instruction accounts
* generate TransactionExecutorCache from loaded programs
* cleanup account_found_and_dep_index variable
* address review comments
* handle tombstones in loader
* unify tombstone constructor
* handle multiple tombstones
2023-03-28 11:49:56 -07:00
Pankaj Garg
cbf70430a5
Fix deployment slot for upgraded programs ( #30902 )
2023-03-27 06:48:26 -07:00
Pankaj Garg
0df28f6d51
Increment usage count for loaded programs and call eviction ( #30900 )
2023-03-27 06:48:05 -07:00
Tao Zhu
3e500d9e92
Feature gate builtin consumes static units during processing instruction ( #30702 )
...
* add feature gate
* builtins consume statically defined units at beginning of process_instruction()
* Add new instructionError; return error if builtin did not consume units to enforce builtin to consume units;
* updated related tests
* updated ProgramTest with deactivated native_programs_consume_cu feature to continue support existing mock/test programs that do not consume units
2023-03-24 11:31:01 -05:00
Alexander Meißner
c10f337f85
Feature - Loader built-in program v3 ( #30464 )
...
* Adds loader-v3 in SDK.
* Adds loader-v3 built-in program.
* Adds tests.
2023-03-23 18:13:47 +01:00
Alexander Meißner
66da71fa7a
Fix - Revert and feature gate incorrect error message in BPF loader ( #30748 )
...
* Revert to old behavior.
* Adds feature gate.
2023-03-21 11:08:41 +01:00
Tao Zhu
17ba051e1f
Revert "add default_cost as mandatory field for Builtin ( #30639 )" ( #30749 )
...
This reverts commit 7b95c8e698
.
2023-03-16 11:21:06 -05:00
Tao Zhu
a4ad0c75fc
fix heap cost calculation rounding error ( #30673 )
...
* add test for refaction heap size, fix size truncating by div op
* add feature gate
* checked result of consume_checked() if feature is activated
2023-03-15 12:03:04 -05:00
Tao Zhu
7b95c8e698
add default_cost as mandatory field for Builtin ( #30639 )
...
* add default_cost as mandatory field for Builtin
* updated tests
* set zkp program default to VerifyTransfer CUs
---------
Co-authored-by: Jon Cinque <joncinque@pm.me>
2023-03-10 14:02:24 -06:00
Alessandro Decina
0335ea7249
Bump solana_rbpf to v0.2.40 ( #30668 )
...
Update to solana_rbpf v0.2.40
2023-03-10 19:05:29 +01:00
Alexander Meißner
d2fc2e5f62
Refactor - Remove `first_instruction_account` in `bpf_loader` ( #30614 )
...
* Removes first_instruction_account from process_loader_upgradeable_instruction(), process_loader_instruction() and write_program_data().
* Removes first_instruction_account from process_instruction_common().
* Removes get_index_in_transaction() and try_borrow_account().
2023-03-08 16:54:19 +01:00
Alexander Meißner
38e74325e3
Refactor - Remove `process_instruction` parameter `first_instruction_account` ( #30579 )
...
* Stops using first_instruction_account parameter in bpf_loader.
* Removes first_instruction_account parameter from process_instruction().
2023-03-06 17:37:37 +01:00
Alexander Meißner
31bd695b83
Feature - `switch_to_new_elf_parser` ( #30498 )
...
Adds feature gate "switch_to_new_elf_parser".
2023-03-01 09:13:00 +01:00
K-anon
3ed63de656
Revert "Revert "Add test for executor cache runtime feature upgrades.… ( #30428 )
2023-02-24 10:04:51 -07:00
Yihau Chen
df3ef111f7
chore: workspace inheritance ( #29893 )
...
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
2023-02-23 22:01:54 +08:00
Michael Vines
5136ed3448
Update homepage value for all crates ( #30444 )
2023-02-23 02:20:18 +00:00
K-anon
2e4b8ea8bb
Revert "Add test for executor cache runtime feature upgrades. ( #30382 )" ( #30424 )
...
This reverts commit c5a24e11ba
.
Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-02-21 15:47:39 -07:00
Pankaj Garg
b1f5b0d790
Find and load missing programs in LoadedPrograms cache ( #30275 )
...
* Find and load missing programs in LoadedPrograms cache
- filter program accounts in a transaction batch
- filter the accounts that are missing in LoadedPrograms cache
- load the programs before processing the transactions
- unit tests
* address review comments
* fix clippy
* address review comments
* fix test
* fix more tests
2023-02-21 12:53:35 -08:00
K-anon
c5a24e11ba
Add test for executor cache runtime feature upgrades. ( #30382 )
...
Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-02-21 12:25:29 -07:00
Alexander Meißner
4bfcbf75eb
Bump solana_rbpf to v0.2.39 ( #30398 )
...
* Bump solana_rbpf to v0.2.39
* Adds MemoryRegion::vm_addr_end.
2023-02-21 18:43:34 +01:00
Pankaj Garg
3a4ba72daf
Remove executors trait and replace with LoadedProgram ( #30348 )
...
* Remove executors trait and replace with LoadedProgram
* fill in deployment slot
* address review comments
* fix clippy warnings
* address review comments
* fix failures caught by sbf tests
2023-02-17 12:47:45 +01:00
Brooks
0c36e4c82d
Adds stable layout types to pass to the runtime ( #30192 )
2023-02-16 08:16:25 -05:00
Pankaj Garg
a9ad0f2b5a
Code to load a program from its account ( #30282 )
2023-02-15 09:05:26 -08:00
Alexander Meißner
6558c8fdc9
Refactor - Delay visibility of program un-/re-/deployment ( #29654 )
...
* Use three separate HashMaps instead of the enum TxBankExecutorCacheDiff.
* Replaces all places which deploy programs by a macro.
* Adds a feature gate.
* Adjust tests.
* Makes undeployment visible immediately.
2023-02-11 11:18:25 +01:00
Alexander Meißner
f7dfe8337a
Moves `if use_jit` outside of `#[cfg()]`. ( #30202 )
2023-02-09 09:14:26 +01:00
Alexander Meißner
d387f15587
Refactor - Remove redundant `use_jit` flag from `BpfExecutor` ( #30116 )
2023-02-07 10:05:54 +01:00
Alexander Meißner
dad1610742
Extends `enable_program_redeployment_cooldown` to closing programs ( #29981 )
2023-02-01 18:07:34 +01:00
Will Hickey
04a6a631bc
Bump version to v1.16 ( #30028 )
2023-01-31 17:48:33 -06:00
joeaba
a12bf8c003
Update maintainers references ( #29997 )
...
* update maintainers references
* chore: update maintainers reference
2023-01-31 08:07:13 -05:00
Yihau Chen
9193b4221d
Revert "chore: workspace inheritance ( #29509 )" ( #29892 )
...
This reverts commit a67d239dde
.
2023-01-25 15:50:41 +08:00
Yihau Chen
a67d239dde
chore: workspace inheritance ( #29509 )
...
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
2023-01-25 13:59:59 +08:00
valiksinev
5f7fea100a
Big integer modular exponentiation (EIP-198) ( #28503 )
...
* big_mod_exp impl
* fix programs/sbf/Cargo.lock
* ComputeBudget impl
* update compute_budget
* compute_budget update
* fix build
* fix tests
* fix cargo clippy
* fix clippy
* fix bpf_loader dependency sorting
* fix sorting
* fix merge from master
* fix cargo fmt
* fix C-tests
* fix cargo fmt
* comments apply
* fix programs/sbf/Cargo.lock
* update compude_budget cost
* remove whitespaces
* fix cargo fmt
Co-authored-by: sinev-valentine <sinev-valentine@yandex.ru>
2023-01-20 18:42:37 +09:00
Alexander Meißner
9d1a0c52f8
Cleanup - `disable_deprecated_loader` ( #29653 )
...
* Removes the gating of disable_deprecated_loader.
* Adds create_program().
Renames create_deprecated_program() -> load_program().
Renames load_and_finalize_deprecated_program() -> load_and_finalize_program().
* Fixes test_sol_alloc_free_no_longer_deployable().
2023-01-14 13:02:10 +01:00
Trent Nelson
61e2da45f8
fix: synchronize cpi error prioritization with v1.14 (fp #29593 ) ( #29621 )
...
* Revert "Removes `serialized_len_ptr` from `CallerAccount`. (#26737 )"
36cfa78fa0
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
2023-01-10 14:28:38 -07:00
Alessandro Decina
0a5164d887
Remove checks for activated feature check_physical_overlapping ( #29355 )
2022-12-22 19:07:08 +11:00
Brennan Watt
830ccb9bff
Fix compile warning for some targets ( #29258 )
...
* Fix compile warning for some targets
* Reduce redundant code
2022-12-14 20:40:13 +01:00
Alexander Meißner
721496b900
Feature - Program redeployment cooldown ( #29136 )
...
* Registers the feature enable_program_redeployment_cooldown.
* Adds redeployment slot constraint.
* Adds test to assert that closed programs can not be reopened.
* Ensure that program close truncates the account data.
* Adds set_sysvar_for_tests() to SBF program tests.
2022-12-13 22:54:24 +01:00
Alexander Meißner
025b35af40
Cfg disable JIT code on systems where it is not supported ( #29208 )
...
Cfg disable JIT code on systems where it is not supported.
2022-12-12 15:29:38 +01:00
Alexander Meißner
013f784e92
Bump solana_rbpf to v0.2.38 ( #29137 )
...
* Refactor register_syscalls() => create_loader().
* Bumps solana_rbpf to v0.2.38
* Replaces Config::encrypt_environment_registers by Config::runtime_environment_key.
* Adds pc parameter to MemoryMapping::map()
* Removes debugger from rbpf CLI.
* Adds debugger to rbpf CLI again.
* Renames vm.context_object => vm.env.context_object_pointer.
* Renames SyscallRegistry => BuiltInProgram.
Renames SyscallFunction => BuiltInFunction.
Renames register_syscall_by_name() => register_function_by_name().
* Removes ContextObject from Analysis.
* Renames Config::error_on_syscall_bpf_function_hash_collisions => Config::external_internal_function_hash_collision.
2022-12-12 08:47:09 +01:00
behzad nouri
9524c9dbff
patches errors from clippy::uninlined_format_args
...
https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
2022-12-06 19:32:15 +00:00
Alexander Meißner
0475c2f0af
Fix - Turns binary `&` into logical `&&` in `translate_slice_inner()`. ( #29038 )
...
Turns binary & into logical && in translate_slice_inner().
2022-12-02 15:10:07 +01:00
Alexander Meißner
f766895f78
Adds a feature ID for `enable_alt_bn128_syscall` ( #28908 )
...
Adds a feature ID for enable_alt_bn128_syscall.
2022-12-01 09:58:23 +01:00
Alessandro Decina
bee24a81b8
Refactor CPI, add tests and sprinkle some comments ( #28544 )
...
* bpf_loader: cpi: split account update code to update_caller_account and add tests
* bpf_loader: cpi: set CallerAccount::original_data_len earlier
* cpi: add CallerAccount::from_account_info and CallerAccount::from_sol_account_info
* cpi: refactor common account info translation code in translate_account_infos
* update_caller docs
* cpi: rename translate_accounts to translate_and_update_accounts
* cpi: refactor pre-cpi account update code into update_callee_account
* cpi: add tests for CallerAccount::from_account_info
* cpi: add test for SyscallInvokeSignedRust::translate_accounts
* cpi: fix lints
* cpi: add test for translate_instruction()
* cpi: add test for translate_signers
* cpi: fix lint
* cpi: review fixups round 1
* cpi: more review fixups
Replace ugly MockInvokeContext with a macro
* cpi: more review fixes
replace get_callee with macro
* cpi: more review fixes
Add MockAccountInfo::new
* Fix rebase mistake
2022-11-23 23:22:50 +11:00