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

ark-secret-scalar via atomics #52

Open
burdges opened this issue May 16, 2023 · 0 comments
Open

ark-secret-scalar via atomics #52

burdges opened this issue May 16, 2023 · 0 comments

Comments

@burdges
Copy link
Collaborator

burdges commented May 16, 2023

ark_secret_scalar::SecretScalar: !Sync due to its UnsafeCell. Although Mutex works, we could've some less strictly synchronized flavor in which readers access a different secret from the one mutator. We've several plausible approaches but maybe: Anytime a reader finishes then they attempt to point readers to a secret with zero readers, provided one exists. If you're the last reader on a secret then you mutate it before zeroing the readers counter. It looks safe if you're three secrets.

pub struct InnerSecretScalar {
    readers: AtomicUsize,
    secrets: [F; 2],
}
pub struct SecretScalar {
    reader: AtomicUsize,
    inners: [InnerSecretScalar; 3]
}

We should simply implement constant time curves instead. lol

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