linera-io / linera-protocol

Main repository for the Linera protocol
Apache License 2.0
112 stars 94 forks source link

Optimize `requested_sent_certificate_hashes`: If they are small, include full certificates. #2174

Open andresilva91 opened 2 weeks ago

andresilva91 commented 2 weeks ago

Right now we do two different network calls when we need to request certificates. First we do a chain info query to get the certificate hashes, then we download the hashes using the endpoint. Ideally, to potentially save one network call, we could on the chain info query include the actual full certificate until the message size limit (GRPC_MAX_MESSAGE_SIZE) gets passed, then from then on include just the hashes.

We might not be able to compare directly with GRPC_MAX_MESSAGE_SIZE, need to check the documentation to see if that refers to just the actual payload size, or if it's the entire request. If it's the entire request, we might have to compare with a lower adjusted number than GRPC_MAX_MESSAGE_SIZE.