You will probably want to flash the factory images. Hopefully it won't be too confusing if you've never done it before.
All the instructions and tools you need can be found here:
https://developers.google.com/android/images
And the images themselves are here:
https://developers.google.com/android/images#taimen
You will want to download:
8.0.0 (OPD1.170816.025, Nov 2017)
It's also possible that your device isn't rooted but that the bootloader is unlocked. Regardless, especially since you purchased the device through eBay, and it came rooted, I would flash the factory images as a safety precaution anyway. Just in case anything malicious was installed. With root access, there's a lot someone could do with the device remotely with preinstalled software.
After you successfully install the factory images, you will want to relock the bootloader.
Basically you will issue the fastboot command:
fastboot flashing lock
Note that you will be starting over with a fresh device after flashing the factory images, so back up any important information that you want before doing so. Also, relocking the bootloader will initiate a factory reset as well, so take care of that right after the factory images, so you don't set up your device just to wipe it again.
Hopefully the instructions will make sense as you read them, but let us know if you have any questions or issues.
Also, I'm going to move your thread into the Pixel 2 XL forums.