{"record":{"id":"1cf48be06ce4d94e","repo":"linera-io/linera-protocol","slug":"serialize-heights","errorCode":null,"errorMessage":"serialize heights","messagePattern":"serialize heights","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"linera-rpc/src/grpc/conversions.rs","lineNumber":1133,"sourceCode":"    fn from(event_ids: Vec<EventId>) -> Self {\n        Self {\n            event_ids: bincode::serialize(&event_ids).expect(\"serialize event_ids\"),\n        }\n    }\n}\n\nimpl TryFrom<api::EventBlockHeightsRequest> for Vec<EventId> {\n    type Error = GrpcProtoConversionError;\n\n    fn try_from(request: api::EventBlockHeightsRequest) -> Result<Self, Self::Error> {\n        Ok(bincode::deserialize(&request.event_ids)?)\n    }\n}\n\nimpl From<Vec<Option<BlockHeight>>> for api::EventBlockHeightsResponse {\n    fn from(heights: Vec<Option<BlockHeight>>) -> Self {\n        Self {\n            heights: bincode::serialize(&heights).expect(\"serialize heights\"),\n        }\n    }\n}\n\nimpl TryFrom<api::EventBlockHeightsResponse> for Vec<Option<BlockHeight>> {\n    type Error = GrpcProtoConversionError;\n\n    fn try_from(response: api::EventBlockHeightsResponse) -> Result<Self, Self::Error> {\n        Ok(bincode::deserialize(&response.heights)?)\n    }\n}\n\n#[cfg(test)]\n/// Tests for the gRPC protobuf conversions.\npub mod tests {\n    // Test helpers in this module don't need individual documentation.\n    #![allow(missing_docs)]\n","sourceCodeStart":1115,"sourceCodeEnd":1151,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-rpc/src/grpc/conversions.rs#L1115-L1151","documentation":"The From<Vec<Option<BlockHeight>>> for api::EventBlockHeightsResponse conversion (linera-rpc/src/grpc/conversions.rs:1130) bincode-serializes the heights into the protobuf response and expects success. BlockHeight wraps a u64, so serialization cannot fail; the expect asserts infallibility. Note the reverse direction (TryFrom on the response) is fallible and uses proper error handling for malicious bytes.","triggerScenarios":"Not realistically reachable: serializing Vec<Option<BlockHeight>> with bincode cannot error. A hit implies a modified fork with fallible Serialize impls or memory corruption.","commonSituations":"None under normal operation.","solutions":["If hit in a fork, switch to TryFrom or fix the custom Serialize impl.","In upstream builds, report as an internal bug with a backtrace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["No prevention needed: bincode serialization of Vec<Option<BlockHeight>> is infallible in practice.","When deserializing (the reverse direction), always handle GrpcProtoConversionError for untrusted bytes."],"tags":["linera-rpc","grpc","bincode","serialization","unreachable"],"backgroundTag":"serialization-failure","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}