Formula 1 has confirmed that the grands prix in Bahrain and Saudi Arabia will be cancelled due to the war in Iran.