-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1090 - noir code should never push a zero nullified_commitment
- Loading branch information
Showing
2 changed files
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
use crate::context::{PrivateContext, PublicContext}; | ||
use crate::oracle::compute_selector::compute_selector; | ||
use crate::constants_gen::EMPTY_NULLIFIED_COMMITMENT; | ||
|
||
global IS_VALID_SELECTOR = 0xe86ab4ff; | ||
global IS_VALID_PUBLIC_SELECTOR = 0xf3661153; | ||
|
||
fn assert_valid_message_for(context: &mut PrivateContext, whom: Field, message_hash: Field) { | ||
let result = context.call_private_function(whom, IS_VALID_SELECTOR, [message_hash])[0]; | ||
context.push_new_nullifier(message_hash, 0); | ||
context.push_new_nullifier(message_hash, EMPTY_NULLIFIED_COMMITMENT); | ||
assert(result == IS_VALID_SELECTOR, "Message not authorized by account"); | ||
} | ||
|
||
fn assert_valid_public_message_for(context: &mut PublicContext, whom: Field, message_hash: Field) { | ||
let result = context.call_public_function(whom, IS_VALID_PUBLIC_SELECTOR, [message_hash])[0]; | ||
context.push_new_nullifier(message_hash, 0); | ||
context.push_new_nullifier(message_hash, EMPTY_NULLIFIED_COMMITMENT); | ||
assert(result == IS_VALID_SELECTOR, "Message not authorized by account"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters