Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Mar 25, 2024
1 parent 5295896 commit 57ddf37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion noir-projects/aztec-nr/aztec/src/messaging.nr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn process_l1_to_l2_message(
content: Field,
secret: Field
) -> Field {
let msg = L1ToL2Message::new(
let mut msg = L1ToL2Message::new(
portal_contract_address,
chain_id,
storage_contract_address,
Expand All @@ -34,5 +34,12 @@ pub fn process_l1_to_l2_message(
let root = compute_merkle_root(message_hash, leaf_index, sibling_path);
assert(root == l1_to_l2_root, "Message not in state");

// Note: Had to add this line to make it work (wasted an hour debugging this). L1ToL2Message noir struct is
// an abomination and it would not have ever got to that state if people followed the logical rule of
// "deserialize(serialize(object)) == object" always being true (there are a few params which are not
// serialzied). Will refactor that in a separate PR.
// TODO(#5420)
msg.tree_index = leaf_index;

msg.compute_nullifier()
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl L1ToL2Message {

pub fn deserialize(
fields: [Field; L1_TO_L2_MESSAGE_LENGTH],
secret: Field,
tree_index: Field
secret: Field, // TODO(#5420): refactor this so that this param does not have to be passed separately
tree_index: Field // TODO(#5420): refactor this so that this param does not have to be passed separately
) -> L1ToL2Message {
L1ToL2Message {
sender: EthAddress::from_field(fields[0]),
Expand Down

0 comments on commit 57ddf37

Please sign in to comment.