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

Function get_proof

fendermint/app/src/cmd/proof_cache.rs:129–198  ·  view source on GitHub ↗
(db_path: &PathBuf, instance_id: u64)

Source from the content-addressed store, hash-verified

127}
128
129fn get_proof(db_path: &PathBuf, instance_id: u64) -> anyhow::Result<()> {
130 println!("=== Get Proof for Instance {} ===", instance_id);
131 println!("Database: {}", db_path.display());
132 println!();
133
134 let persistence = ProofCachePersistence::open(db_path)?;
135 let entries = persistence.load_all_entries()?;
136
137 if entries.is_empty() {
138 println!("Cache is empty.");
139 return Ok(());
140 }
141
142 let entry = entries
143 .iter()
144 .find(|e| e.certificate.gpbft_instance == instance_id);
145
146 if let Some(entry) = entry {
147 println!("Found proof for instance {}", instance_id);
148 println!();
149
150 // Certificate Details
151 println!("F3 Certificate:");
152 println!(" Instance ID: {}", entry.certificate.gpbft_instance);
153 println!(
154 " Finalized Epochs: {:?}",
155 entry.certificate.ec_chain.suffix()
156 );
157 println!(
158 " BLS Signature: {} bytes",
159 entry.certificate.signature.len()
160 );
161 println!(" Signers: {} validators", entry.certificate.signers.len());
162 println!();
163
164 // Proof Bundle Summary
165 let proof_bundle_size = entry
166 .proof_bundle
167 .as_ref()
168 .and_then(|bundle| fvm_ipld_encoding::to_vec(bundle).ok())
169 .map(|v| v.len())
170 .unwrap_or(0);
171 println!("Proof Bundle:");
172 println!(
173 " Total Size: {} bytes ({:.2} KB)",
174 proof_bundle_size,
175 proof_bundle_size as f64 / 1024.0
176 );
177
178 if let Some(proof_bundle) = &entry.proof_bundle {
179 println!(" Storage Proofs: {}", proof_bundle.storage_proofs.len());
180 println!(" Event Proofs: {}", proof_bundle.event_proofs.len());
181 println!(" Witness Blocks: {}", proof_bundle.blocks.len());
182 println!();
183 } else {
184 println!(" No proof bundle found");
185 }
186

Callers 1

Calls 7

openFunction · 0.85
load_all_entriesMethod · 0.80
okMethod · 0.80
is_emptyMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected