linera-io/linera-protocol · info

serialize event_ids

Error message

serialize event_ids

What it means

The From<Vec<EventId>> for api::EventBlockHeightsRequest conversion (linera-rpc/src/grpc/conversions.rs:1114) bincode-serializes the event IDs into the protobuf request and expects success. bincode serialization of Vec<EventId>, whose elements are plain integer-based types, cannot fail; the expect documents that this conversion is infallible rather than guarding a realistic failure.

Source

Thrown at linera-rpc/src/grpc/conversions.rs:1117

        }
    }
}

impl TryFrom<api::DownloadCertificatesByHeightsRequest> for CertificatesByHeightRequest {
    type Error = GrpcProtoConversionError;

    fn try_from(request: api::DownloadCertificatesByHeightsRequest) -> Result<Self, Self::Error> {
        Ok(Self {
            chain_id: try_proto_convert(request.chain_id)?,
            heights: request.heights.into_iter().map(Into::into).collect(),
        })
    }
}

impl From<Vec<EventId>> for api::EventBlockHeightsRequest {
    fn from(event_ids: Vec<EventId>) -> Self {
        Self {
            event_ids: bincode::serialize(&event_ids).expect("serialize event_ids"),
        }
    }
}

impl TryFrom<api::EventBlockHeightsRequest> for Vec<EventId> {
    type Error = GrpcProtoConversionError;

    fn try_from(request: api::EventBlockHeightsRequest) -> Result<Self, Self::Error> {
        Ok(bincode::deserialize(&request.event_ids)?)
    }
}

impl From<Vec<Option<BlockHeight>>> for api::EventBlockHeightsResponse {
    fn from(heights: Vec<Option<BlockHeight>>) -> Self {
        Self {
            heights: bincode::serialize(&heights).expect("serialize heights"),
        }
    }

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. If hit in a fork, make the conversion fallible (TryFrom) or fix the custom Serialize impl.
  2. In upstream builds, treat the panic as an internal bug and report it with a backtrace.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Not realistically reachable: it would require EventId's Serialize impl itself to error, which the type's definition does not allow. Hits here indicate a corrupted build or a custom EventId type introduced upstream.

Common situations: None under normal operation; only appears if linera-rpc is forked with custom Serialize impls that can fail.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/db6fd488e5dbdee6. Report an issue: GitHub.