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

Render Stellar Events as JSON Instead of Rust Debug Format and Update WASM Path #1642

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion cmd/crates/soroban-spec-typescript/src/boilerplate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ mod test {
use super::*;

const EXAMPLE_WASM: &[u8] = include_bytes!(
"../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm"
"../../../../target/wasm32-unknown-unknown/test-wasms/deps/test_custom_types.wasm"
);

fn init(root: impl AsRef<Path>) -> std::io::Result<Project> {
Expand Down
11 changes: 5 additions & 6 deletions cmd/soroban-cli/src/log/event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use tracing::{debug, info, span, Level};

use crate::xdr;
use xdr::WriteXdr;
use tracing::{debug, info, span, Level};

pub fn events(events: &[xdr::DiagnosticEvent]) {
for (i, event) in events.iter().enumerate() {
Expand All @@ -15,12 +13,13 @@ pub fn events(events: &[xdr::DiagnosticEvent]) {

let _enter = span.enter();

let xdr = event.to_xdr_base64(xdr::Limits::none()).unwrap();
// Convert the event to JSON
let json = serde_json::to_string(event).unwrap();

if span.metadata().unwrap().level() == &Level::INFO {
info!("{i}: {xdr} {json}");
info!("{i}: {json}");
} else {
debug!("{i}: {xdr} {json}");
debug!("{i}: {json}");
Comment on lines -18 to +22
Copy link
Member

@leighmcculloch leighmcculloch Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output is part of the logging and it was just recently written to output both the XDR and the JSON in the following issue. We want to keep it as is:

The issue being addressed by this PR is to change the stdout output of the stellar contract events subcommand, not the log output. If you see the original issue the original issue has an example of what the command is to run, and what the output looks like today. It's that output that the issue describes being changed from Rust debug format to JSON.

}
}
}
Expand Down