Commit Graph

251 Commits

Author SHA1 Message Date
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
Pankaj Garg 12e3e8b467
Add provisions to unload a program from the cache (#31036) 2023-04-10 16:42:05 -07:00
dependabot[bot] fe8a4015ca
Bump serde from 1.0.158 to 1.0.159 (#31119)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.158 to 1.0.159.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.158...v1.0.159)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 15:19:16 -07:00
Pankaj Garg 2613ad7d70
Fix unused import error in LoadedPrograms (#31116) 2023-04-08 00:31:23 -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 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
Alexander Meißner a6ad37f3ad
Cleanup - `load_and_get_programs_from_cache()` (#30959)
* Replaces assign_program() by replenish() in load_and_get_programs_from_cache().

* Replaces LoadedProgramEntry by a boolean.

* Only lock the global cache once all missing programs have been loaded

* Factors out call of self.rc.accounts.filter_executable_program_accounts().
2023-03-29 16:11:14 +02:00
Pankaj Garg f198d7426a
Use feature gate to set effective slot of loaded programs (#30950) 2023-03-29 04:47:49 -07:00
Yihau Chen 2c842e9932
chore: workspace inheritance (#30939)
* client/Cargo.toml

* udp-client/Cargo.toml

* tpu-client/Cargo.toml

* thin-client/Cargo.toml

* storage-proto/Cargo.toml

* quic-client/Cargo.toml

* dos/Cargo.toml

* entry/Cargo.toml

* perf/Cargo.toml

* program-runtime/Cargo.toml

* program-test/Cargo.toml

* programs/address-lookup-table/Cargo.toml

* programs/loader-v3/Cargo.toml

* connection-cache/Cargo.toml

* programs/sbf/rust/big_mod_exp/Cargo.toml

* programs/zk-token-proof-tests/Cargo.toml
2023-03-29 03:28:56 +00: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
behzad nouri 75abfc79a6
removes unused dependencies (#30917) 2023-03-28 17:25:44 +00:00
Alexander Meißner fb7d303995
Refactor - mock_process_instruction() (#30893)
* Uses InvokeContext::process_instruction() in mock_process_instruction().

* Uses InvokeContext::process_instruction() in tests of loader-v3.

* Only throw InstructionError::BuiltinProgramsMustConsumeComputeUnits if result.is_ok().

* Adds CU cost to loader-v3.
2023-03-24 22:45:03 +01: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
dependabot[bot] 027bd5f8a5
Bump serde from 1.0.152 to 1.0.158 (#30845)
* Bump serde from 1.0.152 to 1.0.158

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.152 to 1.0.158.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.152...v1.0.158)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-03-22 11:53:39 -06: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 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
K-anon 36d773810a
Add Executor Cache Eviction Strategy (#30526)
Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-03-06 15:07:01 -07: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
Yihau Chen c318002fe4
chore: bump libc to 0.2.131 (#30496) 2023-02-25 02:42:33 +08:00
Tao Zhu 66ea750182
add compute budget instruction to set loaded accounts data size limit (#30377)
* add compute budget instruction to set accounts data size limit

* changes names to explicitly for loaded accounts data size
2023-02-24 09:27:49 -06: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
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
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
kirill lykov ee1717b24b
Make clippy to be happy (#30394)
* replace default implementation with default enum

* fix format to make clippy happy
2023-02-17 20:51:18 +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
Pankaj Garg 86e59657c9
Return loaded program entry from the cache after insert (#30336)
* Return loaded program entry from the cache after insert

* update enum variant labels
2023-02-16 07:38:13 -08: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
Denis K c078ffd9ee
Added support of consumed BPF units tracing (#30042)
* Added support of consumed BPF units tracing

* Fixed "Inconsistent trace log stack" when logging units before first instruction trace

* Rewrote the solution in order to reuse `trace_log_stack` and check whether tracing is enabled

* Instruction tracing is disabled by default
2023-02-10 16:17:44 +01:00
dependabot[bot] 2b4a6a4dd9
Bump libloading from 0.7.3 to 0.7.4 (#30216)
Bumps [libloading](https://github.com/nagisa/rust_libloading) from 0.7.3
to 0.7.4.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="6e284984ae"><code>6e28498</code></a>
Fix CI</li>
<li><a
href="95a0f62e8f"><code>95a0f62</code></a>
Placate clippy</li>
<li><a
href="224a3def35"><code>224a3de</code></a>
Release 0.7.4</li>
<li><a
href="bd17713dcc"><code>bd17713</code></a>
Support AIX dyld constants</li>
<li><a
href="6e07929736"><code>6e07929</code></a>
fix typo</li>
<li><a
href="6b33651a90"><code>6b33651</code></a>
Construct a PathBuf</li>
<li><a
href="964dd8b4c0"><code>964dd8b</code></a>
Simplify lib_path</li>
<li><a
href="8009f51a9f"><code>8009f51</code></a>
Honor Cargo's target directory when building LIBPATH</li>
<li><a
href="842e377ae4"><code>842e377</code></a>
Fix a typo in the CI scripts</li>
<li>See full diff in <a
href="https://github.com/nagisa/rust_libloading/compare/0.7.3...0.7.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=libloading&package-manager=cargo&previous-version=0.7.3&new-version=0.7.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2023-02-09 10:53:18 -07:00
Pankaj Garg 375f9ae41d
LoadedPrograms cache implementation and tests (#30139) 2023-02-08 13:24:44 -08:00
Tao Zhu 4293f11cf1
feature gate to enable compute_budget::request_heap_frame on mainnetBeta (#30077) 2023-02-03 09:21:57 -06:00
dependabot[bot] 232e252014
Bump serde from 1.0.144 to 1.0.152 (#29696)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
Co-authored-by: Tyera <tyera@solana.com>
2023-02-01 16:27:17 -07: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
Denis K 2da02992b7
Fixed bug with mishmash of traces from different programs in single log (#29605)
* Fixed bug with mishmash of traces from different programs in single log

* Transformed instructions trace log into the stack of (sub)programs' trace logs
2023-01-28 10:03:31 +01: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
Tao Zhu 1d88654116
Revert "Cap accounts data a transaction can load by its requested limit" (#29373)
Revert "Cap accounts data a transaction can load by its requested limit (#27840)"

This reverts commit 81dc2e56ac.
2023-01-17 11:34:18 +01:00
samkim-crypto 6b016a8881
[curve25519 syscalls] update compute costs (#29610)
* update curve25519 syscall compute costs

* update msm compute costs
2023-01-12 08:40:27 +09:00
Yihau Chen 3032c6d3e8
chore: bump itertools to 0.10.5 (#29580) 2023-01-11 14:07:38 +08:00
Yihau Chen 6a97e84db2
chore: bump log to v0.4.17 (#29579) 2023-01-11 14:07:25 +08:00
Yihau Chen d078c041d1
chore: add missing members back to workspace.members (#29450)
* frozen-abi/macro

* program-runtime

* sdk/macro

* sdk/program

* storage-bigtable/build-proto

* fix sorting
2023-01-04 13:22:00 +08: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