Commit Graph

333 Commits

Author SHA1 Message Date
Brooks Prumo d1ba42180d
clippy for rust 1.65.0 (#28765) 2022-11-09 19:39:38 +00:00
Alexander Meißner 93fc4edef8
Refactor - derive `CloneZeroed` (#28771)
* Adds proc_macro_derive(CloneZeroed).

* Switches over all use sites of clone_zeroed() and copy_field().

* Removes clone_zeroed() and copy_field().

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-11-09 18:15:42 +01:00
Brian Anderson 6972afe2c4
Add docs for system_instruction and some of its functions (#28052)
* Add docs for system_instruction and some of its functions

* Apply suggestions from code review

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

* Apply review feedback

* Use PDAs in system_instruction examples

* Fix 'bump seed' terminology in system_instruction docs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-11-01 14:33:46 -06:00
0xripleys 5de4dd8f9b
Add SetAuthorityChecked instruction to bpf loader (#28424)
* SetAuthorityChecked

* restore old logic for loader

* add more upgrade authority checked test cases

* setBufferAuthority checked tests

* format

* add set_buffer_authority_checked instruction to sdk

* Update transaction-status/src/parse_bpf_loader.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* add is_set_authority_checked function

* fix set_buffer_authority_checked sdk instruction

* feature gate setAuthorityChecked

* add bpf loader tests for setAuthorityChecked ixs

* test that you can set to same authority

* allow set_authority_checked to be called via cpi (if feature is enabled)

* fix ci

* fmt

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
Co-authored-by: Justin Starry <justin@solana.com>
2022-11-01 08:34:04 +00:00
Dmitri Makarov 34865d032c chore: update Solana docs and code comments that specify "BPF" to "SBF" 2022-10-31 14:14:25 -04:00
Alexander Meißner a43098a428
Feature - Check syscall outputs do not overlap (#28599)
* Extends is_nonoverlapping() to be able to deal with two different lengths.

* Uses is_nonoverlapping() for syscall output parameters.

* Feature gates the new throws of SyscallError::CopyOverlapping.

* Adds tests which trigger SyscallError::CopyOverlapping.
2022-10-27 19:11:18 +02:00
Ashwin Sekar 9eafad467c
Add convenience methods to VoteInstruction to distinguish vote types (#28526)
* Add convenience methods to VoteInstruction to distinguish vote types

* use matches! macro instead
2022-10-21 14:17:40 -06:00
kirill lykov 1c4ac56e56
Remove immutable deploy (#28399)
* remove Deploy option from cli

* remove solana deploy from comments

* introduce dummy deploy command to improve user experience
2022-10-21 09:29:37 +02:00
Justin Starry 199398d5c4
Rename transaction v2 proposal (#28508)
Rename transactions v2 proposal to clear up versioning
2022-10-21 09:29:22 +08:00
Ashwin Sekar f207af765e
Split out voting and banking threads in banking stage (#27931)
* Split out voting and banking threads in banking stage

Additionally this allows us to aggressively prune the buffer for voting threads
as with the new vote state only the latest vote from each validator is
necessary.

* Update local cluster test to use new Vote ix

* Encapsulate transaction storage filtering better

* Address pr comments

* Commit cargo lock change

* clippy

* Remove unsafe impls

* pr comments

* compute_sanitized_transaction -> build_sanitized_transaction

* &Arc -> Arc

* Move test

* Refactor metrics enums

* clippy
2022-10-20 21:10:48 +00:00
samkim-crypto 3f63283eda
add curve25519 multiscalar multiplication syscall (#28216)
* add curve25519 multiscalar multiplication syscall

* update compute unit costs

* update tests

* add update to compute budget

* add syscall call function

* update compute costs in tests

* update syscall syntax
2022-10-12 14:43:02 +09:00
Kevin Heavey 061bed0a8c
More missing derives (#27418)
* add Eq, PartialEq to EpochInfo

* add Eq, PartialEq related to transactions and messages

* add Eq, PartialEq to Ed25519SignatureOffsets

* add Eq, PartialEq to FeatureSet

* add Eq, PartialEq to fee.rs

* add Eq, PartialEq to GenesisConfig

* don't add Eq to GenesisConfig because floats

* add Eq, PartialEq to PohConfig

* add Eq, PartialEq to SecpSignatureOffsets

* add some missing derives to transaction_context.rs

* add Eq, PartialEq to ProcessedSiblingInstruction
2022-10-11 12:59:58 -07:00
Justin Starry ddf95c181c
RPC: Support versioned txs in getFeeForMessage API (#28217)
* RPC: Support versioned txs in getFeeForMessage API

* Update sdk/program/src/message/sanitized.rs

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

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-10-05 00:00:34 +08:00
Alexander Meißner 71aee4fcaf
Feature: Explicitly limit `TransactionContext::instruction_trace_capacity` (#27938)
* Renames instruction_stack_capacity => instruction_stack_capacity.

* Replaces number_of_instructions_at_transaction_level by instruction_trace_capacity.

* Adds MaxInstructionTraceLengthExceeded.

* Adjusts TransactionContext::new() parameter.

* Adds feature gate limit_max_instruction_trace_length.

* Adds test_max_instruction_trace_length().
2022-09-26 10:47:16 +02:00
Justin Starry 108b245e6b
Require program account to be writable in extend program data ix (#27911)
* Require program account to be writable in extend program data ix

* feedback
2022-09-22 12:03:06 +08:00
Justin Starry b9700244b5
Increase transaction account lock limit from 64 to 128 (#27242)
* Increase transaction account lock limit from 64 to 256

* fix bpf test

* Reduce lock limit from 256 to 128
2022-09-15 13:50:14 -04:00
Ashwin Sekar c74df830b1
Add structure to collect and coalesce vote packets (#27558)
* Add structure to collect and coalesce vote packets

Will be used in banking stage to throw out extraneous vote packets
before processing

* pr comments

* Update inner lock to arc to improve performance
2022-09-14 00:44:26 -07:00
behzad nouri 4f22ee8f9b uses varint encoding for vote-state lockout offsets
The commit removes CompactVoteStateUpdate and instead reduces serialized
size of VoteStateUpdate using varint encoding for vote-state lockout
offsets.
2022-09-12 16:31:20 +00:00
behzad nouri f6fbc47b2d adds serde varint encoder/decoder
#[derive(Deserialize, Serialize)]
  struct Foo {
    #[serde(with = "serde_varint")]
    field: u64,
    ...
  }
2022-09-12 16:31:20 +00:00
Brian Anderson 28f979b5a5
Fix solana_program::vote docs (#27621) 2022-09-07 13:05:52 -06:00
Alexander Meißner 0367c1a60c
Feature: `SyscallSetAccountProperties` (#27444)
* Adds TransactionContextAttribute.

* Adds SyscallSetAccountProperties.

* Adds AccountPropertyUpdate factory methods to BorrowedAccount.

* Categorizes syscalls exclusive to ABIv0/v1 and ABIv2.
2022-09-02 12:42:06 +02:00
Brian Anderson dce99f1d0d
Fix broken macro doc links (#27125)
These don't resolve correctly in Rust 1.63.
2022-09-01 21:14:25 +00:00
Brooks Prumo 757e46c3c7
Set cap for new allocations per transaction (#27385) 2022-08-29 14:30:48 -04:00
Yihau Chen a19b5c1536
chore: allow test_is_writable_account_cache ignore clippy::get_first (#27414) 2022-08-26 15:33:25 +08:00
Tao Zhu 5e71f339c9
Add a SanitizedMessage type that caches writable accounts indexes (#27317)
* Add a SanitizedMessage type that caches writable accounts indexes

* Add is_writable_account_cache to both SanitizedMessage variants, cache is initialized in constructors
2022-08-25 16:33:41 -05:00
Tyera Eulberg 1095cdf436
Fixup docs in sdk to use new clients (#27362)
Fixup client docs in sdk
2022-08-24 21:29:56 -06:00
Ashwin Sekar efa6201eda
Check overflow on vote tx compaction boundary (#27185)
* Check overflow on vote tx compaction boundary

Check for overflow during the conversion between VoteStateUpdate and
CompactVoteStateUpdate.

* Try removing clippy supress
2022-08-23 22:29:03 -07:00
Brennan Watt e4a7d01e10
Rust v1.63 (#27303)
* Upgrade to Rust v1.63.0

* Add nightly_clippy_allows

* Resolve some new clippy nightly lints

* Increase QUIC packets completion timeout

* Update quinn-udp crate

Co-authored-by: Michael Vines <mvines@gmail.com>
2022-08-22 18:01:03 -07:00
Brennan Watt 7573000d87
Revert "Rust v1.63.0 (#27148)" (#27245)
This reverts commit a2e7bdf50a.
2022-08-19 09:19:44 +01:00
Brennan Watt a2e7bdf50a
Rust v1.63.0 (#27148)
* Upgrade to Rust v1.63.0

* Add nightly_clippy_allows

* Resolve some new clippy nightly lints

* Increase QUIC packets completion timeout

Co-authored-by: Michael Vines <mvines@gmail.com>
2022-08-17 15:48:33 -07:00
Brian Anderson b6762fc2f9
Add more sysvar API docs (#26849)
* Add more sysvar API docs

* Remove println from examples

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Update sdk/program/src/clock.rs

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

* Fix docs for ACCOUNT_STORAGE_OVERHEAD

* Update sdk/program/src/epoch_schedule.rs

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

* Update sdk/program/src/sysvar/slot_hashes.rs

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

* Update sdk/program/src/sysvar/slot_history.rs

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

* Update sdk/program/src/sysvar/slot_history.rs

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

* Update sdk/program/src/sysvar/mod.rs

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

* Fix docs for DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET

* Fix recent_blockhash short description

* Fix whitespace

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-08-15 12:19:46 -06:00
Michael Vines ccfbc54195 Move vote program state and instructions to solana-program 2022-08-09 20:52:47 -07:00
Brian Anderson ebe25fdb56
Add API docs for secp256k1_instruction and secp256k1_recover (#26065)
* Add API docs for secp256k1_instruction and secp256k1_recover

* typo

* Remove unused variable from secp256k1 program test

* Bump solana_bpf_rust_secp256k1_recover ix count

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2022-08-08 16:22:10 -06:00
Richard Patel a9a3c62907
Fix sol_get_processed_sibling_instruction on 32-bit hosts (#26522) 2022-08-05 12:06:03 -07:00
Brian Anderson a69ee79111 Delete unused create_test_recent_blockhashes 2022-08-02 01:28:23 -06:00
Michael Vines 48862c575a Add StakeInstruction::Redelegate 2022-07-27 20:24:25 -06:00
Justin Starry 2335f6908a
Loosen CPI restrictions and charge compute for ix data len (#26653)
* Loosen CPI restrictions and charge compute for ix data len

* Address feedback

* use explicit casting

* more feedback
2022-07-24 20:20:16 +02:00
Justin Starry f8e9af5f1e
Cap the number of accounts passed to a bpf program ix (#26630)
* Cap the number of accounts passed to a bpf program ix

* update bank abi hash

* fix ci failures
2022-07-20 14:12:43 +02:00
Justin Starry 3fc161bea4
Fix flaky message kitchen sink test (#26624) 2022-07-14 18:39:57 +01:00
Justin Starry 8e8c6e60ff
Allow extending upgradeable program data account length (#26386)
* Allow extending upgradeable program data account length

* Add is_writable check

* Fix cargo version

* System program fix, comment, and test

* Switch to u32 for serialized bytes value in ix
2022-07-11 22:46:32 +01:00
Justin Starry eb6a722eba
Clean up `nonce_must_be_writable` feature (#26444)
Clean up nonce_must_be_writable feature
2022-07-07 15:45:19 +01:00
behzad nouri 6f5857a5db
removes feature gate code separating durable nonce from blockhash domain (#26055) 2022-07-06 12:03:13 +00:00
samkim-crypto 24c6f820ce
remove elgamal syscall operations (#26311)
resolve conflict
2022-06-30 16:27:48 +09:00
Justin Starry f44fcd1880 Detect and reject invalid AccountInfo reallocations 2022-06-29 09:15:59 +01:00
behzad nouri 2efdb965dd
encapsulates AuthorizeNonceAccount implementation in the nonce module (#26202)
Follow up commit removes feature gate code separating durable nonce from
blockhash domain. This commit allows to encapsulate any logic
distinguishing legacy vs current nonce versions in the nonce module
after removing the feature gate.
2022-06-25 12:17:39 +00:00
Michael Vines f3639b76ce Remove some clippy lints 2022-06-22 09:23:22 -07:00
apfitzge 4940d530b8
Add static vector to get sdk ids (#25907)
* Add function to get all sdk program ids

* program_ids: use lazy_static instead of a function

* program_ids -> sdk_ids
2022-06-13 13:07:18 -05:00
samkim-crypto 697a69cbe8
Add syscall tests for curve25519 (#25634)
* add curve25519 syscall tests

* add curve25519 syscall feature set description

* fmt

* rename curve25519 group syscall

* update point to scalar

* resolve conflict
2022-06-12 10:18:51 +09:00
behzad nouri b4190319a1
feat(nonce): adds system instruction to upgrade legacy nonce versions (#25789)
https://github.com/solana-labs/solana/pull/25788
permanently disables durable transactions with legacy nonce versions
which are within chain blockhash domain.

This commit adds a new system instruction for a one-time idempotent
upgrade of legacy nonce accounts in order to bump them out of chain
blockhash domain.
2022-06-10 00:04:29 +00:00
behzad nouri 3c1ce3cc93
permanently disables durable nonces with chain blockhash domain (#25788)
https://github.com/solana-labs/solana/pull/25744
separated durable nonce and blockhash domains, which will stop double
execution going forward. However it is possible that a durable
transaction has *already* been executed once as a normal transaction and
it is now a valid durable transaction. #25744 cannot stop such
transactions to be re-executed until the nonce accounts are advanced.

This commit adds a new nonce version indicating that the nonce is moved
out of the blockhash domain, and permanently disables durable
transactions for legacy nonces which are in the blockhash domain.
2022-06-09 15:28:37 +00:00