How does Tobi know so much about Madara? He was the only one who knew that madara was dead(except Kabuto), he knew everything about izuna, Madaras fights against hashirama and Madaras background
So that means Tobi must have been really close to madara to know this kind of stuff