-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track account writable deescalation #14626
Track account writable deescalation #14626
Conversation
0dc645f
to
8a14638
Compare
@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 |
(cherry picked from commit 77572a7) # Conflicts: # sdk/src/feature_set.rs
* Track account writable deescalation (#14626) (cherry picked from commit 77572a7) # Conflicts: # sdk/src/feature_set.rs * fix conflicts Co-authored-by: Jack May <[email protected]>
.iter() | ||
.map(|keyed_account| keyed_account.is_writable()) | ||
.collect::<Vec<bool>>(); | ||
caller_privileges.insert(0, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackcmay why insert false
here? And isn't caller_privileges
supposed to be aligned with accounts
rather than keyed_accounts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC it holds the space of the program, which isn't part of the keyed_accounts
and the program is not writeable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, it doesn't look like that's the case anymore on latest master so I have a fix here: #18616
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