Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📎 Subscription Registry #26

Open
alecchendev opened this issue Mar 14, 2022 · 0 comments · May be fixed by #48
Open

📎 Subscription Registry #26

alecchendev opened this issue Mar 14, 2022 · 0 comments · May be fixed by #48
Assignees
Labels
atomic Single task, well defined

Comments

@alecchendev
Copy link
Member

alecchendev commented Mar 14, 2022

Would be nice to have this before launch/video demo

Basic outline

  • two accounts - 1 holding a long ass list, 1 holding count
  • data is just straight bytes denoting parameters (32 for payee key, 8 for amount, 8 for duration = 48 bytes total per entry)
  • start with just one account (max size = 10MB = 10,000,000B = ~200,000 48B entries), can upgrade later if needed
  • all the function does is
    • validates the pda
    • takes current list, withdraws rent from account to signer, allocates new account with space for a new entry (payer is signer), appends new entry to list and populates new account data

PDA seed schemes:

let registry_seeds = &[
    b"subscription_registry",
    &count.to_le_bytes(),
];
let counter_seeds = &[
    b"registry_counter",
];

Question

  • Should subscriptions just be automatically be added to registry upon the first creation of one? (default: no)
    • would mean that literally every subscription is on the registry but also could clog registry with dummy/test subscriptions that don't actually need to be stored
    • also ig if products wanted to limit renewals to their own cranks opting out of the registry is helpful ig... but if ppl paying then the info is out there...

Checking

  • Check if the subscription is actually initialized when they go to add it by taking in the count as an input
  • This way someone cannot just bullshit a list

To Do

  • Constant time lookup (prevent duplicating a subscription using hash map)
  • Also possible solution to previous question, could allow user the option to add a subscription to registry with an input bool
@alecchendev alecchendev added the atomic Single task, well defined label Mar 14, 2022
@vsiva308 vsiva308 self-assigned this Mar 24, 2022
@vsiva308 vsiva308 linked a pull request Apr 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
atomic Single task, well defined
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants