Is it correct that the length of a Plutus time slot is one second? I recall that at one point it was twenty seconds, but I understand that that is no longer the case. Where in the Plutus codebase can I find the answer?
According to the official documentation a time slot is one second.
The Cardano blockchain uses the Ouroboros Praos protocol to facilitate consensus on the chain. Ouroboros Praos divides time into epochs. Each Cardano epoch consists of a number of slots, where each slot lasts for one second. A Cardano epoch currently includes 432,000 slots (5 days). In any slot, zero or more block-producing nodes might be nominated to be the slot leader. On average, one node is expected to be nominated every 20 seconds, for a total of 21,600 nominations per epoch. If randomly elected slot leaders produce blocks, one of them will be added to the chain. Other candidate blocks will be discarded.
I think where you got the 20 seconds from was the block producer node nomination process, which is about 20 seconds on average.
TLDR; One slot = one second.
There is one slight complication with this, and that is that Ouroboros, the consensus protocol powering Cardano doesn’t use POSIX time, it uses slots. But Plutus uses real time, so we need to be able to convert back and forth between real time and slots. This is no problem so long as the slot time is fixed. Right now it is one second, so right now it is easy.
However, this could change in the future. There could be a hard fork with some parameter change that would change the slot time. We can’t know that in advance. We don’t know what the slot length will be in ten years, for example.
EDIT TLDR; One slot = one second. For now.