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

refactor: SnarkableTree #183

Open
distractedm1nd opened this issue Dec 18, 2024 · 0 comments
Open

refactor: SnarkableTree #183

distractedm1nd opened this issue Dec 18, 2024 · 0 comments

Comments

@distractedm1nd
Copy link
Contributor

/// Represents a tree that can be used to verifiably store and retrieve [`Account`]s.
/// The methods of this trait are NOT run in circuit: they are used to create verifiable inputs for the circuit.
/// This distinction is critical because the returned proofs must contain all information necessary to verify the operations.
pub trait SnarkableTree: Send + Sync {
    fn process_transaction(&mut self, transaction: Transaction) -> Result<Proof>;
    fn insert(&mut self, key: KeyHash, tx: Transaction) -> Result<InsertProof>;
    fn update(&mut self, key: KeyHash, tx: Transaction) -> Result<UpdateProof>;
    fn get(&self, key: KeyHash) -> Result<AccountResponse>;
}

This trait has changed a bit historically and is now big stupid. We should find a better way to model this. Specifically, it doesn't need to be a trait and KDT can implement the methods directly - with process_transaction and get being the only public methods

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