MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / abi_encode_envelope

Function abi_encode_envelope

ipc/api/src/checkpoint.rs:80–114  ·  view source on GitHub ↗

Encode to human-readable format, expected by `ipc_api::merkle::MerkleGen`. TODO: since this is done only to later be encoded via `abi::encode`, while that can be done on `checkpointing_facet::IpcEnvelope` directly, this workflow doesn't make sense, and should be refactored.

(msg: &checkpointing_facet::IpcEnvelope)

Source from the content-addressed store, hash-verified

78// that can be done on `checkpointing_facet::IpcEnvelope` directly,
79// this workflow doesn't make sense, and should be refactored.
80pub fn abi_encode_envelope(msg: &checkpointing_facet::IpcEnvelope) -> Vec<String> {
81 vec![
82 hex::encode(msg.kind.encode()),
83 hex::encode(msg.local_nonce.encode()),
84 hex::encode(msg.original_nonce.encode()),
85 hex::encode(msg.value.encode()),
86 hex::encode(msg.to.clone().subnet_id.root.encode()),
87 format!(
88 "[{}]",
89 msg.to
90 .subnet_id
91 .route
92 .iter()
93 .map(|addr| format!("{:#x}", addr))
94 .collect::<Vec<_>>()
95 .join(",")
96 ),
97 hex::encode(msg.to.clone().raw_address.addr_type.encode()),
98 format!("{:#x}", msg.to.clone().raw_address.payload),
99 hex::encode(msg.from.clone().subnet_id.root.encode()),
100 format!(
101 "[{}]",
102 msg.from
103 .subnet_id
104 .route
105 .iter()
106 .map(|addr| format!("{:#x}", addr))
107 .collect::<Vec<_>>()
108 .join(",")
109 ),
110 hex::encode(msg.from.clone().raw_address.addr_type.encode()),
111 format!("{:#x}", msg.from.clone().raw_address.payload),
112 format!("{:#x}", msg.message),
113 ]
114}
115
116pub fn abi_encode_envelope_fields() -> Vec<impl ToString> {
117 vec![

Calls

no outgoing calls

Tested by

no test coverage detected