fn storage_tx_to_l2_tx(i_tx_format: i32, o_tx_format: i32) {
    let stx = l2_storage_tx(i_tx_format);
    let tx = Transaction::from(stx.clone());

    let execute: Execute = serde_json::from_value(stx.data.clone()).unwrap();
    assert_eq!(execute, tx.execute);
    assert_ne!(0, tx.received_timestamp_ms);
    assert_eq!(stx.input.clone().map(Bytes::from), tx.raw_bytes);

    if let ExecuteTransactionCommon::L2(l1_data) = tx.common_data {
        assert_eq!(stx.nonce.unwrap() as u32, l1_data.nonce.0);
        assert_eq!(
            Fee {
                gas_limit: stx.gas_limit.map(bigdecimal_to_u256).unwrap(),
                max_fee_per_gas: stx.max_fee_per_gas.map(bigdecimal_to_u256).unwrap(),
                max_priority_fee_per_gas: stx
                    .max_priority_fee_per_gas
                    .map(bigdecimal_to_u256)
                    .unwrap(),
                gas_per_pubdata_limit: stx.gas_per_pubdata_limit.map(bigdecimal_to_u256).unwrap()
            },
            l1_data.fee
        );
        assert_eq!(
            stx.initiator_address.as_slice(),
            l1_data.initiator_address.as_bytes()
        );
        assert_eq!(stx.signature.unwrap(), l1_data.signature);
        assert_eq!(o_tx_format, l1_data.transaction_type as i32);
        assert_eq!(stx.input.unwrap(), l1_data.input.clone().unwrap().data);
        assert_eq!(stx.hash.as_slice(), l1_data.hash().as_bytes());
    } else {
        panic!("Invalid transaction");
    }
}
Tests storage transaction to layer 2 transaction logic with different transaction types
core/lib/dal/src/models/tests.rs