starknet-io / types-rs

🐺 Starknet Rust types 🦀
MIT License
66 stars 41 forks source link

bug: message_hash type #103

Open jbcaron opened 6 days ago

jbcaron commented 6 days ago

Bug Report

types-rs version:

Current behavior:

The message_hash field in the L1HandlerTxnReceipt structure is currently defined as a u64. This type is insufficient because L1 message hashes, a defined in ethereum-based, are represented as 256-bit values (H256).

Expected behavior:

the message_hash field should be defined as H256 to correctly represent the 256-bit nature of the hash

Steps to reproduce:

Related code:

/// receipt for l1 handler transaction
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct L1HandlerTxnReceipt<F> {
    /// The message hash as it appears on the L1 core contract
    #[serde(with = "NumAsHex")]
    pub message_hash: u64,
    #[serde(flatten)]
    pub common_receipt_properties: CommonReceiptProperties<F>,
}

Other information: