52 Commits

Author SHA1 Message Date
Alexander Meißner
a71f05f86c
Fix CPI duplicate account privilege escalation (#22752)
* Adds TEST_DUPLICATE_PRIVILEGE_ESCALATION_SIGNER and TEST_DUPLICATE_PRIVILEGE_ESCALATION_WRITABLE.

* Moves CPI privilege verification out of deduplication loop.
2022-01-28 00:52:02 +01:00
Jack May
e16c060abf
nit: better rust (#21058) 2021-10-28 17:13:42 -07:00
Jack May
53358ab1aa
fix account index (#21041) 2021-10-28 09:03:47 -07:00
Brian Anderson
d9b0fc0e3e
Remove @brief annotations from Rust API docs (#20769) 2021-10-19 15:48:15 -06:00
Michael Vines
3b70cdb8d8 Upgrade to Rust 1.55.0 2021-10-06 17:48:58 -07:00
Sean Young
66e6110f5a Fix return data too large test 2021-09-30 10:53:49 +01:00
Jack May
037c9f571e
Improve test maintainability (#20318) 2021-09-29 13:13:10 -07:00
Jack May
8fee9a2e1a
Dont call precompiled programs (#19930) 2021-09-29 06:25:08 +00:00
Sean Young
098585234d Add return data implementation
This consists of:
 - syscalls
 - passing return data from invoked to invoker
 - printing to stable log
 - rust and C SDK changes
2021-09-10 14:25:54 +01:00
Jack May
529fefc7cc
Remove native id check in pda creation (#19595) 2021-09-07 14:44:52 -07:00
Jack May
0247c280ff
Run BPF program unit tests (#18982) 2021-07-30 15:15:06 -07:00
Trent Nelson
d3a7e22112 sdk: refactor pda generation 2021-06-30 19:01:51 -06:00
Jack May
2fbedd834f Don't update if already an executable 2021-06-26 19:19:26 -06:00
Jack May
80e5b24b38
Fix CPI recursion depth (#17659)
* Fix CPI recursion depth
2021-06-02 11:15:19 +02:00
Jack May
a3240aebde
Always bail if program modifies a ro account (#17569) 2021-05-28 09:50:25 -07:00
Jack May
9b3a59f030
Retain alloc'd and updated data in cpi (#16850) 2021-04-27 13:36:42 -07:00
Jack May
cc38ae72e7
Skip deserialization of readonly accounts (#15813) 2021-03-11 19:28:21 -08:00
Jack May
77572a7c53
Track account writable deescalation (#14626) 2021-01-22 15:28:01 -08:00
Jack May
aa96ad042b
Add signer/writable de/escalation tests (#14726) 2021-01-21 09:19:46 +00:00
Jack May
ec48631fc5
Bail on all CPI errors (#14500)
* Bail on all CPI errors

* whitespace
2021-01-09 02:27:39 +00:00
Jack May
5524938a50
Limit CPI instruction size (#14317) 2020-12-29 01:14:17 +00:00
Jack May
b1d702a618
Don't use caller passed executable account (#14276) 2020-12-23 14:34:14 -08:00
Jack May
025f886e10
check for resize access violations (#14142) 2020-12-15 23:21:08 -08:00
Jack May
ab98c1f2d4
Add try_find_program_address syscall (#14118) 2020-12-15 08:15:01 -08:00
Jack May
e1a4251b07
Cap CPI signers (#14021) 2020-12-09 02:14:53 -08:00
Jack May
661ca52135
Cap seeds not signers (#13941) 2020-12-03 09:58:25 -08:00
Jack May
1c51711c75
Invoke with empty account slice (#13931) 2020-12-03 07:06:26 -08:00
Michael Vines
6705b5a98c Add msg! macro for program logging, deprecate info! macro 2020-11-30 20:39:42 -08:00
Jack May
15057b087c
Expand CPI returning error test (#13672) 2020-11-18 22:18:49 +00:00
Michael Vines
dd711ab5fb Rename solana-program-sdk to solana-program 2020-10-24 08:37:55 -07:00
Michael Vines
fe68f7f786 Port programs to solana-program-sdk 2020-10-24 08:37:55 -07:00
Michael Vines
6d5889bdb5 Remove program_stubs!() 2020-10-19 21:00:17 +00:00
Jack May
969f7b015b
Respect RefCell when calling invoke (#12858)
* Respect RefCell when calling invoke

* nudge
2020-10-15 01:06:41 +00:00
Jack May
56211378d3
terminology update, nonce to bump seed (#12840) 2020-10-13 10:11:08 -07:00
Jack May
2cd7cd3149
Bump max invoke depth to 4 (#12742) 2020-10-09 10:33:12 -07:00
Jack May
d0aa8a6446
Fix zero-len slice translations (#12642) 2020-10-02 17:45:39 -07:00
Jack May
adeb06e550
Check CPI program is executable (#12644) 2020-10-02 13:55:22 -07: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
Jon Cinque
9a366281d3
sdk: Make PubKey::create_program_address available in program unit tests (#11745)
* sdk: Make PubKey::create_program_address available in program unit tests

This finishes the work started in #11604 to have
`create_program_address` available when `target_arch` is not `bpf` and
`program` is enabled.  Otherwise, there is an undefined reference error
to `sol_create_program_address`, which is only defined in `bpf`.

A small test to simply call the function has been added in order to catch
the problem in the future.

The default dependency to `solana-sdk/default` doesn't cause a problem with
existing programs since `build.sh` always specifies
`--no-default-features`, and programs in `solana-program-library` all
use it too.

* Add `default-features = false` for inter-program dependencies

Fix the build error found during CI.  The `--no-default-features` flag
only applies to the top-level package, and not to dependencies.  A program that
depends on another program, i.e. `128bit` which depends on `128bit_dep`,
must specify `default-features = false` when including that package,
otherwise the `bpf` build will try to pull in default packages, which
includes `std`.
2020-08-24 19:28:36 +02: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
e9b610b8df
Add SystemInstruction::CreateAccount support to CPI (#11649) 2020-08-17 13:38:42 -07:00
Jack May
750e5344f1
Return an error from create_program_address syscall (#11658) 2020-08-17 09:49:40 -07:00
Jack May
140b2392f6
Unified signature for create_program_address (#11460) 2020-08-10 10:24:11 -07:00
Jack May
03263c850a
Force program address off the curve (#11323) 2020-08-05 16:35:54 -07:00
Jack May
52526a9bc2
Prevent stub inclusion when building shared objects (#10875) 2020-07-01 13:15:30 -07:00
Jack May
73586c1aad
Use &[u8] for program address seeds rather then &str (#10744) 2020-06-22 16:51:43 -07:00
Jack May
d77818c18b
Pull program stubs into SDK (#10704) 2020-06-18 23:23:28 -07:00
Jack May
03abd3ddd7
Prevent privilege escalation (#10232)
automerge
2020-05-26 01:02:31 -07:00
Jack May
4a72c2b054
Support cross-program invocation to native programs (#10136) 2020-05-20 09:24:57 -07:00
Jack May
97e17f9b32 Programs can only sign their accounts 2020-05-11 09:06:05 -07:00