function serializeScript(s) {
  /* global BigInt */
  const varintLen = varuint.encodingLength(s.length);
  const buffer = new Uint8Array(varintLen);
  varuint.encode(s.length, buffer);
  return tools.concat([buffer, s]);
}
Serializes a script by encoding its length as a varint and concatenating it with the script.

@param s - The script to be serialized.
@returns The serialized script as a Buffer.