An early dynamical instability among the Solar System’s giant planets triggered by the gas disk’s dispersal