Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #43 #49

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions lib/src/runtime_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,48 @@ impl RuntimeInfo {
impl Display for RuntimeInfo {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let size_mb: f64 = self.size as f64 / 1024.0 / 1024.0;
let width_emoji = 1;
let width_title = 25;

writeln!(fmt, "🏋️ Runtime size:\t\t{:.3?} MB ({} bytes)", size_mb, self.size.to_formatted_string(&Locale::en))?;
writeln!(
fmt,
"{:<width_emoji$} {:<width_title$} {:.3?} MB ({} bytes)",
"🏋️ ",
"Runtime size:",
size_mb,
self.size.to_formatted_string(&Locale::en)
)?;
if self.compression.compressed() {
writeln!(fmt, "🗜 Compressed:\t\t\tYes, {:.2}%", 100f32 - self.compression.compression_ratio() * 100f32)?;
writeln!(
fmt,
"{:<width_emoji$} {:<width_title$} Yes, {:.2}%",
"🗜 ",
"Compressed:",
100f32 - self.compression.compression_ratio() * 100f32
)?;
} else {
writeln!(fmt, "🗜 Compressed:\t\t\tNo")?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} No", "🗜", "Compressed:")?;
}

writeln!(
fmt,
"✨ Reserved meta:\t\t{} - {:02X?}",
"{:<width_emoji$} {:<width_title$} {} - {:02X?}",
"✨",
"Reserved meta:",
if self.reserved_meta_valid { "OK" } else { "Unknown!" },
self.reserved_meta,
)?;
writeln!(fmt, "🎁 Metadata version:\t\tV{:?}", self.metadata_version)?;
writeln!(fmt, "🔥 Core version:\t\t{}", self.core_version)?;
writeln!(fmt, "🗳️ system.setCode hash:\t\t{}", self.proposal_hash)?;
writeln!(fmt, "🗳️ authorizeUpgrade hash:\t{}", self.parachain_authorize_upgrade_hash)?;
writeln!(fmt, "#️⃣ Blake2-256 hash:\t\t{}", self.blake2_256)?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} V{:?}", "🎁", "Metadata version:", self.metadata_version)?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} {}", "🔥", "Core version:", self.core_version)?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} {}", "🗳️ ", "system.setCode hash:", self.proposal_hash)?;
writeln!(
fmt,
"{:<width_emoji$} {:<width_title$} {}",
"🗳️ ", "authorizeUpgrade hash:", self.parachain_authorize_upgrade_hash
)?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} {}", "🗳️ ", "Blake2-256 hash:", self.blake2_256)?;
let ipfs_url = format!("https://www.ipfs.io/ipfs/{cid}", cid = self.ipfs_hash);
writeln!(fmt, "📦 IPFS:\t\t\t{url}", url = ipfs_url)?;
writeln!(fmt, "{:<width_emoji$} {:<width_title$} {url}", "📦", "IPFS:", url = ipfs_url)?;
Ok(())
}
}
7 changes: 0 additions & 7 deletions libs/wasm-testbed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ impl WasmTestBed {
return Err(WasmTestbedError::Unsupported);
}

// Self::print_magic_and_version(&metadata);

let runtime_metadata_prefixed: RuntimeMetadataPrefixed =
scale::Decode::decode(&mut &metadata[..]).map_err(|e| {
log::error!("e = {:#?}", e);
Expand Down Expand Up @@ -133,11 +131,6 @@ impl WasmTestBed {
let mut host_functions = sp_io::SubstrateHostFunctions::host_functions();
host_functions.push(&logger_mock::LoggerMock);

// host_functions
// .clone()
// .into_iter()
// .for_each(|host_fn| debug!("{:?}", host_fn.name()));

let executor = WasmExecutor::new(
WasmExecutionMethod::Interpreted,
// At least 12 for Polkadot V12/V13.
Expand Down