Skip to content

Commit

Permalink
(experimental) dispatcher: diagnostic logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Mar 26, 2022
1 parent 6ea427f commit 19dc50a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runtime-sdk/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ impl<R: Runtime> Dispatcher<R> {
data: &IncomingMessageData,
tx: &Option<Transaction>,
) -> Result<(), RuntimeError> {
warn!(ctx.get_logger("dispatcher"), "incoming message executing"; "id" => in_msg.id); // %%%
R::Modules::execute_in_msg(ctx, in_msg, data, tx)?;
warn!(ctx.get_logger("dispatcher"), "incoming message modules done"; "id" => in_msg.id); // %%%
if let Some(tx) = tx {
let tx_size = match data
.ut
Expand All @@ -360,7 +362,11 @@ impl<R: Runtime> Dispatcher<R> {
// Use the ID as index.
let index = in_msg.id.try_into().unwrap();
// todo: put result tags in block
Self::execute_tx(ctx, tx_size, tx.clone(), index)?;
let result = Self::execute_tx(ctx, tx_size, tx.clone(), index)?;
let result_parsed = cbor::from_slice::<crate::types::transaction::CallResult>(&result.output).unwrap();
warn!(ctx.get_logger("dispatcher"), "incoming message transaction done"; "id" => in_msg.id, "result_parsed" => ?result_parsed); // %%%
} else {
warn!(ctx.get_logger("dispatcher"), "incoming message no transaction"; "id" => in_msg.id); // %%%
}
Ok(())
}
Expand Down

0 comments on commit 19dc50a

Please sign in to comment.