Trent Nelson
d3a7e22112
sdk: refactor pda generation
2021-06-30 19:01:51 -06:00
Alexander Meißner
6514096a67
chore: cargo +nightly clippy --fix -Z unstable-options
2021-06-18 10:42:46 -07:00
Jack May
83b9a046d1
Add missing ProgramError to InstructionError mappings ( #16231 )
...
* Add missing ProgramError to InstructionError mappings
* add note
* Clarify process of adding new program error
2021-06-03 21:59:04 +00:00
Jack May
89ee8778bc
Unify BPF verifiers ( #17585 )
2021-05-28 14:24:02 -07:00
Jack May
a3240aebde
Always bail if program modifies a ro account ( #17569 )
2021-05-28 09:50:25 -07:00
Dmitri Makarov
85b647d80f
Bump solana_rbpf to version 0.2.11 ( #17404 )
2021-05-25 08:05:35 +00:00
Alexander Meißner
855ae79598
Fix InvokeContext::push() account_deps ( #17350 )
...
* Reverts aliasing of account_deps with the previous invocation stack frame in InvokeContext::push().
* Adds explicit assert of programdata account content in test_program_bpf_upgrade_via_cpi.
2021-05-21 22:34:07 +02:00
Jack May
477898f682
Optimize aligned memory used by the runtime ( #17324 )
2021-05-19 13:43:59 -07:00
Jeff Washington (jwash)
541aa5ad85
tests: lamports -> lamports() ( #16982 )
2021-05-03 10:45:54 -05:00
Jeff Washington (jwash)
763c04adf3
lamports = -> .set_lamports() ( #16980 )
2021-04-30 21:17:05 +00:00
Jeff Washington (jwash)
ac87bc40ca
tests: .lamports -> .lamports() ( #16976 )
2021-04-30 18:16:58 +00:00
Jeff Washington (jwash)
59e19828ea
set_lamports() ( #16914 )
2021-04-29 10:43:26 -05:00
Jeff Washington (jwash)
a7a671b3aa
AccountSharedData.set_executable() ( #16881 )
2021-04-28 14:07:43 +00:00
Jeff Washington (jwash)
2021255f91
executable() ( #16880 )
2021-04-28 08:53:54 -05:00
Jeff Washington (jwash)
69bfbf9e98
AccountSharedData.set_executable ( #16836 )
2021-04-27 09:56:50 -05:00
Jeff Washington (jwash)
4e7e675c07
lamports += -> checked_add_lamports ( #16791 )
2021-04-27 09:11:35 -05:00
Jeff Washington (jwash)
aeff911c93
owner -> owner() ( #16784 )
2021-04-26 10:40:11 -05:00
Jeff Washington (jwash)
1a4a7059af
owner -> owner() ( #16785 )
2021-04-23 15:59:13 -05:00
Jeff Washington (jwash)
fb0b76c1f3
account.owner = X -> account.set_owner(X) ( #16754 )
2021-04-23 12:34:22 -05:00
Jack May
08d5253651
Enforce host aligned memory for program regions ( #16590 )
2021-04-20 11:07:30 -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
dee655df35
Cleanup use ( #16327 )
2021-04-02 08:54:09 -07:00
Jeff Washington (jwash)
66c42f62d8
make AccountSharedData.data private to abstract storage ( #16091 )
...
* format
* 2 more tests
* use
2021-03-25 11:04:20 -05: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)
2d24d13046
AccountsSharedData: data copy on write ( #15800 )
...
* Arc<AccountData>
* try custom serializer
* adapt test from Behzad's change
* clippy
* simplify serialization
* remove abi example derive
* refactor 'take'
* remove serialization
* remove serialize calls
* remove account_data
* remove intos
* remove left over file
2021-03-23 15:19:31 -05:00
Jeff Washington (jwash)
64429104b1
account data.fill replacement ( #16037 )
2021-03-19 15:13:20 -05:00
Jack May
7f500d610c
Add Close instrruction and tooling to upgradeable loader ( #15887 )
2021-03-17 21:39:29 -07:00
Jeff Washington (jwash)
d30c9ef351
refactor test truncate data ( #15851 )
...
* refactor test truncate data
* retain existing behavior
2021-03-17 15:09:26 -05:00
Jack May
ad9901d7c6
Charge compute budget for bytes passed via cpi ( #15874 )
2021-03-15 22:41:44 -07:00
Jack May
cc38ae72e7
Skip deserialization of readonly accounts ( #15813 )
2021-03-11 19:28:21 -08: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)
1135ffd595
mut data refs as slice ( #15782 )
2021-03-10 15:28:03 -06:00
Jack May
369e13b111
cleanup old runtime features ( #15787 )
2021-03-10 09:48:41 -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
Jeff Washington (jwash)
be35c1c1b7
add execute detail timings ( #15638 )
2021-03-03 17:07:45 -06:00
Jack May
d73af9c1dd
cli: don't overallocate upgradeable buffer accounts ( #15603 )
2021-03-02 00:45:53 -08: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
Jack May
02432a548f
Cleanup old features ( #15391 )
2021-02-18 09:56:11 -08:00
Trent Nelson
7f7370c306
Re-allow clippy::integer_arithmetic at crate-level
2021-02-17 13:55:08 -07:00
Jack May
d24d5fba0e
Upgradeable loader max_data_len limit ( #15039 )
2021-02-03 09:16:25 -08:00
Jack May
07cef5a557
Buffer authority must match upgrade authority for deploys and upgrades ( #14923 )
2021-01-29 12:43:42 -08:00
Jack May
0b1015f7d3
Richer runtime failure logging ( #14875 )
2021-01-28 10:04:54 -08:00
Michael Vines
3c6dbd21d2
Add ic_msg()/ic_logger_msg() macros
2021-01-21 21:41:33 +00:00
Jack May
a480b63234
Bail on small deploy buffers ( #14677 )
2021-01-20 01:56:44 +00:00
Jack May
e3bd9e5300
Prevent the invoke and upgrade of programs in the same tx batch ( #14653 )
...
* Prevent the invoke and upgrade of programs in the same tx batch
* Pass program address as writable in the upgrade instruction
2021-01-19 16:24:44 -08:00
Jack May
9d53eca6e3
Report correct program id ( #14486 )
2021-01-08 14:43:24 -08:00
Jack May
58487c6360
Add buffer authority to upgradeable loader ( #14482 )
2021-01-08 09:37:57 -08:00
Jack May
0619805806
Upgradeable programs needs program account's address as program id ( #14417 )
2021-01-04 21:45:05 +00:00
Jack May
6c6095abe7
nit: clarify loader id ( #14355 )
2020-12-30 20:02:29 +00:00
Jack May
5524938a50
Limit CPI instruction size ( #14317 )
2020-12-29 01:14:17 +00:00
Jack May
ee0a80a092
Prevent bpf loader impersonators ( #14278 )
2020-12-24 03:04:48 +00:00
Jack May
ab205b682a
Upgradeable programs called same as non-upgradeable ( #14239 )
...
* Upgradeable programs called same as non-upgradeable
* nudge
2020-12-22 09:26:55 -08:00
Jack May
593ad80954
Fix program account rent exemption ( #14176 )
2020-12-17 09:02:31 +00:00
Jack May
d513b0c4ca
Add Program loader/environment instruction errors ( #14120 )
2020-12-15 09:54:07 -08:00
Jack May
9e90394583
Upgradeable loader ( #13689 )
2020-12-14 15:35:10 -08:00
Alexander Meißner
a706706572
Validator CLI option to enable just-in-time compilation of BPF ( #13789 )
...
* Adds a CLI option to the validator to enable just-in-time compilation of BPF.
* Refactoring to use bpf_loader_program instead of feature_set to pass JIT flag from the validator CLI to the executor.
2020-12-07 09:49:55 +01:00
Alexander Meißner
c833ede4af
Rbpf v0.2.1 ( #13732 )
...
* Refactoring to match rbpf-v0.2.1 and add JIT compilation caching.
* Removes obsolete bpf-trace.py which has been replaced by the rbpf CLI tool.
2020-11-24 18:00:19 +01:00
Jack May
3a9dca0c67
Add back BPF error logging ( #13633 )
...
* Add back BPF error logging
* Update programs/bpf_loader/src/lib.rs
Co-authored-by: Michael Vines <mvines@gmail.com>
2020-11-17 08:10:14 +00:00
Michael Vines
baa6b3a261
Add stable program logging for BPF and native programs
2020-11-14 08:26:01 -08:00
Jack May
30ef53cb13
fix bpf lddw check ( #13554 )
2020-11-12 13:13:42 -08:00
Alexander Meißner
4999fe298b
Rbpf v0.2.0 ( #13365 )
...
* Updates rbpf to v0.2.0,
which unifies the interfaces of the interpreter and the JIT.
However, the JIT is not enabled yet.
2020-11-04 18:46:26 +01:00
Michael Vines
da9548fd12
de-mut some InvokeContext methods
2020-10-30 09:20:09 +00:00
Michael Vines
da361afbb9
Revert "Updates rbpf to v0.2.0, ( #12951 )"
...
This reverts commit 6606590b81
.
2020-10-29 21:45:24 -07:00
Michael Vines
7d686b72a0
Add Bank::set_bpf_compute_budget()
2020-10-29 21:45:24 -07:00
Michael Vines
33884d847a
Remove programs clone()
2020-10-29 21:45:24 -07:00
Michael Vines
2664a1f7ef
Remove MessageProcessor::loaders
2020-10-29 21:45:24 -07:00
Michael Vines
df8dab9d2b
Native/builtin programs now receive an InvokeContext
2020-10-29 21:45:24 -07:00
Alexander Meißner
6606590b81
Updates rbpf to v0.2.0, ( #12951 )
...
which unifies the interfaces of the interpreter and the JIT.
However, the JIT is not enabled yet.
2020-10-29 11:34:52 -07:00
Alexander Meißner
65ee3a6bdd
Refactors the common code of test and bench targets into the solana_runtime::bpf_test_utils module. ( #13203 )
2020-10-29 10:04:47 +01: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
7bc073defe
Run `codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand`
2020-10-21 19:08:13 -07:00
Ryo Onodera
c0675968b1
Support Debug Bank ( #13017 )
2020-10-21 01:05:45 +09:00
Jack May
b510474dcb
Report compute budget usage ( #12931 )
2020-10-15 15:55:37 -07:00
Jack May
3f9e6a600b
program log pubkey as base58 ( #12901 )
2020-10-15 09:11:54 -07:00
Jack May
c3907be623
Add adjustable stack size and call depth ( #12728 )
2020-10-09 13:07:09 -07:00
Jack May
2cd7cd3149
Bump max invoke depth to 4 ( #12742 )
2020-10-09 10:33:12 -07:00
Jack May
058bca6632
add sha256 syscall ( #12569 )
2020-09-29 23:29:20 -07:00
Jack May
74fcb184b2
Pipe FeatureSet though InvokeContext ( #12536 )
...
* Pipe FeatureSet though InvokeContext
* gate program size cap
* nit
2020-09-29 21:36:30 +00:00
Jack May
2ff983647f
Move process_instruction defs to runtime ( #12507 )
2020-09-29 01:36:46 -07:00
Jack May
d00453f747
Drain the entire compute budget ( #12478 )
2020-09-25 18:08:10 +00:00
Justin Starry
6601ec8f26
Record and store invoked instructions in transaction meta ( #12311 )
...
* Record invoked instructions and store in transaction meta
* Enable cpi recording if transaction sender is some
* Rename invoked to innerInstructions
2020-09-24 22:36:22 +08:00
Jack May
3278d78f08
Cache re-usable work performed by the loader ( #12135 )
2020-09-14 17:42:37 -07:00
Jack May
ae7b15f062
Gate pointer alignment enforcement ( #12176 )
2020-09-11 11:07:03 -07:00
Jack May
ea179ad762
Bump compute budget ( #11864 )
...
* Bump compute budget
* nudge
2020-08-26 21:48:51 +00:00
Jack May
c2e5dae7ba
Gate aligned program heap ( #11808 )
2020-08-24 13:21:34 -07:00
Jack May
8d362f682b
The constraints on compute power a program can consume is limited only to its instruction count ( #11717 )
2020-08-21 15:31:19 -07:00
Jack May
7c736f71fe
Make BPF Loader static ( #11516 )
2020-08-14 12:32:45 -07:00
Jack May
9290e561e1
Align host addresses ( #11384 )
...
* Align host addresses
* support new program abi
* update epoch rollout
* Enforce aligned pointers in cross-program invocations
2020-08-11 16:11:52 -07:00
Jack May
2dbed80e48
Disable cross-program invocations for OperatingMode::Stable ( #11272 )
2020-07-29 15:29:52 -07:00
Aaron Hill
05445c718e
Fix hygiene issues in `declare_program!` and `declare_loader!`
...
The `declare_program!` and `declare_loader!` macros both expand to
new macro definitions (based on the `$name` argument). These 'inner'
macros make use of the special `$crate` metavariable to access items in
the crate where the 'inner' macros is defined.
However, this only works due to a bug in rustc. When a macro is
expanded, all `$crate` tokens in its output are 'marked' as being
resolved in the defining crate of that macro. An inner macro (including
the body of its arms) is 'just' another set of tokens that appears in
the body of the outer macro, so any `$crate` identifiers used there are
resolved relative to the 'outer' macro.
For example, consider the following code:
```rust
macro_rules! outer {
() => {
macro_rules! inner {
() => {
$crate::Foo
}
}
}
}
```
The path `$crate::Foo` will be resolved relative to the crate that defines `outer`,
**not** the crate which defines `inner`.
However, rustc currently loses this extra resolution information
(referred to as 'hygiene' information) when a crate is serialized.
In the above example, this means that the macro `inner` (which gets
defined in whatever crate invokes `outer!`) will behave differently
depending on which crate it is invoked from:
When `inner` is invoked from the same crate in which it is defined,
the hygiene information will still be available,
which will cause `$crate::Foo` to be resolved in the crate which defines 'outer'.
When `inner` is invoked from a different crate, it will be loaded from
the metadata of the crate which defines 'inner'. Since the hygiene
information is currently lost, rust will 'forget' that `$crate::Foo` is
supposed to be resolved in the context of 'outer'. Instead, it will be
resolved relative to the crate which defines 'inner', which can cause
incorrect code to compile.
This bug will soon be fixed in rust (see https://github.com/rust-lang/rust/pull/72121 ),
which will break `declare_program!` and `declare_loader!`. Fortunately,
it's possible to obtain the desired behavior (`$crate` resolving in the
context of the 'inner' macro) by use of a procedural macro.
This commit adds a `respan!` proc-macro to the `sdk/macro` crate.
Using the newly-stabilized (on Nightly) `Span::resolved_at` method,
the `$crate` identifier can be made to be resolved in the context of the
proper crate.
Since `Span::resolved_at` is only stable on the latest nightly,
referencing it on an earlier version of Rust will cause a compilation error.
This requires the `rustversion` crate to be used, which allows conditionally
compiling code epending on the Rust compiler version in use. Since this method is already
stabilized in the latest nightly, there will never be a situation where
the hygiene bug is fixed (e.g. https://github.com/rust-lang/rust/pull/72121 )
is merged but we are unable to call `Span::resolved_at`.
2020-07-14 14:40:02 -07:00
Jack May
57576b07ef
Fix warnings ( #10992 )
...
* Fix warnings
* disable warning
2020-07-10 20:02:55 +00:00
Jack May
dac7dc2f10
Move types to more appropriate files ( #10638 )
2020-06-17 10:39:14 -07:00
Jack May
b6a9573748
Route all loader messages to log collector ( #10528 )
2020-06-13 13:20:08 -07:00
Michael Vines
7e2651ca51
RPC simulateTransaction endpoint now returns program log output ( #10432 )
2020-06-06 10:18:28 -07:00
Michael Vines
a4cd96609c
Add built-in programs to InvokeContext ( #10383 )
...
automerge
2020-06-03 12:48:19 -07:00