fix: pass fee_payer in TransferInterfaceCpi LightToLight path#2294
fix: pass fee_payer in TransferInterfaceCpi LightToLight path#2294ananas-block merged 1 commit intomainfrom
Conversation
…pi LightToLight path TransferInterfaceCpi hardcoded fee_payer: None for LightToLight transfers, causing PrivilegeEscalation when the on-chain program attempted rent top-ups using the readonly authority account. Pass self.payer as fee_payer instead, since payer is already writable. token-sdk: set fee_payer: Some(self.payer) in TransferInterface::instruction() and add system_program + payer to account_infos in invoke()/invoke_signed(). token-pinocchio: set fee_payer: Some(self.payer) in TransferCpi construction for both invoke() and invoke_signed(). TransferCpi already handles fee_payer in its account_infos internally.
📝 WalkthroughWalkthroughTwo transfer interface implementations are updated to explicitly provide the payer as fee_payer and include system_program and payer accounts in the CPI instruction for LightToLight transfer paths, modifying how these transfers establish their execution context. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
TransferInterfaceCpihardcodedfee_payer: Nonefor LightToLight transfers, causingPrivilegeEscalationwhen the on-chain program attempted rent top-ups using the readonlyauthorityaccountself.payerasfee_payerinstead — payer is already writable (it pays tx fees), so it can fund rent top-upsfee_payer: Some(self.payer)inTransferInterface::instruction()and addsystem_program+payertoaccount_infosininvoke()/invoke_signed()fee_payer: Some(self.payer)inTransferCpiconstruction for bothinvoke()andinvoke_signed()(TransferCpialready handles fee_payer in its account_infos internally)Test plan
cargo test-sbf -p sdk-light-token-test -- test_transfer_interface— 10/10 passedcargo test-sbf -p sdk-light-token-pinocchio-test -- test_transfer_interface— 10/10 passedcargo test -p token-client-test— 4/4 passed (including 2 transfer_interface tests)Summary by CodeRabbit