feat!: Add new path for pda seed input#486
Conversation
f518be7 to
e4a7196
Compare
moudyellaz
left a comment
There was a problem hiding this comment.
lgtm thanks, left some minor comments casue i struggled a bit.
|
One more thing on commit hygiene: the PR title carries Could you add a |
| "Cannot claim unauthorized private PDA {pre_account_id}" | ||
| ); | ||
| } | ||
| Claim::Authorized => {} |
There was a problem hiding this comment.
I don't get why we need this change...
There was a problem hiding this comment.
I mean, now you can claim other users pda-derived accounts, no?
There was a problem hiding this comment.
we need to remove the authorization constraint on claiming private pdas because otherwise there will be no way for bob to send some funds to alice in a (newly initialized) private pda for which bob doesn't know the nsk. It's the same reason we don't impose authorization on claiming a regular private account. The surface area for griefing attacks is reduced compared to public pdas because private ones depend on the npk and an identifier
.
But yes, you could claim other users pdas for a specific npk and identifier.
92be397 to
51e5076
Compare
BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs
51e5076 to
3c6d623
Compare
🎯 Purpose
Private PDAs previously could only be used through a program that used
Claim::Pdaorpda_seedsto establish the binding between the PDAaccount_idand the npk. This meant you couldn't call auth_transfer directly to fund a private PDA, you always needed a wrapper. This PR removes that limitation.⚙️ Approach
Option<(PdaSeed, ProgramId)>field to thePrivatePdaInitandPrivatePdaUpdatevariants ofInputAccountIdentity. When the seed is provided, the circuit verifiesAccountId::for_private_pda(pda_program_id, seed, npk, identifier) == pre_state.account_iddirectly, establishing the binding without needing aClaim::Pdaor callerpda_seeds. It also verifiesis_authoriedis set to false.execution_state.rsfor when an external seed is suppliedpda_fund_spend_proxytopda_spend_proxy. The fund path is now handled directly via auth_transfer.fund_private_pdain integration tests to use auth_transfer directly with the external seed🧪 How to Test
RISC0_DEV_MODE=1 cargo test
🔗 Dependencies
None
🔜 Future Work
Update wallet commands to use the external seed path when appropiate.
📋 PR Completion Checklist
Mark only completed items. A complete PR should have all boxes ticked.