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

Key-value state caches #103

Closed
3 tasks
nickgarfield opened this issue Dec 3, 2022 · 1 comment
Closed
3 tasks

Key-value state caches #103

nickgarfield opened this issue Dec 3, 2022 · 1 comment

Comments

@nickgarfield
Copy link
Member

nickgarfield commented Dec 3, 2022

Many threads need to share state between instructions. Programs are forced to save this state into an account and add the account as an input to all downstream instructions which need to read/write to it. Adding an extra account to programs can be tricky, deriving its PDA is error-prone, and mutating its data is restricted only to the program that owns it. Can we do better?

We know the thread account will be a signer on every executed instruction. Knowing this, thread accounts could provide a convenient location to save information that needs to be shared to downstream instructions. Any instruction would be able to write to a thread's cache simply by returning a KV map of data in the ThreadResponse. Downstream instructions would be able to access this data from the cache and update it.

Open questions:

  • Should programs be forced to sign the data they write to the cache? This would help programs verify data authorship.
  • Do programs need to care about data authorship? Or do threads provide a "trusted" computing environment?
  • Should a thread's cache be deleted between each kickoff? It doesn't need to be.
@nickgarfield nickgarfield changed the title Add a key-value cache to threads, allowing programs to pass data to downstream instructions Add a key-value cache to threads Dec 3, 2022
@nickgarfield nickgarfield changed the title Add a key-value cache to threads Key-value caching Dec 3, 2022
@nickgarfield nickgarfield changed the title Key-value caching Key-value state caches Dec 3, 2022
@nickgarfield nickgarfield added enhancement New feature or request and removed enhancement New feature or request labels Dec 5, 2022
@nickgarfield
Copy link
Member Author

With caches, developers could use threads to solve problems like this:
https://solana.stackexchange.com/questions/4715/how-to-get-result-of-a-previous-instruction-within-a-transaction

@nickgarfield nickgarfield closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant