sdk: append the payer Permission account on feed and user commands - #4228
Conversation
6863d60 to
7604a8b
Compare
A signer that only holds those grants on its Permission account was denied on feed create/delete/update and user delete/update because those sends never included the trailing account.
7604a8b to
0c4e734
Compare
ReviewI traced the on-chain side as well —
Four findings below. The first two are worth addressing before merge. 1.
|
juan-malbeclabs
left a comment
There was a problem hiding this comment.
All four findings from my review are addressed in dfcef1a9.
- RPC failure vs. absence —
append_payer_permission_accountreturnseyre::Result<()>and goes throughget_multiple_accounts(vec![pda])?, soOk(None)is definitive absence and a real RPC error propagates instead of silently degrading to the0x8 NotAllowedthis PR exists to eliminate. All five call sites use?. - Role-strip path —
UpdateMulticastGroupRolesCommandnow appends the account, covering the strip thatuser delete/request-banandfeed update|delete --force-unsubscriberun first.split_trailing_permissionmatches the account by PDA againstremaining[n - 3], so the variable-lengthextra_group_pkstail from #4120 parses correctly, and the new..._extra_groups_with_permission_pdatest exercises that batch + permission layout directly. No new deploy-ordering hazard: the trailing-permission tolerance on this instruction landed in #3966, already in released tags. - Memoization —
DZClient::permission_account_cache(Unresolved | Absent | Present) with invalidation onCreatePermission/DeletePermission.send_transaction_inneris the single send path (the legacyexecute_transactionis gone), so no permission mutation through this client bypasses the hook;Update/Suspend/Resumechange neither existence nor owner, which is all the append decision reads. Tenant delete over N users is one lookup instead of N. - Docs —
feed.rsandbuild_with_permissionnow record the caller-side partial activation and which commands it covers.
Two cosmetic leftovers, no need to block on them:
smartcontract/sdk/rs/src/commands/tenant/delete.rs:397still labels the expectation9. GetPermissionCommand: get(permission_pda); it is aget_multiple_accountscall now.smartcontract/sdk/rs/src/client.rs:357binds the cachedAccountasref permission_pda— the name says PDA, the value is the account.
dfcef1a to
8e30b0d
Compare
Summary of Changes
doublezero feed create,feed delete,feed update,user delete, anduser updatewhen that account exists and the serviceability program owns it.doublezero user createis unchanged. That instruction counts accounts to detect an optional tenant.Part of https://github.com/malbeclabs/infra/issues/2343
Testing Verification