Amid sustained buying in heavyweights, Nifty on Wednesday scaled a fresh all-time high of 23,785, while Sensex also scaled a peak of 78,339 by rallying about 300 points.