1072 Commits

Author SHA1 Message Date
0661aa67ed Adds a feature gate to reject the deployment of programs with unresolved syscall symbols. (#21298) 2021-11-16 18:21:16 +01:00
d8a392c20b add new macro: pubkey! (#21245)
* add new macro: `pubkey!`

* fmt
2021-11-15 11:22:51 -08:00
f8dcb2f38b report mem stats (#21258) 2021-11-13 00:59:41 +00:00
11153e1f87 refactor cost calculation (#21062)
* - cache calculated transaction cost to allow sharing;
- atomic cost tracking op;
- only lock accounts for transactions eligible for current block;
- moved qos service and stats reporting to its own model;
- add cost_weight default to neutral (as 1), vote has zero weight;

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* Update core/src/qos_service.rs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* Update core/src/qos_service.rs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2021-11-12 01:04:53 -06:00
131c0d78c4 Fix compute budget bump (#21238) 2021-11-11 14:09:28 -08:00
6704fa011f Removes native loader entrypoints from the SDK and thus from the public interface. (#21185) 2021-11-05 12:49:04 +01:00
7200c5106e Replaces MockInvokeContext by ThisInvokeContext in tests (#20881)
* Replaces MockInvokeContext by ThisInvokeContext in BpfLoader, SystemInstructionProcessor, CLIs, ConfigProcessor, StakeProcessor and VoteProcessor.

* Finally, removes MockInvokeContext, MockComputeMeter and MockLogger.

* Adjusts assert_instruction_count test.

* Moves ThisInvokeContext to the program-runtime crate.
2021-11-04 21:47:32 +01:00
29ad081555 Stop caching sysvars, instead load them ahead of time. (#21108) 2021-11-04 09:48:34 +01:00
140a5f633d Simplify replay vote tracking by using packet metadata (#21112) 2021-11-03 09:02:48 +00:00
1adf255e3a Deprecate more Fee/Blockhash APIs (#21140) 2021-11-02 16:38:23 -07:00
bced07a099 Update fee api to use blockhash (#21054) 2021-10-29 13:52:59 -07:00
4aa12a52b6 Feature cleanup (#21038) 2021-10-28 09:04:03 -07:00
036d7fcc81 Clean up sanitized tx creation for tests (#21006) 2021-10-27 18:09:16 +01:00
1e2bef76e3 Add compute budget program as a noop (#20992) 2021-10-26 20:08:59 -07:00
2515f6a04f Update deprecation versions (#20959) 2021-10-26 09:06:41 -07:00
cf0fd5b2ca Moves NonceKeyedAccount from the SDK to the Runtime. (#20954) 2021-10-25 22:58:18 +02:00
bfbbc53dac Divorce the runtime from FeeCalculator (#20737) 2021-10-22 14:32:40 -07:00
e7c9b9329d Fixes a bug in MockInvokeContext::get_compute_meter() and adjusts the test assert_instruction_count accordingly. (#20854)
The get_compute_meter() method created a reference to a clone instead of cloning the reference.
2021-10-22 09:46:47 +02:00
97c2732d02 Refactor: Cleanup InvokeContext (#20785)
* 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().
2021-10-21 20:57:42 +02:00
58164517e4 Add program heap bump instruction (#20607) 2021-10-19 21:01:39 -07:00
d9b0fc0e3e Remove @brief annotations from Rust API docs (#20769) 2021-10-19 15:48:15 -06:00
e98cfbb570 Removes deprecated BpfComputeBudget. (#20728) 2021-10-18 09:55:41 +02:00
0c0384ec32 revises turbine peers shuffling order (#20480)
Turbine randomly shuffles cluster nodes on a broadcast tree for each
shred. This requires knowing the stakes and nodes' contact-infos (from
gossip).

However gossip is subject to partitioning and propogation delays.
Additionally unstaked nodes may join and leave the cluster at any
moment, changing the cluster view from one node to another.

This commit:
* Always arranges the unstaked nodes at the bottom of turbine broadcast
  tree.
* Staked nodes are always included regardless of if their contact-info
  is available in gossip or not.
* Uses the unbiased WeightedShuffle construct for shuffling nodes.
2021-10-14 15:09:36 +00:00
da45be366a Remove blockhash from fee calculation (#20641) 2021-10-13 13:10:58 -07:00
1d813ea078 Refactor: Make program_id always last in program chain (#20598)
* Replaces program_id field in InvokeContextStackFrame by index.

* Swaps order of program account and programdata account.

* Removes program_id parameter from InvokeContext::push().
2021-10-13 08:58:20 +02:00
c231cfe235 Reduce budget request instruction length (#20636) 2021-10-12 20:56:24 -07:00
f30f3bddbb Refactor: Remove program_id from process_instruction() (#20540)
* Replaces usage of program_id parameter by invoke_context.get_caller()?.

* Removes "pubkey: &Pubkey" parameter from "process_instruction()".
2021-10-10 22:29:18 +02:00
4e65487d2f Refactor: process_instruction() (#20448)
* 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()".
2021-10-08 11:41:07 +02:00
177a375479 Tpu vote 1.7 (#20187) (#20494)
* Add separate vote processing tpu port

* Add feature to send to tpu vote port

* Add vote rejecting sigverify mode

* use packet.meta.is_simple_vote_tx in place of deserialization

* consolidate code that identifies vote tx atcommon path for cpu and gpu

* new key for feature set

* banking forward tpu vote

* add tpu vote port to dockerfile and other review changes

* Simplify thread id compare

* fix a test; updated cluster_info ABI change

Co-authored-by: Tao Zhu <tao@solana.com>

Co-authored-by: sakridge <sakridge@gmail.com>
2021-10-07 09:38:23 +00:00
785fcb63f5 Remove support for dynamically loaded native programs (#20444) 2021-10-06 14:53:23 -07:00
7027d56064 Resolve nightly-2021-10-05 clippy complaints 2021-10-06 10:37:58 -07:00
129716f3f0 Optimize stakes cache and rewards at epoch boundaries (#20432)
* Optimize stakes cache and rewards at epoch boundaries

* Fetch from accounts db

* Add cli flag for disabling epoch boundary optimization
2021-10-06 00:53:26 -04:00
2400e86d13 Simplify ed25519 instruction index
Allow u16::MAX to be specified for the instruction index. This makes it
possible to specify the current instruction, so it is not necessary to
know the instruction number.
2021-10-05 14:14:05 +01:00
4de5fff3ca Simplifies return_data accessors in InvokeContext. (#20290) 2021-09-29 19:11:06 +02:00
57c8abf499 Refactor: Merge message processor into invoke context (#20308)
* 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().
2021-09-29 12:05:25 -05:00
8fee9a2e1a Dont call precompiled programs (#19930) 2021-09-29 06:25:08 +00:00
491877de3d Revert "Refactor: Merge MessageProcessor into InvokeContext (#20165)" (#20301)
This reverts commit df6905c3a6.
2021-09-28 16:59:01 -07:00
2cd9dc99b6 Restore ability for programs to upgrade themselves (#20265)
* Make helper associated fn

* Add feature definition

* Add handling to preserve program-id write lock when upgradeable loader is present; restore bpf upgrade-self test

* Use single feature
2021-09-28 09:59:08 -06:00
4e27543415 Allow programs to realloc their accounts within limits (#19475) 2021-09-28 01:13:03 -07:00
df6905c3a6 Refactor: Merge MessageProcessor into InvokeContext (#20165)
* 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().
2021-09-27 08:28:45 +02:00
198929fe8b sigverify to identify and mark simple vote transaction 2021-09-26 08:57:29 -04:00
88fd9670df add a few useful methods to AtomicInterval (#20152) 2021-09-24 10:27:23 -05:00
7b365c564f runtime: remove inactive delegation from stakes cache 2021-09-22 20:50:58 -06:00
d714cf659c Proposal: log binary data for Solidity
The program_id is not needed on "Program return data: " because it
always preceeded by the program invoke message, so no need to repeat
the program id. Also rename this to "Program return: " since "data"
is redundant.
2021-09-22 07:59:06 +01:00
b507715d44 CPI without Account Refs (#20034)
* 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>
2021-09-21 14:41:02 +02:00
ea34eb8a4b Update feature switch for reduced required deploy balance (#19999) 2021-09-19 14:50:41 -05:00
65227f44dc Optimize RPC pubsub for multiple clients with the same subscription (#18943)
* reimplement rpc pubsub with a broadcast queue

* update tests for new pubsub implementation

* fix: fix review suggestions

* chore(rpc): add additional pubsub metrics

* integrate max subscriptions check into SubscriptionTracker to reduce locking

* separate subscription control from tracker

* limit memory usage of items in pubsub broadcast queue, improve error handling

* add more pubsub metrics

* add final count metrics to pubsub

* add metric for total number of subscriptions

* fix small review suggestions

* remove by_params from SubscriptionTracker and add node_progress_watchers map instead

* add subscription tracker tests

* add metrics for number of pubsub notifications as a counter

* ignore clippy lint in TokenCounter

* fix underflow in token counter

* reduce queue capacity in pubsub tests

* fix(rpc): fix test timeouts

* fix race in account subscription test

* Add RpcSubscriptions::new_for_tests

Co-authored-by: Pavel Strakhov <p.strakhov@iconic.vc>
Co-authored-by: Nikita Podoliako <n.podoliako@zubr.io>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-09-17 13:40:14 -06:00
fc2bf2d3b6 Cleanup and standardize precompiles (#19918) 2021-09-17 11:36:57 -07:00
7b0bf64404 cleanup old features (#19956) 2021-09-17 09:46:49 -07:00
00d7981f64 Fix native invoke writable privileges (#19750)
* Fix native invoke writable privileges

* build downstream spl bpf programs for tests
2021-09-13 22:57:37 -07:00