This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Track account writable deescalation#14626
Merged
jackcmay merged 1 commit intosolana-labs:masterfrom Jan 22, 2021
Merged
Conversation
0dc645f to
8a14638
Compare
Contributor
Author
|
@mvines Looks like SPL Feature Proposal breaks with these changes. Is it trying to write to accounts that have been passed as read-only via cpi? |
8a14638 to
8ce0edd
Compare
8ce0edd to
6488428
Compare
Codecov Report
@@ Coverage Diff @@
## master #14626 +/- ##
=======================================
Coverage 80.3% 80.3%
=======================================
Files 403 403
Lines 102296 102343 +47
=======================================
+ Hits 82196 82238 +42
- Misses 20100 20105 +5 |
mergify Bot
pushed a commit
that referenced
this pull request
Jan 22, 2021
(cherry picked from commit 77572a7) # Conflicts: # sdk/src/feature_set.rs
jstarry
reviewed
Jul 12, 2021
| .iter() | ||
| .map(|keyed_account| keyed_account.is_writable()) | ||
| .collect::<Vec<bool>>(); | ||
| caller_privileges.insert(0, false); |
Contributor
There was a problem hiding this comment.
@jackcmay why insert false here? And isn't caller_privileges supposed to be aligned with accounts rather than keyed_accounts?
Contributor
Author
There was a problem hiding this comment.
IIRC it holds the space of the program, which isn't part of the keyed_accounts and the program is not writeable
Contributor
There was a problem hiding this comment.
Got it, it doesn't look like that's the case anymore on latest master so I have a fix here: #18616
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
If a program passes a readwrite account as readonly to an inner instruction, then any writes should cause an error. Since the runtime doesn't track changes to write deescalation, it allows those instructions to succeed but will not return those state changes to the caller program
Summary of Changes
Track the writable flag through the call flow
Fixes #13908