Getting Compressed Ciphertext List Builder error

Hi,
I have this simple code:

    set_server_key(server_keys);
    let ct = FheUint32::try_encrypt(7u32, &pub_key)?;
   // this works
    let compressed = ct.compress();
  // this fails with error: Compression key not set in server key
    let c_list = CompressedCiphertextListBuilder::new()
        .push(ct)
        .build()
        .unwrap();

I thought ser_server_keys sets compression key because ct.compress() works.
Please advise what is wrong with the code.

Thanks.

Hello @pingpong

You need to generate a server Key with compresion enabled.

We do have several ways to compress ciphertexts as you found out.

You can follow the tutorial here: Compressing ciphertexts/keys | TFHE-rs

Cheers