Audacity has a virtually unlimited number of “undo’s”. However, once you close a project (or Audacity), this undo history is discarded in its entirety. In the future, you may wish to use “File > Save Project > Save Lossless Copy Of Project” frequently to make checkpoints of a long and sustained edit. For additional insight, see this forum discussion: History of effects after saving project