MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / parse_genesis

Function parse_genesis

fendermint/vm/interpreter/src/bytes.rs:331–336  ·  view source on GitHub ↗

Parse the initial genesis either as JSON or CBOR.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

329
330/// Parse the initial genesis either as JSON or CBOR.
331fn parse_genesis(bytes: &[u8]) -> anyhow::Result<Genesis> {
332 try_parse_genesis_json(bytes).or_else(|e1| {
333 try_parse_genesis_cbor(bytes)
334 .map_err(|e2| anyhow!("failed to deserialize genesis as JSON or CBOR: {e1}; {e2}"))
335 })
336}
337
338fn try_parse_genesis_json(bytes: &[u8]) -> anyhow::Result<Genesis> {
339 let json = String::from_utf8(bytes.to_vec())?;

Callers 1

initMethod · 0.85

Calls 2

try_parse_genesis_jsonFunction · 0.85
try_parse_genesis_cborFunction · 0.85

Tested by

no test coverage detected