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

[Torii] Debug output of all indexed Events #1464

Merged
merged 5 commits into from
Feb 7, 2024
Merged
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
18 changes: 17 additions & 1 deletion crates/torii/core/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use tokio::sync::broadcast::Sender;
use tokio::sync::mpsc::Sender as BoundedSender;
use tokio::time::sleep;
use tracing::{error, info, warn};
use tracing::{error, info, trace, warn};

use crate::processors::{BlockProcessor, EventProcessor, TransactionProcessor};
use crate::sql::Sql;
Expand Down Expand Up @@ -50,6 +50,11 @@
block_tx: Option<BoundedSender<u64>>,
}

struct UnprocessedEvent {
keys: Vec<String>,
data: Vec<String>,
}

impl<'db, P: Provider + Sync> Engine<'db, P> {
pub fn new(
world: WorldContractReader<P>,
Expand Down Expand Up @@ -253,6 +258,17 @@
processor
.process(&self.world, self.db, block, invoke_receipt, event_id, event)
.await?;
} else {
let unprocessed_event = UnprocessedEvent {
keys: event.keys.iter().map(|k| format!("{:#x}", k)).collect(),
data: event.data.iter().map(|d| format!("{:#x}", d)).collect(),
};

trace!(
keys = ?unprocessed_event.keys,
data = ?unprocessed_event.data,
"unprocessed event",
);

Check warning on line 271 in crates/torii/core/src/engine.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/core/src/engine.rs#L267-L271

Added lines #L267 - L271 were not covered by tests
}
}
Ok(())
Expand Down
Loading