-
Notifications
You must be signed in to change notification settings - Fork 0
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
Profile risc0 and use AccountTrie in server #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After completing the review I assume that the SECURITY ASSUMPTION comments are intended, so lgtm
// SECURITY ASUMPTION: see Account docs | ||
// if withdrawer_account.public_key != *withdrawer { | ||
// return Err(("hash collision detected on withdrawer account").into()); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this at a later stage?
@@ -35,6 +35,7 @@ mod error { | |||
use super::*; | |||
use core::fmt::{Debug, Display}; | |||
|
|||
#[allow(dead_code)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to be used in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully not, but maybe.
no_std Error
should be in 1.80 I think.
// SECURITY ASUMPTION: see Account docs | ||
// if sender_account.public_key != *sender { | ||
// return Err(("hash collision detected on sender account").into()); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just left that anywhere I made the assumption.
Merge #94 before this PR.
Changes
We now use the same code in the circuit and server.
We now precheck transactions before attempting to include them in a batch.
We now rely on the security of sha(public_key) instead of also checking the public key matches the one used to create an account. This made the circuit a bit more efficient (see 3526834).
Profiling
Our circuit is already pretty optimized unfortunately.
60% of cycles are spent calculating the merkle root, 30% on deserializing the data into risc0.
Maybe we can use the older risc0 custom sterilization instead of serde.
I can align the data a bit better, maybe I can optimize
calc_subtree_hash
a bit, but not much.