Don't require program_id to passed down cpi call chain#34191
Don't require program_id to passed down cpi call chain#34191seanyoung wants to merge 2 commits intosolana-labs:masterfrom
Conversation
83a622b to
9c6ee2a
Compare
Lichtso
left a comment
There was a problem hiding this comment.
Some nits, otherwise looking good.
| (validate_fee_collector_account::id(), "validate fee collector account #33888"), | ||
| (disable_rent_fees_collection::id(), "Disable rent fees collection #33945"), | ||
| (enable_zk_transfer_with_fee::id(), "enable Zk Token proof program transfer with fee"), | ||
| (program_id_not_required_in_instruction::id(), "Don't require a program id to be passed down the cpi chain"), |
There was a problem hiding this comment.
program_id_not_required_in_instruction suggests that you don't require a program key in instructions at all anymore. Maybe a better name would be "lift program key in parent instruction restriction" or something like that.
There was a problem hiding this comment.
I've struggled to come up with a good name. I've called it no_need_for_program_key_in_parent_instruction. I'm open to ideas here, it's not great
| // Here we are not passing caller2_pubkey down, but cpi should still succeed | ||
| let account_metas = vec![ | ||
| AccountMeta::new_readonly(caller_pubkey, false), | ||
| AccountMeta::new_readonly(caller2_pubkey, false), |
There was a problem hiding this comment.
But this is passing caller2_pubkey down right here.
There was a problem hiding this comment.
Yes, that was not great. I've created some better tests below
c55e622 to
f95730c
Compare
f95730c to
90a7fc4
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #34191 +/- ##
=========================================
- Coverage 81.9% 81.9% -0.1%
=========================================
Files 819 819
Lines 219380 219466 +86
=========================================
+ Hits 179773 179810 +37
- Misses 39607 39656 +49 |
|
This repository is no longer in use. Please re-open this pull request in the agave repo: https://github.com/anza-xyz/agave |
Problem
When using cpi, the callee program id must be passed down the call chain. Remove this restriction. See #34057
Summary of Changes
Find the program_id in the transaction context rather than in the instruction context.
Fixes #