Staking is done via smart-contract. This means everything is in the code, and there is no possibility for error, since everything is done on the blockchain. The codes does exactly what it was programmed to do. This is why it is so important to have a reputable 3rd party audit the source code.