Tendermint Finality & Validator Uptime

Could someone kindly point me to more resources where I can find answers to the Tendermint Core’s finality (the code itself would be useful). As well how validator’s uptime is calculated?