Skip to content

Commit

Permalink
refactor: old inbox purge (#5206)
Browse files Browse the repository at this point in the history
Fixes AztecProtocol/aztec-packages#5263
Fixes AztecProtocol/aztec-packages#4833
Fixes AztecProtocol/aztec-packages#5071
\+ did a few random improvements (e.g. not waiting 5 seconds for
archiver to have message available but polling for it instead)
  • Loading branch information
benesjan authored and AztecBot committed Mar 19, 2024
1 parent e851eb1 commit a9e19a2
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions aztec/src/messaging/l1_to_l2_message.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use dep::protocol_types::{
hash::{pedersen_hash, sha256_to_field}
};

// TODO(#4833) remove `deadline` and `fee` from the message
// currently hardcoded to max_value and 0 respectively.
struct L1ToL2Message {
sender: EthAddress,
chain_id: Field,
Expand All @@ -14,8 +12,6 @@ struct L1ToL2Message {
content: Field,
secret: Field,
secret_hash: Field,
deadline: u32,
fee: u64,
tree_index: Field
}

Expand All @@ -37,8 +33,6 @@ impl L1ToL2Message {
content,
secret,
secret_hash,
deadline: 4294967295,
fee: 0,
tree_index: 0
}
}
Expand All @@ -56,22 +50,18 @@ impl L1ToL2Message {
content: fields[4],
secret,
secret_hash: fields[5],
deadline: fields[6] as u32,
fee: fields[7] as u64,
tree_index
}
}

fn hash(self: Self) -> Field {
let mut hash_bytes: [u8; 256] = [0; 256];
let mut hash_bytes = [0 as u8; 192];
let sender_bytes = self.sender.to_field().to_be_bytes(32);
let chain_id_bytes = self.chain_id.to_be_bytes(32);
let recipient_bytes = self.recipient.to_field().to_be_bytes(32);
let version_bytes = self.version.to_be_bytes(32);
let content_bytes = self.content.to_be_bytes(32);
let secret_hash_bytes = self.secret_hash.to_be_bytes(32);
let deadline_bytes = (self.deadline as Field).to_be_bytes(32);
let fee_bytes = (self.fee as Field).to_be_bytes(32);

for i in 0..32 {
hash_bytes[i] = sender_bytes[i];
Expand All @@ -80,8 +70,6 @@ impl L1ToL2Message {
hash_bytes[i + 96] = version_bytes[i];
hash_bytes[i + 128] = content_bytes[i];
hash_bytes[i + 160] = secret_hash_bytes[i];
hash_bytes[i + 192] = deadline_bytes[i];
hash_bytes[i + 224] = fee_bytes[i];
}

let message_hash = sha256_to_field(hash_bytes);
Expand Down

0 comments on commit a9e19a2

Please sign in to comment.