Deductions & credits

How will the IRS find out for the previous year (aka tax year when filing)? What happen when I contribute to HSA without knowing if my plan is HDHP or not. Will I be penalized?