1072 Commits

Author SHA1 Message Date
098585234d Add return data implementation
This consists of:
 - syscalls
 - passing return data from invoked to invoker
 - printing to stable log
 - rust and C SDK changes
2021-09-10 14:25:54 +01:00
88c1b8f047 Index loaders / executable accounts (#19469)
* 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().
2021-09-10 08:36:21 +02:00
38bbb77989 Return error if Transaction contains writable executable or ProgramData accounts (#19629)
* Return error if Transaction locks an executable as writable

* Return error if a ProgramData account is writable but the upgradable loader isn't present

* Remove unreachable clause

* Fixup bpf tests

* Review comments

* Add new TransactionError

* Disallow writes to any upgradeable-loader account when loader not present; remove is_upgradeable_loader_present exception for all other executables
2021-09-08 15:21:52 -06:00
778b2adbea Check seed length before trying to cal program address (#19699) 2021-09-07 21:37:24 -07:00
529fefc7cc Remove native id check in pda creation (#19595) 2021-09-07 14:44:52 -07:00
8b9e472a6c feat: add ed25519 signature verify program
Solang requires a method for verify ed25519 signatures. Add a new
builtin program at address Ed25519SigVerify111111111111111111111111111
which takes any number of ed25519 signature, public key, and message.
If any of the signatures fails to verify, an error is returned.

The changes for the web3.js package will go into another commit, since
the tests test against a released solana node. Adding web3.js ed25519
testing will break CI.
2021-09-05 18:59:37 +01:00
d461a9ac10 verify_precompiles needs FeatureSet
Rather than pass in individual features, pass in the entire feature set
so that we can add the ed25519 program feature in a later commit.
2021-09-05 18:59:37 +01:00
decec3cd8b Demote write locks on transaction program ids (#19593)
* Add feature

* Demote write lock on program ids

* Fixup bpf tests

* Update MappedMessage::is_writable

* Comma nit

* Review comments
2021-09-04 03:05:30 +00:00
2c3bdedea3 stake: Advance credits_observed on activation epoch (#19309)
* stake: Advance `credits_observed` on activation epoch

* Add test for merging stakes just after activation
2021-09-03 23:20:56 +02:00
5cf8d8795b Feature cleanup (#19528) 2021-08-31 14:51:26 -07:00
6909a79b6f removes require-stake-for-gossip feature (#19476)
The feature is already activated on all clusters.
2021-08-27 21:17:15 +00:00
c52d3736e8 Clean up feature set entries (#19427)
* Clean up feature set entries

* fix test

* bump
2021-08-25 13:57:27 -07:00
a89f180145 Allow closing upgradeable program accounts (#19319) 2021-08-24 10:05:54 -07:00
96360f3139 clippy: Use unwrap_or_default()
Clippy was unhappy:

```text
error: use of `.unwrap_or_else(..)` to construct default value
   --> sdk/src/signer/keypair.rs:171:27
    |
171 |     let derivation_path = derivation_path.unwrap_or_else(DerivationPath::default);
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `derivation_path.unwrap_or_default()`
    |
    = note: `-D clippy::unwrap-or-else-default` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_else_default
```
2021-08-23 11:17:21 -05:00
3e5ba8dcaa bug: sysvar::Instructions is not owned by Sysvar1111111111111111111111111111111111111 (#19242)
* Fix instructions sysvar owner

* Update feature switch address

Co-authored-by: Justin Starry <justin@solana.com>
2021-08-20 08:32:28 -07:00
73aa004c59 stake: Remove v2 program references (#19308)
* stake: Remove v2 program references

* Remove stake v2 feature, along with stake rewrite
2021-08-20 01:08:44 -04:00
3ec33e7d02 Fail secp256k1 if the instruction data looks incorrect (#19300) 2021-08-19 13:13:54 -07:00
e1fb45bd3f nit: fix case (#19321) 2021-08-19 09:46:06 -07:00
c50b01cb60 Store versioned transactions in the ledger, disabled by default (#19139)
* Add support for versioned transactions, but disable by default

* merge conflicts

* trent's feedback

* bump Cargo.lock

* Fix transaction error encoding

* Rename legacy_transaction method

* cargo clippy

* Clean up casts, int arithmetic, and unused methods

* Check for duplicates in sanitized message conversion

* fix clippy

* fix new test

* Fix bpf conditional compilation for message module
2021-08-17 15:17:56 -07:00
9be988db41 Fix memoverlap check (#19232) 2021-08-16 16:16:52 -07:00
0b50bb2b20 Deprecate FeeCalculator returning APIs (#19120) 2021-08-13 09:08:20 -07:00
414d904959 Reject blocks for costs above the max block cost (#18994)
* added realtime cost checking logic to reject block that would exceed max limit:
- defines max limits at block_cost_limits.rs
- right after each bath's execution, accumulate its cost and check again
  limit, return error if limit is exceeded

* update abi that changed due to adding additional TransactionError

* To avoid counting stats mltiple times, only accumulate execute-timing when a bank is completed

* gate it by a feature

* move cost const def into block_cost_limits.rs

* redefine the cost for signature and account access, removed signer part as it is not well defined for now

* check if per_program_timings of execute_timings before sending
2021-08-12 10:48:47 -05:00
85befbc8cd Removes bpf_loader_upgradeable_program feature gate. (#19102) 2021-08-11 00:08:57 +02:00
8817f59b6e Version transaction message and add new message format (#18725)
* Version transaction message and add new message format

* Update abi digest due to message path change

* Update v0.rs

Fix comment

* Update original.rs

* Update message versions name and address map indexes field name

* s/original/legacy

* update comment

* cargo fmt

* Update abi digest due to legacy rename
2021-08-09 22:03:39 -07:00
b67ffab370 Add more API documentation for Rust RpcClient (#19021)
* Add doc links to Transaction API docs

* Add more RpcClient API docs

* Reflow some rpc_client docs

* Update client/src/rpc_client.rs

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

* Update client/src/rpc_client.rs

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

* Update client/src/rpc_client.rs

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

* Update sdk/src/transaction.rs

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

* Update RpcClient docs per review

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2021-08-05 15:03:33 -06:00
2b33c0c165 stake: Allow stakes with unmatched credits observed to merge (#18985)
* stake: Allow stakes with unmatched credits observed to merge

* Address feedback

* Remove branch by doing a ceiling in one calc
2021-08-04 10:43:34 -04:00
0a63f65c03 Bumps solana_rbpf to v0.2.14 (#18869)
* Bumps solana_rbpf to v0.2.14

* Feature gate for verify_mul64_imm_nonzero as discussed in #17520.
2021-08-04 09:50:28 +02:00
77861e2d40 Feature disable fees sysvar (#18981)
* Feature disable fees sysvar

* nudge
2021-08-02 00:31:11 +00:00
21bc43ed58 nonce: Unify NonceError with SystemError 2021-07-30 14:47:14 -06:00
ef17cf3bdb Cleanup loader features (#18977) 2021-07-29 15:03:00 -07:00
9529284194 Nonce gets blockhash from invoke_context (#18950) 2021-07-29 01:50:20 -07:00
84e78316b1 Write helper for multithread update (#18808) 2021-07-29 03:16:36 +02:00
0167daa116 cleanup feature consistent_recent_blockhashes_sysvar (#18932) 2021-07-28 10:25:33 -07:00
72e374d0f3 Deprecate SysvarRecentBlockhashes (#18875) 2021-07-27 16:34:21 -07:00
eaeeffa5a3 Add macros for deprecacted ids (#18907) 2021-07-26 20:54:46 -07:00
846787e7f4 Autolink URL in docs for sdk::feature_set (#18874) 2021-07-23 18:48:37 +00:00
7fc4cfebc8 Rename BpfComputeBudget (#18768) 2021-07-22 10:18:51 -07:00
51f3b9aa7c feature: add new token program feature (#18780)
* feature: add new token program feature

* Fixup test

* Update to spl-token v3.2.0

* Update Cargo.lock + fmt

* Update token program version in fetch-spl.sh

* Bump associated token program to 1.0.3

* Add aToken so
2021-07-21 14:34:25 +02:00
207c90bd8b Shorten long SerializeWith type paths in abi digest (#18734) 2021-07-20 08:59:50 -05:00
b9dc85a934 Add comments on how to add a new feature switch (#18686) 2021-07-18 12:48:09 -05:00
5f9f3724d0 Remove unused compute budget item (#18706) 2021-07-16 09:12:17 +00:00
6cf3c1ab8f tx wide compute budget (#18631) 2021-07-16 00:31:22 -07:00
d166b9856a Move transaction sanitization earlier in the pipeline (#18655)
* Move transaction sanitization earlier in the pipeline

* Renamed HashedTransaction to SanitizedTransaction

* Implement deref for sanitized transaction

* bring back process_transactions test method

* Use sanitized transactions for cost model calculation
2021-07-15 22:51:27 -05:00
37ee0b5599 Eliminate doc warnings and fix some markdown (#18566)
* Fix link target in doc comment

* Fix formatting of log examples in process_instruction

* Fix doc markdown in solana-gossip

* Fix doc markdown in solana-runtime

* Escape square braces in doc comments to avoid warnings

* Surround 'account references' doc items in code spans to avoid warnings

* Fix code block in loader_upgradeable_instruction

* Fix doctest for loader_upgradable_instruction
2021-07-16 00:40:07 +00:00
abe5a0a349 gate libsecp256k1 upgrade to v0.5.0 2021-07-15 18:43:55 +00:00
3a85b77bb5 hijack secp256k1 enablement feature plumbing for libsecp256k1 upgrade 2021-07-15 18:43:55 +00:00
568660b402 Revert "Remove feature switch for secp256k1 program (#18467)"
This reverts commit fd574dcb3b.
2021-07-15 18:43:55 +00:00
7f2254225e Move entry/poh to own crate to speed up poh bench build (#18225) 2021-07-14 14:16:29 +02:00
5cea25ac3e Add method id to SysbarId trait (#18604) 2021-07-13 16:01:32 +00:00
f96de208e2 Implement MockInvokeContext::is_feature_active properly 2021-07-09 09:08:38 -07:00