v1.18: Ensure mapping of callee is updated with direct mapping (backport of #1093)#1779
v1.18: Ensure mapping of callee is updated with direct mapping (backport of #1093)#1779mergify[bot] wants to merge 1 commit intov1.18from
Conversation
|
Cherry-pick of cd7f34e has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Consider this scenario: - Program increases length of an account - Program start CPI and adds this account as a read-only account - In fn update_callee_account() we resize account, which may change the pointer - Once CPI finishes, the program continues and may read/write from the account. The mapping must be up-to-date else we use stale pointers. Note that we always call callee_account.set_data_length(), which may change the pointer. In testing I found that resizing a vector from 10240 down to 127 sometimes changes its pointer. So, always update the pointer. (cherry picked from commit cd7f34e)
ce5f3f1 to
b7d9263
Compare
|
Testnet will adopt v2.0 (what is currently master) soon (hopefully within a week or two). I think this warrants backporting anyway, but the testnet direct mapping won't be blocked if we don't |
Yes, this can be tested with v2.0 so I'm inclined to have it just wait for that and not risk 1.18. |
Consider this scenario:
Note that we always call callee_account.set_data_length(), which may change the pointer. In testing I found that resizing a vector from 10240 down to 127 sometimes changes its pointer. So, always update the pointer.
Problem
Summary of Changes
Fixes #
This is an automatic backport of pull request #1093 done by [Mergify](https://mergify.com).