1029 Commits

Author SHA1 Message Date
Michael Vines
6d5bbca630 Pacify clippy 2022-01-21 19:12:57 -08:00
Brian Anderson
8dd62854fa
Document transaction module (#22440)
* Document transaction module

* example_mocks is only for feature = full
2022-01-21 18:30:12 -07:00
Brooks Prumo
a7f2fff219
Remove active features stake program v3 and v4 (#22612)
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-01-21 19:27:53 -06:00
Justin Starry
7f20c6149e
Refactor: move simple vote parsing to runtime (#22537) 2022-01-20 10:39:21 +08:00
Alexander Meißner
b448472037
Refactor: Move InstructionRecorder into TransactionContext (#22578)
* Moves InstructionRecorder into TransactionContext.

* Adds assertions for number_of_instructions_at_transaction_level.
2022-01-19 22:40:09 +01:00
Justin Starry
cc76a73c49
Refactor: move compute budget runtime logic into solana-program-runtime (#22543) 2022-01-17 20:48:00 +08:00
Justin Starry
2c38a9213f
Revert "Refactor: move compute budget runtime logic into solana-program-runtime (#22533)" (#22542)
This reverts commit b27976626aa1367274a76621c1013939f44a5d94.
2022-01-17 17:43:17 +08:00
Justin Starry
b27976626a
Refactor: move compute budget runtime logic into solana-program-runtime (#22533) 2022-01-17 15:52:33 +08:00
Michael Vines
65f1e0fcc2 vote account withdraw authority may change the authorized voter 2022-01-15 21:47:08 -08:00
Jack May
2aa113fd8c Update syscall base costs 2022-01-14 16:15:14 -08:00
Tao Zhu
9c9f2dd5bd port counting vote CUs to block cost (#22477) 2022-01-14 10:50:29 -06:00
Justin Starry
f804ccdece
Store address table lookups in blockstore and bigtable (#22402) 2022-01-14 15:24:41 +08:00
Michael Vines
4c577d7f8c Bank::get_fee_for_message is now nonce aware 2022-01-13 17:27:38 -08:00
carllin
4ab7d6c23e
Filter out outdated slots (#22450)
* Filter out outdated slots

* Fixup error
2022-01-13 19:51:00 -05:00
Justin Starry
b211f839cb
Fetch sysvars from invoke context for vote program (#22444) 2022-01-13 08:41:48 +08:00
Tyera Eulberg
637e366b18
Prevent rent-paying account creation (#22292)
* Fixup typo

* Add new feature

* Add new TransactionError

* Add framework for checking account state before and after transaction processing

* Fail transactions that leave new rent-paying accounts

* Only check rent-state of writable tx accounts

* Review comments: combine process_result success behavior; log and metrics before feature activation

* Fix tests that assume rent-exempt accounts are okay

* Remove test no longer relevant

* Remove native/sysvar special case

* Move metrics submission to report legacy->legacy rent paying transitions as well
2022-01-11 11:32:25 -07:00
Alexander Meißner
aadf4b9b63
Moves InvokeContext::return_data to TransactionContext. (#22411) 2022-01-10 18:26:51 +01:00
Brooks Prumo
d90d5ee9b6
Refactor Rent::due() with RentDue enum (#22346) 2022-01-08 09:03:46 -06:00
Justin Starry
52d12cc802
Add runtime support for address table lookups (#22223)
* Add support for address table lookups in runtime

* feedback

* feedback
2022-01-07 11:59:09 +08:00
Trent Nelson
deb9344e49 Add helper macro for AddAssigning with saturating arithmetic 2022-01-06 03:56:46 -07:00
Michael Vines
bb3a1b6b31 Add zk_token_sdk_enabled feature to gate Zk Token proof program and sol_zk_token_elgamal_op syscalls 2022-01-05 11:57:37 -08:00
Alexander Meißner
9f63493789
Refactor: Remove KeyedAccounts (2) (#22274)
* Adds InstructionContext::get_signers().
Improves error messages when modifying borrowed accounts.

* Removes keyed_accounts from InvokeContext tests.

* Removes keyed_accounts from message_processor.rs

* Removes keyed_accounts from bank.rs

* Removes keyed_accounts from bpf serialization.
2022-01-05 09:39:37 +01:00
behzad nouri
01a096adc8 adds bitflags to Packet.Meta
Instead of a separate bool type for each flag, all the flags can be
encoded in a type-safe bitflags encoded in a single u8:
https://github.com/solana-labs/solana/blob/d6ec103be/sdk/src/packet.rs#L19-L31
2022-01-04 13:53:40 +00:00
behzad nouri
73a7741c49 uses std::net::IpAddr type for Packet.Meta.addr 2022-01-04 13:53:40 +00:00
behzad nouri
aa9f7ed7e8 removes seed and slot fields from Packet.Meta
507367e6ac
updated window-service to send shreds (as opposed to packets) to
retransmit-stage and so seed and slot fields in Packet.Meta are unused:
https://github.com/solana-labs/solana/blob/d6ec103be/sdk/src/packet.rs#L27-L28
2022-01-04 13:53:40 +00:00
Justin Starry
2b5e00d36d
Limit number of accounts that a transaction can lock (#22201) 2022-01-04 14:25:23 +08:00
Alexander Meißner
73e6038986
Refactor: Remove KeyedAccount from program runtime (#22226)
* Makes error handling in BorrowedAccount optional.
Adds BorrowedAccount ::get_rent_epoch().
Exposes InstructionContext::get_index_in_transaction().
Turns accounts and account_keys into pinned boxed slices.

* Introduces "unsafe" to InvokeContext::push().

* Turns &TransactionContext into &mut TransactionContext in InvokeContext.

* Push and pop InstructionContext in InvokeContext.
Makes test_process_cross_program and test_native_invoke symmetric.
Removes the borrow check from test_invoke_context_verify.

* Removes keyed_accounts from prepare_instruction()

* Removes usage of invoke_stack.

* Removes keyed_accounts from program-test.

* Removes caller_write_privileges.

* Removes keyed_accounts from BPF parameter (de-)serialization.
2022-01-03 23:30:56 +01:00
Alexander Meißner
edb20d6909
Splits index of InstructionAccount into index_in_transaction and index_in_caller. (#22165) 2021-12-30 15:46:36 +01:00
Justin Starry
b1d9a2e60e
Don't forward packets received from TPU forwards port (#22078)
* Don't forward packets received from TPU forwards port

* Add banking stage test
2021-12-29 19:34:31 +01:00
Tyera Eulberg
422a095647
Add (preflight) simulation to BanksClient (#22084)
* Add more-legitimate conversion from legacy Transaction to SanitizedTransaction

* Add Banks method with preflight checks

* Expose BanksClient method with preflight checks

* Unwrap simulation err

* Add Bank simulation method that works on unfrozen Banks

* Add simpler api

* Better name: BanksTransactionResultWithSimulation
2021-12-28 19:25:46 +00:00
Brooks Prumo
800472ddf5
Add AccountsDataMeter to InvokeContext (#21813) 2021-12-28 05:14:48 -06:00
Alexander Meißner
a06646631c
Feature: TransactionContext, InstructionContext and BorrowedAccount (#21706)
* Adds TransactionContext, InstructionContext and BorrowedAccount.

* Redirects the usage of accounts in InvokeContext through TransactionContext.
Also use the types declared in transaction_context.rs everywhere.

* Adjusts all affected tests.
2021-12-27 18:49:32 +01:00
Justin Starry
6ff0be6a82
Clean up demote program write lock feature (#21949)
* Clean up demote program write lock feature

* fix test
2021-12-16 17:27:22 -05:00
Jack May
509bcd2e74
Bump rbpf to v0.2.19 (#21880)
* Bump rbpf to v0.2.19

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
2021-12-14 16:51:23 +01:00
Justin Starry
e5476913fe
Remove activated feature that checks tx signature len (#21747) 2021-12-14 09:23:05 -05:00
Ashwin Sekar
4bc5bfb2df
Addressing leftover comments from #21531 (#21782)
* Addressing leftover comments from #21531

* Add feature flag

* Feature gate new vote instruction

* add clock & slot hashes sysvar to test
2021-12-13 07:52:22 -08:00
Jeff Washington (jwash)
90f41fd9b7
use cost model to limit new account creation (#21369)
* use cost model to limit new account creation

* handle every system instruction

* remove &

* simplify match

* simplify match

* add datapoint for account data size

* add postgres error handling

* handle accounts:unlock_accounts
2021-12-12 14:57:18 -06:00
Michael Vines
c5c699a918 Remove the 5 integer msg! form 2021-12-11 09:37:11 -08:00
Justin Starry
9b41ddd9ba
Add address lookup table program (#21616)
* Add address lookup table program

* feedback
2021-12-10 16:02:16 -05:00
Justin Starry
6c108c8fc3
Migrate from address maps to address lookup tables (#21634)
* Migrate from address maps to address lookup tables

* update sanitize error

* cargo fmt

* update abi
2021-12-10 11:04:04 -05:00
Michael Vines
a35df1cb02 Add initial wasm bindings for Instruction, SystemProgram and Transaction 2021-12-09 15:53:58 -08:00
Michael Vines
488dc37fec Add wasm bindings for Pubkey and Keypair 2021-12-09 15:53:58 -08:00
Justin Starry
6fc329180b
Add more reporting for invalid stake cache members and prune them (#21654)
* Add more reporting for invalid stake cache members

* feedback
2021-12-09 14:12:11 -05:00
Sean Young
45e56c599d
Ensure we have keys to activate these features (#21669) 2021-12-07 18:58:59 +00:00
Justin Starry
e123883b26
Reject vote withdraws that create non-rent-exempt accounts (#21639)
* Reject vote withdraws that create non-rent-exempt accounts

* fix mocked instruction test
2021-12-06 17:01:20 -05:00
Justin Starry
3dab1e711d
Move transaction error code into new module (#21635) 2021-12-06 12:45:33 -05:00
Brian Anderson
df2b448993
Fix incorrect nonoverlapping test in sol_memcpy (#21007)
Thanks!
2021-12-06 09:26:46 -08:00
fee1-dead
c4a9c8b5e9
Remove dependency on hex (#21567)
* Remove dependency on `hex`

* Update lock file

* Use `debug_struct` instead of own format

* Share code, add test, and fix rent_epoch spelling

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-12-03 20:53:35 -07:00
Michael Vines
b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Alexander Meißner
1a4a039913
Adds feature reject_empty_instruction_without_program. (#21591) 2021-12-03 15:47:18 +01:00