Commit Graph

282 Commits

Author SHA1 Message Date
Will Hickey 51f26dc96e
Bump version to 1.11.1 (#26104) 2022-06-21 12:07:46 -05:00
Alexander Meißner bf9ca9827e
Refactor: instruction account index (#25825)
* Adds methods based on instruction_account_index to InstructionContext.
Removes methods which are based on index_in_instruction.

* Adjusts program-runtime.

* Adjusts runtime.

* Adjusts bpf loader.

* Adjusts built-in programs.

* Adjusts program-test and bpf tests.
2022-06-16 18:46:17 +02:00
apfitzge 08cb3c4c86
Fix typo: upgradable to upgradEable (#25827) 2022-06-08 13:35:26 +00:00
bji cbb0f07d54
Award one credit per dequeued vote when processing VoteStateUpdate in… (#25743)
* Award one credit per dequeued vote when processing VoteStateUpdate instruction,
to match vote rewards of Vote instruction.

* Update feature pubkey to one owned by cc (ashwin)

Co-authored-by: Ashwin Sekar <ashwin@solana.com>
2022-06-06 16:37:03 -07:00
Dmitri Makarov 4dfaf15a46 Add cargo bpf tools that invoke newer sbf tools and issue deprecation notice 2022-06-03 14:12:42 -07:00
Michael Vines b05c7d91ed Fix derive_partial_eq_without_eq clippy lint 2022-05-22 22:22:21 -07:00
Alexander Meißner 7eae98c6d9
Introduces `Result` return types to mutable accessors of `BorrowedAccount` (#25380)
* Introduces result return types to get_data_mut(), set_data() and set_data_length() of BorrowedAccount.

* Introduces result return types to set_owner(), set_lamports() and set_executable() of BorrowedAccount.
2022-05-21 17:47:09 +02:00
Justin Starry a1522d0024
Use consistent naming for compute unit limit (#25229)
* Use consistent naming for compute unit limit

* feedback
2022-05-18 13:14:31 +08:00
Justin Starry 68800982ea
Add size_of const fns for upgradeable loader states (#25131) 2022-05-11 22:22:59 +08:00
Tyera Eulberg c4aa082efc
Rollback tokio to LTS release v1.14 (#25028) 2022-05-06 06:34:49 +00:00
dependabot[bot] bece7f32c8
chore: bump log from 0.4.16 to 0.4.17 (#24987)
* chore: bump log from 0.4.16 to 0.4.17

Bumps [log](https://github.com/rust-lang/log) from 0.4.16 to 0.4.17.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/commits/0.4.17)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-05-05 01:49:18 +00:00
dependabot[bot] 9258d81ba3
chore: bump serde from 1.0.136 to 1.0.137 (#24957)
* chore: bump serde from 1.0.136 to 1.0.137

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.136 to 1.0.137.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-05-03 22:14:59 -06:00
Justin Starry d5127abf46
Only add hashes for completed blocks to recent blockhashes (#24389)
* Only add hashes for completed blocks to recent blockhashes

* feedback
2022-04-21 21:05:29 +08:00
Jon Cinque c43afe2d7f
spl: Bump token to v3.3.0 and ATA to v1.0.5 (#22649)
* Bump spl-token and ATA to v3.3.0

* Add parsers for new token instructions
* Update parser for modified associated-token-account instruction

* Update to use 1.0.5 once it's released

* Update Cargo.lock in programs/bpf
2022-04-20 19:13:42 +02:00
dependabot[bot] 412c080b04
chore: bump async-trait from 0.1.52 to 0.1.53 (#24407)
* chore: bump async-trait from 0.1.52 to 0.1.53

Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.52 to 0.1.53.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.52...0.1.53)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-04-15 22:50:26 -06:00
Alexander Meißner 1b45c509c3
Refactor: Use `InstructionContext::get_instruction_data()` (#24014)
* Adds transaction_context and instruction_context where invoke_context.get_keyed_accounts() is used.

* Use instruction_context.get_instruction_data() instead of an explicit parameter.

* Removes instruction_data parameter from Executor::execute().

* Removes instruction_data parameter from ProcessInstructionWithContext.
2022-04-01 15:48:05 +02:00
Jon Cinque 7af48465fa
transaction-status: Add return data to meta (#23688)
* transaction-status: Add return data to meta

* Add return data to simulation results

* Use pretty-hex for printing return data

* Update arg name, make TransactionRecord struct

* Rename TransactionRecord -> ExecutionRecord
2022-03-22 23:17:05 +01:00
Will Hickey c4ecfa5716
Bump version to v1.11 (#23807)
* Revert crossbeam_epoch to stable. 0.9.8 only works with nightly
* Remove unneeded unit expression
2022-03-21 17:40:50 -05:00
Will Hickey 2f58c9e501
Bump version to 1.10.4 (#23743) 2022-03-17 14:02:13 -05:00
Will Hickey 63bf0f66af
Bump version to 1.10.3 (#23648) 2022-03-14 11:18:45 -05:00
dependabot[bot] b1da7cff66
chore: bump base64 from 0.12.3 to 0.13.0 (#23616)
* chore: bump base64 from 0.12.3 to 0.13.0

Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.12.3 to 0.13.0.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.12.3...v0.13.0)

---
updated-dependencies:
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update Cargo.lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2022-03-11 16:01:15 -07:00
Will Hickey b444836a97
Bump version to 1.10.2 (#23597) 2022-03-10 16:41:06 -06:00
Will Hickey 1a99251498
Bump version to 1.10.1 (#23453) 2022-03-02 13:47:01 -06:00
Alexander Meißner da00b39f4f
Cleanup: get_program_key() and get_loader_key() in TransactionContext (#23191)
* Moves TransactionContext::get_program_key() to InstructionContext::get_program_key().

* Removes TransactionContext::get_loader_key().

* Test full program and loader executable account chain in BPF loader.
2022-02-17 10:16:28 +01:00
Justin Starry 813725dfec
Fix ed25519 builtin program handling (#23182)
* Fix ed25519 builtin program handling

* Fix tests

* Add integration tests for processing transactions with ed25519 ixs

* Fix another test

* fix formatting
2022-02-16 18:48:55 +00:00
steviez f2d406ad5d
Fix panic in ProgramTestContext::warp_to_slot() when warping one slot (#22977)
warp_to_slot() first warps to one slot before desired slot in order to
freeze the bank at warp slot. This would cause issues when warping by
one slot as that would attempt to warp to the same slot and hit a sanity
check assertion.
2022-02-07 16:21:43 -06:00
Alexander Meißner 660f6981c6
Cleanup: TransactionContext (#22910)
* Adds BorrowedAccount::check_sysvar().

* Adds BorrowedAccount::get_data_mut().

* Implements account resizing in BorrowedAccount.

* Exposes is_signer() and is_writable() in InstructionContext.

* Removes AccountMeta and get_instruction_accounts_metas().

* Makes throwing errors in BorrowedAccount optional.

* Removes result return values from BorrowedAccount.
2022-02-03 17:19:42 +01:00
Jack May cc94a93b56
Safer invoke context (#22898)
* Safer invoke context

* feedback and rebase with master
2022-02-03 02:34:51 -08:00
carllin bd1850df25
Return actual committed transactions from process_transactions() (#22802) 2022-02-03 03:56:36 -05:00
Jack May ab02dba96f
Add get_processed_sibling_instruction syscall (#22859) 2022-02-02 16:45:57 -08:00
Jack May 551c24da57
nit: consistent name (#22857) 2022-02-01 07:46:04 +00:00
dependabot[bot] cc74693176
chore: bump serde from 1.0.134 to 1.0.136 (#22817)
* chore: bump serde from 1.0.134 to 1.0.136

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.134 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.134...v1.0.136)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-01-28 12:20:37 -07:00
dependabot[bot] 0cf886302d
chore: bump serde from 1.0.133 to 1.0.134 (#22650)
* chore: bump serde from 1.0.133 to 1.0.134

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.133 to 1.0.134.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.133...v1.0.134)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-01-21 17:14:02 -07:00
Tyera Eulberg fc8130955a
Impl get_/set_return_data syscalls for ProgramTest (#22647)
* Remove &mut self from set_return_data

* Impl get_/set_return_data for program-test SyscallStubs

* Add return_data program-test
2022-01-21 17:05:48 -07: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 b27976626a.
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
Justin Starry 2370e61431
Perf: Store deserialized sysvars in the sysvars cache (#22455)
* Perf: Store deserialized sysvars in sysvars cache

* add bench
2022-01-13 05:36:21 +00: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
Carl Lin b25e4a200b Add execute metrics 2022-01-06 03:56:46 -07:00
Trent Nelson 7d32909e17 move `ExecuteTimings` from `runtime::bank` to `program_runtime::timings` 2022-01-06 03:56:46 -07:00
Justin Starry 45458e7139
Refactor: Improve type safety and readability of transaction execution (#22215)
* Refactor Bank::load_and_execute_transactions

* Refactor: improve type safety of TransactionExecutionResult

* Add enum for extra type safety in execution results

* feedback
2022-01-05 10:15:15 +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
dependabot[bot] 672fed04cb
Bump serde from 1.0.132 to 1.0.133 (#22233)
* Bump serde from 1.0.132 to 1.0.133

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.132 to 1.0.133.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.132...v1.0.133)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2022-01-03 22:19:39 +00:00
Alexander Meißner e529d03c11
Cleanup #22182 (#22205)
* Turns compute_units_consumed of ProcessInstructionResult into a &mut parameter.

* Removes second nesting level from test_process_instruction_compute_budget().

* Makes test_process_cross_program and test_native_invoke symmetric.

* Unifies test_process_cross_program(), test_native_invoke() and test_process_instruction_compute_budget() into test_process_instruction().
2021-12-31 17:55:27 +01:00
carllin d06e6c7425
Count compute units even when transaction errors (#22182) 2021-12-30 21:21:42 -05: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
carllin 33d0b5e011
Revert "Count compute units even when transaction errors (#22059)" (#22174)
This reverts commit eaa8c67bde.
2021-12-30 02:42:32 -05: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
carllin eaa8c67bde
Count compute units even when transaction errors (#22059) 2021-12-28 17:05:11 -05: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
Alexander Meißner cc947cad03
Refactor: CPI Instruction Recording (#22111)
* Unifies all InstructionRecorders of a transaction into one.

* Stops explicitly compiling CPI instructions for recording,
uses the indices gathered from instruction_accounts instead.
2021-12-25 13:35:43 +01:00
Alexander Meißner 60ddd93d09
Cleanup: invoke_context.rs (#22107)
* Removes message::Message from invoke_context.rs completely.

* Simplifies sol_invoke_signed() of program-test

* Start search for non program accounts at front (instead of the back).
Program and programdata accounts use rposition(), everything else uses position().
2021-12-25 10:00:40 +01:00
Alexander Meißner 2ab4f34c02
Refactor: Remove `Message` and `CompiledInstruction` from `InvokeContext` interfaces (#22102)
* Introduces InstructionAccount which is like AccountMeta but uses an index instead of a Pubkey

* Renames InvokeContext::create_message() to InvokeContext::prepare_instruction()

* Removes Message and CompiledInstruction from InvokeContext interfaces.

* Resolves TODOs of sol_invoke_signed() in program-test.

* Moves CompiledInstruction::visit_each_account() into invoke_context.rs
2021-12-24 16:17:55 +01:00
behzad nouri f67ecd5c18
removes unused Cargo dependencies (#22022)
Also moving some to [dev-dependencies] so that they are not propagated
to other packages which depend on the package.
2021-12-22 17:01:33 +00:00
dependabot[bot] 8f547a6c98
chore: bump serde from 1.0.131 to 1.0.132 (#21989)
* chore: bump serde from 1.0.131 to 1.0.132

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.131 to 1.0.132.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.131...v1.0.132)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-12-18 07:45:20 +00: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
Alexander Meißner 4adc8b133f
Refactor: Remove Rc from PreAccount and InvokeContext::get_account() (#21882)
* Removes Rc and RefCell from PreAccount

* Splits get_account() into find_index_of_account() and get_account_at_index()
in order to remove Rc from return type.
2021-12-14 15:44:31 +01:00
dependabot[bot] a400b5e63d
chore: bump async-trait from 0.1.51 to 0.1.52 (#21765)
* chore: bump async-trait from 0.1.51 to 0.1.52

Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.51 to 0.1.52.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.51...0.1.52)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-12-11 21:38:33 +00:00
Justin Starry 9b41ddd9ba
Add address lookup table program (#21616)
* Add address lookup table program

* feedback
2021-12-10 16:02:16 -05:00
dependabot[bot] d870f566ef
chore: bump serde from 1.0.130 to 1.0.131 (#21758)
* chore: bump serde from 1.0.130 to 1.0.131

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.130 to 1.0.131.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.130...v1.0.131)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-12-10 08:47:46 +00:00
Alexander Meißner 1df88837c8
- Implicitly fixes invoke_context.return_data not being reset between instructions in process_message. (#21671)
- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().
2021-12-07 23:00:04 +01:00
Trent Nelson d6f22433d0 Bump version to v1.10.0 2021-12-04 20:17:54 +00: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 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 b78f5b6032
Refactor: Cleanup InstructionProcessor (#21404)
* Moves create_message(), native_invoke() and process_cross_program_instruction()
from the InstructionProcessor to the InvokeContext so that they can have a useful "self" parameter.

* Moves InstructionProcessor into InvokeContext and Bank.

* Moves ExecuteDetailsTimings into its own file.

* Moves Executor into invoke_context.rs

* Moves PreAccount into its own file.

* impl AbiExample for BuiltinPrograms
2021-12-01 08:54:42 +01:00
Michael Vines dd12d90eac Upgrade to Rust 2021 2021-11-30 20:43:46 -08:00
Ruud van Asseldonk e7fa412465
Add set_account to solana-program-test (#21415)
For writing tests, it is often desirable to create a certain situation
that would be tedious, or even impossible to create by sending
individual transactions.

For example, a common attack vector on Solana is to create a copy of
some existing account that stores configuration data, but manipulate the
data stored there, and then to call a program and pass in the
manipulated account, instead of the real account.

If one wants to test this, one option is to write a program that you can
call to write arbitrary data into a new account account (and possibly
change its owner), then include that program in the test context, and
send a transaction to call it. This is extremely tedious, and developers
are not going to bother doing it. I myself would rather fork
solana-program-test to add this `set_account` method, than to write that
program. Having a “god mode” method to just write an account, lowers the
barrier to writing comprehensive tests.

A second reason for introducing this method, is defense in depth. There
may be states of the bank that are not reachable *yet* by only sending
transactions, but that you might want to test against either way. For
example, right now, the balance of a stake account cannot decrease
without going through the stake program. But what if Solana were to
introduce slashing in the future, and you want to ensure your program is
robust against decreases in stake account balance? Right now there is no
way to test this, but by introducing this “god mode” to write accounts,
the situation becomes testable.
2021-11-24 11:13:38 -05:00
Alexander Meißner 22a2537aac
Refactor: Cleanup program-runtime dyn Traits (#21395)
* Unifies dyn Trait ComputeMeter, ThisComputeMeter and TransactionComputeMeter.

* Unifies dyn Trait Logger and ThisLogger.

* Moves Logger to log_collector.rs

* Unifies Logger and LogCollector.

* Removes inner RefCell from LogCollector.

* Adds the log::debug!() message to ic_logger_msg!() again.
2021-11-23 13:23:40 +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
Jack May 1adf255e3a
Deprecate more Fee/Blockhash APIs (#21140) 2021-11-02 16:38:23 -07:00
Jack May bfbbc53dac
Divorce the runtime from FeeCalculator (#20737) 2021-10-22 14:32:40 -07: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
Christian Kamm bea181eba9
Improve program-test process_transaction() speed by reducing sleep duration in banks-server (#20508)
* banks_server: Reduce sleep duration for local server

This speeds up process_transaction_with_commitment_and_context()
and thus most program tests by a lot.

* Plumb tick duration through poh config and signature polling

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-10-15 18:55:41 +02:00
Jon Cinque 0419e6c22e
program-test: Fix getting new blockhash post-warp (#20710) 2021-10-15 14:58:09 +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
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
Trent Nelson 767f740305 Bump version to 1.9.0 2021-10-06 17:57:41 -07:00
Michael Vines 7027d56064 Resolve nightly-2021-10-05 clippy complaints 2021-10-06 10:37:58 -07:00
Justin Starry 0ddb34a0b4
Add struct and convenience methods to track stake activation status (#20392)
* Add struct and convenience methods to track stake activation status

* fix nits

* rename
2021-10-04 18:59:11 -04:00
Jack May 8fee9a2e1a
Dont call precompiled programs (#19930) 2021-09-29 06:25:08 +00:00
Alexander Meißner 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
Michael Vines 830ca369f1 Add ProgramTest::add_builtin_program()
This permits the unit testing of builtin programs in the ProgramTest environment
2021-09-21 07:42:14 +00:00
Michael Vines 34f5020457 Add stable_log output when a program is loaded as native code instead of BPF 2021-09-21 07:42:14 +00:00
Giles Cope c3a610374a unused deps 2021-09-11 14:33:53 -07:00
Alexander Meißner 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
Tyera Eulberg 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
Jon Cinque 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
Jack May 170927b7c4
nit: Move builtins types to builtins file (#19597) 2021-09-02 21:29:11 -07:00
dependabot[bot] 6a53ec28e0
chore: bump serde from 1.0.129 to 1.0.130 (#19497)
* chore: bump serde from 1.0.129 to 1.0.130

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.129 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.129...v1.0.130)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <you@example.com>
2021-08-30 18:19:34 +00:00
Justin Starry 2d7f036afd
Add solana-program-runtime crate (#19438) 2021-08-27 00:30:36 +00:00
dependabot[bot] 46890ac197
chore: bump serde from 1.0.128 to 1.0.129 (#19395)
* chore: bump serde from 1.0.128 to 1.0.129

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.128 to 1.0.129.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.129)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <you@example.com>
2021-08-24 12:32:30 -06:00
dependabot[bot] aea9960c75
chore: bump serde from 1.0.127 to 1.0.128 (#19370)
* chore: bump serde from 1.0.127 to 1.0.128

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <anatoly+githubjenkins@solana.io>
2021-08-23 09:33:34 -06:00
Jon Cinque 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
Jack May 0b50bb2b20
Deprecate FeeCalculator returning APIs (#19120) 2021-08-13 09:08:20 -07:00
Jeff Washington (jwash) 1ed12a07ab
introduce Bank::new_for_tests (#19062) 2021-08-04 15:06:57 -05:00
dependabot[bot] c16bf02448
chore: bump serde from 1.0.126 to 1.0.127 (#19010)
* chore: bump serde from 1.0.126 to 1.0.127

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <you@example.com>
2021-08-02 21:16:34 +00:00
Jack May 77861e2d40
Feature disable fees sysvar (#18981)
* Feature disable fees sysvar

* nudge
2021-08-02 00:31:11 +00:00
Jack May dfbb0c559b
deprecate fees sysvar (#18960) 2021-07-29 10:48:14 -07:00
dependabot[bot] 0a2fac2b92
chore: bump async-trait from 0.1.50 to 0.1.51 (#18964)
* chore: bump async-trait from 0.1.50 to 0.1.51

Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.50 to 0.1.51.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.50...0.1.51)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-07-29 08:38:32 -06:00
Jack May 7fc4cfebc8
Rename BpfComputeBudget (#18768) 2021-07-22 10:18:51 -07:00
Jon Cinque 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
Justin Starry 100fabf469
Remove feature switch for demoting sysvar write locks (#18373) 2021-07-06 21:22:22 +00:00
Alexander Meißner 7462c27d07
Refactoring: Unify account_deps and accounts (#17898)
* Changes ThisInvokeContext::get_account() to use accounts instead of pre_accounts.

* Adds explicit keys to accounts to make them symmetric to account_deps.

* Appends account_deps to accounts in transaction loading and removes account_deps everywhere else.
2021-07-05 13:49:37 +02:00
dependabot[bot] 644632fc8a
chore: bump assert_matches from 1.3.0 to 1.5.0 (#18358)
* chore: bump assert_matches from 1.3.0 to 1.5.0

Bumps [assert_matches](https://github.com/murarth/assert_matches) from 1.3.0 to 1.5.0.
- [Release notes](https://github.com/murarth/assert_matches/releases)
- [Commits](https://github.com/murarth/assert_matches/commits)

---
updated-dependencies:
- dependency-name: assert_matches
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-07-01 09:59:01 -06:00
dependabot[bot] 78968d132f
chore: bump log from 0.4.11 to 0.4.14 (#18323)
* chore: bump log from 0.4.11 to 0.4.14

Bumps [log](https://github.com/rust-lang/log) from 0.4.11 to 0.4.14.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.11...0.4.14)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Make version consistent

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-06-30 18:32:01 +00:00
dependabot[bot] 08eafe1e8a
chore: bump mio from 0.7.11 to 0.7.13 (#18190)
* chore: bump mio from 0.7.11 to 0.7.13

Bumps [mio](https://github.com/tokio-rs/mio) from 0.7.11 to 0.7.13.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/v0.7.13/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.7.11...v0.7.13)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-06-24 22:32:47 -06:00
dependabot[bot] d458fac2ff
chore: bump bincode from 1.3.1 to 1.3.3 (#18087)
* chore: bump bincode from 1.3.1 to 1.3.3

Bumps [bincode](https://github.com/servo/bincode) from 1.3.1 to 1.3.3.
- [Release notes](https://github.com/servo/bincode/releases)
- [Commits](https://github.com/servo/bincode/compare/v1.3.1...v1.3.3)

---
updated-dependencies:
- dependency-name: bincode
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-06-21 16:06:31 +00:00
Alexander Meißner 6514096a67 chore: cargo +nightly clippy --fix -Z unstable-options 2021-06-18 10:42:46 -07:00
dependabot[bot] cca0f744ab
chore: bump async-trait from 0.1.42 to 0.1.50 (#18040)
* chore: bump async-trait from 0.1.42 to 0.1.50

Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.42 to 0.1.50.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.42...0.1.50)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-06-17 08:07:28 -06:00
Jon Cinque 1b1d34da59
Refactor stake program into solana_program (#17906)
* Move stake state / instructions into solana_program

* Update account-decoder

* Update cli and runtime

* Update all other parts

* Commit Cargo.lock changes in programs/bpf

* Update cli stake instruction import

* Allow integer arithmetic

* Update ABI digest

* Bump rust mem instruction count

* Remove useless structs

* Move stake::id() -> stake::program::id()

* Re-export from solana_sdk and mark deprecated

* Address feedback

* Run cargo fmt
2021-06-15 18:04:00 +02:00
dependabot[bot] 4a146b6a19
chore: bump mio from 0.7.6 to 0.7.11 (#17872)
* chore: bump mio from 0.7.6 to 0.7.11

Bumps [mio](https://github.com/tokio-rs/mio) from 0.7.6 to 0.7.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/commits)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-06-10 19:15:34 +00:00
xuoe 2aaf55795f
Document ProgramTest::new and fix ProgramTest::add_program (#17754)
* document ProgramTest::new

* simplify ProgramTest::new doc-string

* make ProgramTest::add_program noisier

`add_program` (and `new`, implicitly) now prints a warning when the user
supplies a bogus program name to a ProgramTest and invokes `test-bpf`.

Additionally, it is now impossible to ask for a regular `test` and for
the generated ProgramTest to load BPF code instead of native code.
Previously, this was caused by a precedence issue: BPF code would always
be preferred over native if the program name was valid, regardless of
user choice.
2021-06-05 21:39:15 -07:00
dependabot[bot] ab0f4ff835
Bump serde from 1.0.122 to 1.0.126 (#17618)
* Bump serde from 1.0.122 to 1.0.126

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.122 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.122...v1.0.126)

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <anatoly+githubjenkins@solana.io>
2021-05-31 22:41:25 +00:00
dependabot[bot] 4f74c77146
chore: bump chrono-humanize from 0.1.1 to 0.2.1 (#16895)
* chore: bump chrono-humanize from 0.1.1 to 0.2.1

Bumps [chrono-humanize](https://gitlab.com/imp/chrono-humanize-rs) from 0.1.1 to 0.2.1.
- [Release notes](https://gitlab.com/imp/chrono-humanize-rs/tags)
- [Commits](https://gitlab.com/imp/chrono-humanize-rs/compare/0.1.1...0.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <anatoly+githubjenkins@solana.io>
2021-05-27 18:03:15 +00:00
Michael Vines 8eab0e8602
Bump version to v1.8.0 (#17541) 2021-05-27 08:51:53 -07:00
Sebastian.Bor 6d11d5dd9f chore: conflate use statement 2021-05-04 08:34:35 -07:00
Sebastian.Bor 4ede5117f9 fix: add bpf_loader_upgradeable to ProgramTest default builtins 2021-05-04 08:34:35 -07:00
Jeff Washington (jwash) 59e19828ea
set_lamports() (#16914) 2021-04-29 10:43:26 -05:00
Jeff Washington (jwash) 82e11588a5
lamports -> lamports() (#16915) 2021-04-28 14:55:55 -05:00
Jeff Washington (jwash) ca14c18998
owner -> owner() (#16782) 2021-04-23 22:49:47 +00:00
Jon Cinque f4214637a9
program-test: Add large bootstrap stake for realistic warmups (#16739) 2021-04-22 16:44:54 +02:00
Jack May 05fa7250b0
Selectable jit in program-test (#16685) 2021-04-20 15:02:54 -07: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
Michael Vines a911ae00ba clippy 2021-04-18 20:55:02 -07:00
Jack May fa83f3bd73
Return sysvars via syscalls (#16422) 2021-04-12 16:04:57 -07:00
Jeff Washington (jwash) 105a6bfb46
Replace RootsTracker HashSet (#16310)
* Replace RootsTracker HashSet

* use bitvec

* cleanup, add brenchmark test

* test cleanup

* add lots of tests

* get rid of demo

* change warp test constant

* get rid of unused function

* pr feedback

* reorder use

* rework get_all to remove range checks

* add tests, fix bugs
2021-04-12 12:11:33 -05:00
Justin Starry 278c125d99
Fix account copy step in program test message processor (#16469) 2021-04-11 07:59:43 +00:00
Michael Vines 43feef7362 Adjust tokio version to just "1" 2021-04-05 17:13:20 +00:00
Jack May dee655df35
Cleanup use (#16327) 2021-04-02 08:54:09 -07:00
behzad nouri 3f63ed9a72
removes OrderedIterator and transaction batch iteration order (#16153)
In TransactionBatch,
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/transaction_batch.rs#L4-L11
lock_results[i] is aligned with transactions[iteration_order[i]]:
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2414-L2424
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/accounts.rs#L788-L817

However load_and_execute_transactions is iterating over
  lock_results[iteration_order[i]]
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2878-L2889
and then returning i as for the index of the retryable transaction.

If iteratorion_order is [1, 2, 0], and i is 0, then:
  lock_results[iteration_order[i]] = lock_results[1]
which corresponds to
  transactions[iteration_order[1]] = transactions[2]
so neither i = 0, nor iteration_order[i] = 1 gives the correct index for the
corresponding transaction (which is 2).

This commit removes OrderedIterator and transaction batch iteration order
entirely. There is only one place in blockstore processor which the
iteration order is not ordinal:
https://github.com/solana-labs/solana/blob/e50f59844/ledger/src/blockstore_processor.rs#L269-L271
It seems like, instead of using an iteration order, that can shuffle entry
transactions in-place.
2021-03-31 23:59:19 +00:00
Jack May ce7f7c2b6c
Align ProcessInstruction error handling (#16232) 2021-03-30 13:41:04 -07:00
sakridge 54c68ea83f
Drop write lock on sysvars (#15497)
* Drop write lock on sysvars

* adds env var for demoting sysvar write lock demotion

* moves demote logic to is_writable

* feature gates sysvar write lock demotion

* adds builtins to write lock demotion

* adds system program id to builtins

* adds Feature111...

* adds an abi-freeze test

* mvines set of builtin program keys

Co-authored-by: Michael Vines <mvines@gmail.com>

* update tests

* adds bpf loader keys

* Add test sysvar

* Plumb demote_sysvar to is_writable

* more plumbing of demote_sysvar_write_locks to is_writable

* patches test_program_bpf_instruction_introspection

* hard codes demote_sysvar_write_locks to false for serialization/encoding methods

* Revert "hard codes demote_sysvar_write_locks to false for serialization/encoding methods"

This reverts commit ae3e2d2e777437bddd753933097a210dcbc1b1fc.

* change the hardcoded ones to demote_sysvar_write_locks=true

* Use data_as_mut_slice

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Co-authored-by: Michael Vines <mvines@gmail.com>
2021-03-30 10:05:09 -07:00
Justin Starry 27ab415ecc
Fix handling of invoked ix accounts in program-test (#16170) 2021-03-29 08:42:11 +08:00
Jon Cinque 6cc22e62d4
program-test: Fix warp and staking issue (#16002)
Since program-test creates a test genesis and then adds fees and rent,
some of the genesis accounts get rent-collected after warping.  Most
notably, `StakeConfig` gets rent-collected, causing any stake operations
to fail after warp.  This fix creates genesis with the `Rent` and
`FeeRateGovernor` actually used by the bank.
2021-03-19 14:37:13 +01:00
Michael Vines 03180b502d Avoid changing signature of ProgramTest::add_account 2021-03-17 13:21:43 -07:00
Michael Vines a2eb655322 =1.7.0 2021-03-16 07:51:07 +00:00
Michael Vines 430ed6d774 Export tokio for program-test clients 2021-03-15 20:03:55 -07:00
Jeff Washington (jwash) e50f284658
use Account for test since it borrows mut ref to data (#15852) 2021-03-15 21:56:48 -05:00
Michael Vines 0c9ca5522c Bump version to v1.7.0 2021-03-13 09:01:21 +00:00
Jeff Washington (jwash) 952c3bcbb7
AccountSharedData construction (#15790) 2021-03-11 18:09:04 -06:00
Jeff Washington (jwash) 3419a5446e
AccountSharedData.set_data (#15781)
* account.set_data and resize_data

* remove data_resize
2021-03-11 16:40:45 -06:00
Jack May 478518308d
Share RO and Executable accounts within invocations (#15799) 2021-03-10 23:04:00 -08:00
Jeff Washington (jwash) 52e54e1100
account.data -> data() (#15778) 2021-03-09 22:31:33 +00: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
Jack May 3cd00965a7
Enable BPF program instruction traces (#15613) 2021-03-01 23:11:58 -08:00
Michael Vines 5df36aec7d Pacify clippy 2021-02-19 20:08:41 -08:00