Commit Graph

53 Commits

Author SHA1 Message Date
Alexander Meißner
a9d5ef2055 Cleanup: InvokeContext accessors (#21574)
* Removes blockhash accessors from InvokeContext.

* Removes lamports_per_signature accessors from InvokeContext.

* Removes return_data accessors from InvokeContext.

* Removes feature_set accessor from InvokeContext.

* Removes instruction_recorders and instruction_index accessors from InvokeContext.

* Moves get_sysvars() into InvokeContext.

* Removes compute_meter parameter from InvokeContext::new().

* Removes InvokeContext::new_mock_with_sysvars_and_features().

* Removes InvokeContext::update_timing().
2021-12-03 12:15:22 +01:00
Alexander Meißner
bfdb775ffc Unifies ThisInvokeContext and dyn trait InvokeContext. (#21563) 2021-12-02 18:47:16 +01:00
Alexander Meißner
e540b1cf3c Refactor: Move sdk::process_instruction in program-runtime-crate (#21180)
* Moves the Executor dyn Trait to instruction_processor.rs

* Moves the Logger dyn Trait as well as the ic_msg and ic_logger_msg macros to log_collector.rs,
and moves the stable_log to stable_log.rs

* Moves the ComputeMeter dyn Trait to invoke_context.rs

* Moves the InvokeContext dyn Trait and the ProcessInstructionWithContext type to invoke_context.rs

* Updates cargo files.

* Re-export InvokeContext in program-test

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-11-17 19:35:07 +01:00
Alexander Meißner
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
Alexander Meißner
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
Alexander Meißner
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
Justin Starry
db9336c99e Remove feature switch handling for checking vote init (#20557) 2021-10-08 23:35:26 -04:00
Alexander Meißner
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
Jack May
5cf8d8795b Feature cleanup (#19528) 2021-08-31 14:51:26 -07:00
Brian Anderson
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
Tyera Eulberg
b8ca2250fd Add VoteInstruction::AuthorizeChecked test 2021-07-06 21:53:18 +00:00
Michael Vines
ee219ffa47 Add vote/stake checked instructions 2021-07-06 21:53:18 +00:00
Alexander Meißner
9dfcb921cf Refactoring: Move KeyedAccounts to InvokeContext (#15410)
Collects all parametric occurrences and the construction of keyed_accounts and puts them into InvokeContext.
2021-04-19 18:48:48 +02:00
Ryo Onodera
6d5c6c17c5 Simplify account.rent_epoch handling for sysvar rent (#16049)
* Add some code for special local testing

* Add comment to store_account_and_update_capitalization

* Simplify account.rent_epoch handling for sysvar rent

* Introduce *_for_test functions

* Add deprecation messages to existing api
2021-03-25 15:23:20 +09:00
Jeff Washington (jwash)
952c3bcbb7 AccountSharedData construction (#15790) 2021-03-11 18:09:04 -06:00
Jeff Washington (jwash)
8a3135d17b Account->AccountSharedData (#15691) 2021-03-09 15:06:07 -06:00
Jack May
b53cb8eb2d Deprecate Instruction::new (#15695) 2021-03-04 05:46:48 +00:00
sakridge
8399851d11 check program owners (#15495)
* check program owners

* BankSlotDelta should change because InstructionError variant added

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-02-26 22:21:34 +00:00
Tyera Eulberg
eddb7f98f5 Check vote account initialization (#15503)
* Check account data_len on Vote account init

* Check account data populated on update_cached_accounts
2021-02-24 10:00:48 -07:00
Michael Vines
df8dab9d2b Native/builtin programs now receive an InvokeContext 2020-10-29 21:45:24 -07:00
Jack May
c458d4b213 move Account to solana-sdk (#13198) 2020-10-28 22:01:07 -07:00
Michael Vines
1b343665a1 Move KeyedAccount out of solana-program. Native programs are not supported by solana-program 2020-10-26 18:54:54 -07:00
Michael Vines
d15173ad9d Address latest nightly clippy lints, but globally disable stable_sort_primitive 2020-08-17 22:36:10 -07:00
Jack May
dac7dc2f10 Move types to more appropriate files (#10638) 2020-06-17 10:39:14 -07:00
Michael Vines
2bcbe44c79 Add VoteInstruction::UpdateCommission 2020-06-10 08:30:55 -07:00
Greg Fitzgerald
19d11800bf Remove WithSigner (#10325)
automerge
2020-05-29 23:17:44 -07:00
Greg Fitzgerald
55a64712b9 Cleanup program docs (#10283) 2020-05-29 20:29:24 -06:00
carllin
3aae98c8be Add switching vote instruction (#10197)
* Add switching vote

* Make sure vote size stays under gossip limit

Co-authored-by: Carl <carl@solana.com>
2020-05-24 15:38:35 -07:00
Jack May
a4fe11fad2 Remove old logging enabler artifacts (#9777)
automerge
2020-04-28 15:56:51 -07:00
Michael Vines
5a0c2a0c1d Rename UpdateNode to UpdateValidatorIdentity 2020-04-13 17:25:39 -07:00
Jack May
268e04cb4a Rename CustomError to Custom (#9207) 2020-04-01 09:01:11 -07:00
Michael Vines
f78a90bce2 Vote InitializeAccount and UpdateNode instructions now need a signature from the validator identity (#8947)
automerge
2020-03-19 01:58:52 -07:00
Michael Vines
74866882f2 Document account/signer requirements for vote instructions 2020-03-18 11:11:48 -07:00
carllin
d821fd29d6 Add versioning (#8348)
automerge
2020-02-25 17:12:01 -08:00
carllin
39282be486 Determine vote_state ahead of time (#8303)
automerge
2020-02-24 19:27:04 -08:00
Pankaj Garg
aa80f69171 Promote some datapoints to info to fix dashboard (#8381)
automerge
2020-02-21 13:41:49 -08:00
Jack May
8436457e75 Rename program_utils.rs (#8127) 2020-02-05 12:48:30 -08:00
Jack May
c95e5346a4 Boot the mut (#7926) 2020-01-22 17:54:06 -08:00
Jack May
023074650f Allow the same account to be passed multiple times to a single instruction (#7795) 2020-01-22 09:11:56 -08:00
Jack May
07855e3125 Allow override of RUST_LOG (#7705) 2020-01-08 09:19:12 -08:00
Rob Walker
6b7d9942a7 Add authorized_voter history (#7643)
* Add authorized_voter history

* fixups

* coverage

* bigger vote state
2019-12-30 19:57:53 -08:00
Rob Walker
e1ebaa902b Add base pubkey to create_account_with_seed (#7636) 2019-12-29 16:42:24 -08:00
Rob Walker
120c8f244c Add slot_history for slashing (#7589)
* Add slot_history for slashing

* fixup

* fixup
2019-12-23 12:23:45 -08:00
Rob Walker
f05860672c Add create-address-with-seed to solana-cli (#7472)
* Add create account with seed to cli

* clippy

* fixup
2019-12-14 04:38:24 -08:00
Michael Vines
48f9b2fdcc watchtower: Add Slack/Discord sanity failure notification (#7467)
automerge
2019-12-12 23:49:16 -08:00
Michael Vines
f7a87d5e52 Add vote-update-validator subcommand 2019-12-12 23:26:39 -07:00
Rob Walker
777ae3c215 Add time since genesis to sysvar::clock (#7289)
* genesis timestamp

* remove clock::create_account()

* ..

* add configure-able creation time

* dividing by 1T, should be dividing by 1B
2019-12-12 14:03:43 -08:00
Rob Walker
39cd6dff7d turn on rent (#7368)
* turn on rent

* add rent exempt balances for bootstrap accounts

* use Rent::free() when not testing rent
2019-12-09 21:56:43 -08:00
Tyera Eulberg
3ab8185777 Add intermittent Timestamping to Votes (#7233)
* Add intermittent timestamp to Vote

* Add timestamp to VoteState, add timestamp processing to program

* Print recent timestamp with solana show-vote-account

* Add offset of 1 to timestamp Vote interval to initialize at node boot (slot 1)

* Review comments

* Cache last_timestamp in Tower and use for interval check

* Move work into Tower method

* Clarify timestamping interval

* Replace tuple with struct
2019-12-06 14:38:49 -07:00
Rob Walker
9077a94dfe vote update node_id (#7253)
* vote update node_id

* un-break binary 'contract'
2019-12-03 22:50:08 -08:00