diff --git a/noir-projects/aztec-nr/aztec/src/messaging.nr b/noir-projects/aztec-nr/aztec/src/messaging.nr index db6e1809ac63..6e3943677096 100644 --- a/noir-projects/aztec-nr/aztec/src/messaging.nr +++ b/noir-projects/aztec-nr/aztec/src/messaging.nr @@ -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, @@ -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() } diff --git a/noir-projects/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr b/noir-projects/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr index 102989a456ab..6fd9a65e60c5 100644 --- a/noir-projects/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr +++ b/noir-projects/aztec-nr/aztec/src/messaging/l1_to_l2_message.nr @@ -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]),