Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Return error if Transaction contains writable executable or ProgramDa…
Browse files Browse the repository at this point in the history
…ta accounts (backport #19629) (#19729)

* Return error if Transaction contains writable executable or ProgramData accounts (#19629)

* Return error if Transaction locks an executable as writable

* Return error if a ProgramData account is writable but the upgradable loader isn't present

* Remove unreachable clause

* Fixup bpf tests

* Review comments

* Add new TransactionError

* Disallow writes to any upgradeable-loader account when loader not present; remove is_upgradeable_loader_present exception for all other executables

(cherry picked from commit 38bbb77)

# Conflicts:
#	programs/bpf/tests/programs.rs
#	runtime/src/accounts.rs
#	runtime/src/bank.rs
#	sdk/src/transaction.rs
#	storage-proto/proto/transaction_by_addr.proto
#	storage-proto/src/convert.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <[email protected]>
Co-authored-by: Tyera Eulberg <[email protected]>
  • Loading branch information
3 people authored Sep 9, 2021
1 parent a78c3c0 commit 3eee222
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 27 deletions.
16 changes: 8 additions & 8 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1842,10 +1842,10 @@ fn test_program_bpf_invoke_upgradeable_via_cpi() {
invoke_and_return,
&[0],
vec![
AccountMeta::new(program_id, false),
AccountMeta::new(program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
AccountMeta::new_readonly(program_id, false),
AccountMeta::new_readonly(program_id, false),
AccountMeta::new_readonly(clock::id(), false),
AccountMeta::new_readonly(fees::id(), false),
],
);

Expand Down Expand Up @@ -2022,10 +2022,10 @@ fn test_program_bpf_upgrade_via_cpi() {
invoke_and_return,
&[0],
vec![
AccountMeta::new(program_id, false),
AccountMeta::new(program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
AccountMeta::new_readonly(program_id, false),
AccountMeta::new_readonly(program_id, false),
AccountMeta::new_readonly(clock::id(), false),
AccountMeta::new_readonly(fees::id(), false),
],
);

Expand Down
Loading

0 comments on commit 3eee222

Please sign in to comment.