State MPs have sat into the wee hours to pass laws to restore political donation rules that could attract another High Court challenge.