Skip to content

Commit 20e3762

Browse files
committed
fix: avoid double serialization in VersionedAttestation SCALE size_hint
The size_hint impl was calling to_bytes() to compute the exact size, then encode_to() would serialize again. Return 0 instead since SCALE's size_hint is best-effort and used only for pre-allocation.
1 parent dd8d9cd commit 20e3762

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dstack-attest/src/attestation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ pub enum VersionedAttestation {
355355

356356
impl Encode for VersionedAttestation {
357357
fn size_hint(&self) -> usize {
358-
self.to_bytes().map(|b| b.len()).unwrap_or(0)
358+
0
359359
}
360360

361361
fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {

0 commit comments

Comments
 (0)