-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat(accounts): Store signing public keys in immutable private notes in account contracts #1080
Conversation
0c6730f
to
787b796
Compare
context = emit_encrypted_log( | ||
context, | ||
this, | ||
storage.public_key.storage_slot, | ||
get_public_key(this), | ||
pub_key_note.serialise(), | ||
); |
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.
@LeilaWang should this be part of ImmutableSingleton#initialise
? Or is there a scenario where we may want to initialise it without emitting the corresponding encrypted log?
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 actually thought about the same - emitting a log when a note is created (in singleton.initialise, set.insert, etc). But then decided to keep it separate. Because in some use cases we might want to emit unencrypted logs instead of encrypted ones. And in some use cases, like you said, we might not want to emit anything at all (for example, the ClaimNote in zk_token_contract).
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've added a header to a note in a recent PR, and will change the emit apis to be cleaner since we won't be passing context, contract address and storage slot around :)
This reverts commit 0efa8f1.
478a22d
to
4028f5f
Compare
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.
Just minor issues. Happy to approve once addressed.
yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/src/main.nr
Outdated
Show resolved
Hide resolved
yarn-project/noir-contracts/src/contracts/schnorr_multi_key_account_contract/src/storage.nr
Outdated
Show resolved
Hide resolved
context = emit_encrypted_log( | ||
context, | ||
this, | ||
storage.public_key.storage_slot, | ||
get_public_key(this), | ||
pub_key_note.serialise(), | ||
); |
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 actually thought about the same - emitting a log when a note is created (in singleton.initialise, set.insert, etc). But then decided to keep it separate. Because in some use cases we might want to emit unencrypted logs instead of encrypted ones. And in some use cases, like you said, we might not want to emit anything at all (for example, the ClaimNote in zk_token_contract).
context = emit_encrypted_log( | ||
context, | ||
this, | ||
storage.public_key.storage_slot, | ||
get_public_key(this), | ||
pub_key_note.serialise(), | ||
); |
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've added a header to a note in a recent PR, and will change the emit apis to be cleaner since we won't be passing context, contract address and storage slot around :)
Fixes #1007