MCPcopy Create free account
hub / github.com/SeismicSystems/summit / try_from

Method try_from

types/src/checkpoint.rs:128–139  ·  view source on GitHub ↗
(checkpoint: &Checkpoint)

Source from the content-addressed store, hash-verified

126 }
127
128 let mut payload = vec![0u8; len as usize];
129 buf.try_copy_to_slice(&mut payload)
130 .map_err(|_| Error::EndOfBuffer)?;
131 Self::from_ssz_bytes(&payload)
132 .map_err(|_| Error::Invalid("Checkpoint", "Unable to decode SSZ bytes for checkpoint"))
133 }
134}
135
136impl TryFrom<&Checkpoint> for ConsensusState {
137 type Error = Error;
138
139 fn try_from(checkpoint: &Checkpoint) -> Result<Self, Self::Error> {
140 // Verify the digest matches the data
141 let computed_digest = Sha256::hash(&[&checkpoint.data]);
142

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected