From 843d68a0c5f0b934e24b21a040e843749c2198d6 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 8 Oct 2024 04:32:24 +0000 Subject: [PATCH] add more debug info --- crates/specs/src/external_host_call_table/mod.rs | 1 + crates/specs/src/external_host_call_table/table.rs | 8 +++++--- .../src/runtime/monitor/plugins/table/slice_builder.rs | 2 +- .../src/runtime/monitor/plugins/table/transaction/v2.rs | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/specs/src/external_host_call_table/mod.rs b/crates/specs/src/external_host_call_table/mod.rs index 1761ec53e..70fe574bb 100644 --- a/crates/specs/src/external_host_call_table/mod.rs +++ b/crates/specs/src/external_host_call_table/mod.rs @@ -41,6 +41,7 @@ impl From for Signature { #[derive(Serialize, Deserialize)] pub struct ExternalHostCallEntry { + pub eid: usize, pub op: usize, pub value: u64, pub is_ret: bool, diff --git a/crates/specs/src/external_host_call_table/table.rs b/crates/specs/src/external_host_call_table/table.rs index ac34388e7..41f1d32a0 100644 --- a/crates/specs/src/external_host_call_table/table.rs +++ b/crates/specs/src/external_host_call_table/table.rs @@ -1,12 +1,14 @@ use super::ExternalHostCallEntry; +use crate::etable::EventTableEntry; use crate::step::StepInfo; -impl TryFrom<&StepInfo> for ExternalHostCallEntry { +impl TryFrom<&EventTableEntry> for ExternalHostCallEntry { type Error = (); - fn try_from(value: &StepInfo) -> Result { - match value { + fn try_from(entry: &EventTableEntry) -> Result { + match &entry.step_info { StepInfo::ExternalHostCall { op, value, sig, .. } => Ok(ExternalHostCallEntry { + eid: entry.eid as usize, op: *op, value: value.unwrap(), is_ret: sig.is_ret(), diff --git a/crates/zkwasm/src/runtime/monitor/plugins/table/slice_builder.rs b/crates/zkwasm/src/runtime/monitor/plugins/table/slice_builder.rs index 8df2780c8..cfdf2ba7b 100644 --- a/crates/zkwasm/src/runtime/monitor/plugins/table/slice_builder.rs +++ b/crates/zkwasm/src/runtime/monitor/plugins/table/slice_builder.rs @@ -20,7 +20,7 @@ impl SliceBuilder { pub(super) fn build(&mut self, logs: Vec) -> Slice { let external_host_call_table = ExternalHostCallTable::new( logs.iter() - .filter_map(|entry| ExternalHostCallEntry::try_from(&entry.step_info).ok()) + .filter_map(|entry| ExternalHostCallEntry::try_from(entry).ok()) .collect(), ); diff --git a/crates/zkwasm/src/runtime/monitor/plugins/table/transaction/v2.rs b/crates/zkwasm/src/runtime/monitor/plugins/table/transaction/v2.rs index 8c7851303..5eb5e67d9 100644 --- a/crates/zkwasm/src/runtime/monitor/plugins/table/transaction/v2.rs +++ b/crates/zkwasm/src/runtime/monitor/plugins/table/transaction/v2.rs @@ -4,6 +4,7 @@ use std::collections::HashMap; use std::collections::LinkedList; use std::rc::Rc; +use log::info; use log::warn; use specs::etable::EventTableEntry; use specs::slice_backend::SliceBackendBuilder; @@ -447,6 +448,8 @@ impl HostTransaction { &*self.controller, ); + info!("Slice at {}", checkpoint); + assert!( checkpoint != self.last_committed_event_cursor, "failed to select checkpoint"