Commit Graph

1745 Commits

Author SHA1 Message Date
d513b0c4ca Add Program loader/environment instruction errors (#14120) 2020-12-15 09:54:07 -08:00
ab98c1f2d4 Add try_find_program_address syscall (#14118) 2020-12-15 08:15:01 -08:00
9e90394583 Upgradeable loader (#13689) 2020-12-14 15:35:10 -08:00
7143aaa89b Clippy 2020-12-14 08:03:29 -08:00
de9ac43ebf Simple cap by including sysvars and native programs (#13884)
* Simpler cap by including sysvars and native programs

* Fix tests

* Add comment

* revert some unrelated code

* Update test_bank_update_sysvar_account for cap.

* Test cap. for add_native_program using new helper

* Improve the cap adjustment with new tests

* Fix typo...

* Adjust test for improved code coverage

* Rename simpler_capitalization => simple_capitalization

* More rename and bonus commenting
2020-12-14 21:03:24 +09:00
88d950e5a8 chore: bump log from 0.4.8 to 0.4.11 (#13691)
* chore: bump log from 0.4.8 to 0.4.11

Bumps [log](https://github.com/rust-lang/log) from 0.4.8 to 0.4.11.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.8...0.4.11)

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

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2020-12-13 13:48:23 +09:00
1d95b5476e Add next_account_infos helper (#14087) 2020-12-12 20:12:56 -08:00
a9185d4ea1 chore: bump rustversion from 1.0.3 to 1.0.4 (#14022)
* chore: bump rustversion from 1.0.3 to 1.0.4

Bumps [rustversion](https://github.com/dtolnay/rustversion) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/dtolnay/rustversion/releases)
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.3...1.0.4)

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

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2020-12-13 03:56:27 +09:00
edff62af3d Switch to memmap2 fork 2020-12-11 23:44:03 +00:00
d6eff3d62c Filter out stake and vote accounts with incorrect owners (#14062)
* Add failing test

* Check stake/vote accounts for validity

* Feature gate change

* Add datapoint

* Add test realism
2020-12-11 12:21:25 -07:00
0a9ff1dc9d Initial solana-test-validator command-line program 2020-12-11 04:17:38 +00:00
164b7895b3 Tiny add_native_program bug fixes with cleanups (#14042)
* Tiny add_native_program bug fixes with cleanups

* Fix typo
2020-12-11 11:03:31 +09:00
d9655ea507 Add message helpers to get program info (#14047) 2020-12-10 16:39:43 -08:00
7abd8084b6 Add get_minimum_balance_for_rent_excemption to Client (#14048) 2020-12-10 16:39:28 -08:00
5ea80e673f Fix priv escalation test (#14046) 2020-12-10 22:36:33 +00:00
1dc71fb5aa Bump criterion to v2.3.3 (#14002) 2020-12-07 21:53:28 +00:00
20c0e8793e Rent account passed to loader can be read-only (#13997) 2020-12-07 19:44:32 +00:00
a706706572 Validator CLI option to enable just-in-time compilation of BPF (#13789)
* Adds a CLI option to the validator to enable just-in-time compilation of BPF.

* Refactoring to use bpf_loader_program instead of feature_set to pass JIT flag from the validator CLI to the executor.
2020-12-07 09:49:55 +01:00
3f841df7cf Cap number of program address seeds (#13924) 2020-12-02 22:25:06 +00:00
17defbff13 Make Accounts::is_non_loader_key() a method on Message 2020-12-02 20:10:08 +00:00
274312ebb5 sdk: Check owner when verifying nonce accounts 2020-12-02 20:10:08 +00:00
aebc3a17ce Fix undefined symbol "custom panic" in BPF test programs (#13840)
* Implements missing "custom_panic" symbol
2020-12-01 16:52:20 +01:00
57dd60f671 Use msg! in program entrypoint (#13889) 2020-12-01 10:56:26 +00:00
6705b5a98c Add msg! macro for program logging, deprecate info! macro 2020-11-30 20:39:42 -08:00
e1793e5a13 caches vote-state de-serialized from vote accounts (#13795)
Gossip and other places repeatedly de-serialize vote-state stored in
vote accounts. Ideally the first de-serialization should cache the
result.

This commit adds new VoteAccount type which lazily de-serializes
VoteState from Account data and caches the result internally.

Serialize and Deserialize traits are manually implemented to match
existing code. So, despite changes to frozen_abi, this commit should be
backward compatible.
2020-11-30 17:18:33 +00:00
c930f92411 Restore bank feature used to deprecate Rewards sysvar (#13786) 2020-11-24 10:22:31 -07:00
c833ede4af Rbpf v0.2.1 (#13732)
* Refactoring to match rbpf-v0.2.1 and add JIT compilation caching.

* Removes obsolete bpf-trace.py which has been replaced by the rbpf CLI tool.
2020-11-24 18:00:19 +01:00
c75d97e3f2 Add new inflation feature-ids (#13671)
* Add new inflation feature-ids, and full_inflation default values

* Compute inflation start from full_inflation activation

* Include pico_inflation in inflation start computation

* Add full-inflation constructor

* Align inflation taper with rewards accrual start and catch overflow edge case
2020-11-20 09:54:41 -07:00
43d5e47ea9 Rewrite stake accounts for clear migration (#13461)
* Reduce overage stake by rewritng stake accounts

* Write tests and finish implemention

* Create and use new feature gate

* Clean up logging

* Fix typo

* Simplify enable_rewrite_stake

* Fix typo...

* Even simplify gating

* Add metrics
2020-11-20 05:15:06 +09:00
f25c969ad8 Disable publishing of cargo-build-bpf/cargo-test-bpf to crates.io 2020-11-18 19:09:04 +00:00
baa6b3a261 Add stable program logging for BPF and native programs 2020-11-14 08:26:01 -08:00
9f95704706 Add --offline flag 2020-11-12 20:03:12 -08:00
48dd9f7efd Move secp256k1 instruction helper to the sdk (#13560) 2020-11-12 16:58:40 -08:00
e390c8cb7f Add stubs and heap region definitions (#13521)
* Add stubs and heap region definitions

* nudge
2020-11-11 05:50:16 +00:00
91f4e99b4c Fix parsing CreateAccountWithSeed instructions (#13513)
* Reduce required num_system_accounts and handle 2-account instructions properly

* Update CreateAccountWithSeed account docs to be correct

* Add CreateAccountWithSeed test
2020-11-10 23:51:53 +00:00
9ca8e98525 Add printf declaration (#13514) 2020-11-10 23:40:48 +00:00
23c558510a add missing c logging stubs (#13511) 2020-11-10 22:19:54 +00:00
c280d40b40 align cluster and sim logging as hex (#13484) 2020-11-10 02:43:20 +00:00
c0e2ef06dc Fix Bank accounts hash mismatch related to Clock::unix_timestamp (#13477)
* Test for different ancestors with mismatch bank hash

* Test cleanup

* Remove nondeterministic ancestor check

* Update timestamp bounding feature key

* Update design doc

* Filter recent_timestamps to nodes voting within the last epoch

Co-authored-by: Stephen Akridge <sakridge@gmail.com>
2020-11-10 02:10:09 +00:00
461ae40eea provide full Rust panic messages in BPF and add memory optimizations (#13455) 2020-11-09 13:40:26 -08:00
73ac104df2 propagates errors out of Packet::from_data (#13445)
Packet::from_data is ignoring serialization errors:
https://github.com/solana-labs/solana/blob/d08c3232e/sdk/src/packet.rs#L42-L48
This is likely never useful as the packet will be sent over the wire
taking bandwidth but at the receiving end will either fail to
deserialize or it will be invalid.
This commit will propagate the errors out of the function to the
call-site, allowing the call-site to handle the error.
2020-11-08 15:10:03 +00:00
4c5f345798 Fix stake split rent-exempt adjustment (#13357)
* Add failing tests

* Fix stake split

* Calculate split rent-exempt-reserve and use

* Add comment in rent.rs

* Add tests for edge cases when splitting to larger accounts, and reject overflow splits

* Reframe InsufficientFunds checks in terms of lamports var

* Test hardening review comments
2020-11-06 20:32:05 +00:00
0ea795caa8 cargo-build-bpf/cargo-test-bpf now support --workspace/--all 2020-11-06 12:27:46 -08:00
1a70a2a25b cargo-test-bpf now sets the "test-bpf" feature for crate tests
The feature allows for tests to distinguish between `cargo test` and
`cargo test-bpf` primarily for the purpose of excluding CPI tests that
require the system program under `cargo test`, as the path to enabling
CPI in `cargo test`-based testing is unclear
2020-11-06 10:21:07 -08:00
1b1d9f6b0c Feature-gate stake program (#13394)
* Add legacy stake-program handling

* Strip out duplicative legacy code

* Add feature for stake-program-fix

* Feature-deploy new stake program

* Expand comment
2020-11-06 08:08:11 +00:00
b511e51415 Define BPF_OUT_DIR for program-test, also handle -- arguments better 2020-11-05 14:29:17 -08:00
77d9d06a44 Search BPF_OUT_DIR for programs 2020-11-05 14:29:17 -08:00
5a435a4342 Check file modification times before strip and dump 2020-11-05 14:29:17 -08:00
6c36a2085f Add cargo-test-bpf 2020-11-05 14:29:17 -08:00
8c4995b22b Improve invoke_signed() docs 2020-11-04 23:44:04 +00:00