Skip to content

Conversation

@linh2931
Copy link
Contributor

This PR implements pretty print sync call consoles from contract in call hierarchy.

Resolves #1579

cleos support of pretty printing and call traces is tracked by #1628.

Example of both caller and callee have consoles:

[(caller,basictest)->caller]: CONSOLE OUTPUT BEGIN =====================
Before calling sync call basictest
[caller->(callee,basictest)]: CALL BEGIN ======
I am basictest from sync_callee
[caller->(callee,basictest)]: CALL END   ======
After returned from basictest
[(caller,basictest)->caller]: CONSOLE OUTPUT END   =====================

Example of only callee has console:

[(caller,callernocnsl)->caller]: CONSOLE OUTPUT BEGIN =====================
[caller->(callee,basictest)]: CALL BEGIN ======
I am basictest from sync_callee
[caller->(callee,basictest)]: CALL END   ======
[(caller,callernocnsl)->caller]: CONSOLE OUTPUT END   =====================

Example of only caller has console:

[(caller,calleenocnsl)->caller]: CONSOLE OUTPUT BEGIN =====================
Before making sync call. After returned from sync call.
[(caller,calleenocnsl)->caller]: CONSOLE OUTPUT END   =====================

@linh2931 linh2931 requested review from heifner and spoonincode June 23, 2025 19:56

std::string output;
output += header;
output += expanded;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could avoid this copy by using output from the start and append as you go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use output from the start and append as we go, we will append header at the beginning. Then we need to use "if output is equal to header" at the end to determine if the console has anything, because we don't want to output anything if console (including sync calls') is empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could track that via a bool, but doesn't really matter.

@linh2931 linh2931 linked an issue Jun 25, 2025 that may be closed by this pull request
@linh2931 linh2931 merged commit 1c0378d into sync_call Jul 5, 2025
28 checks passed
@linh2931 linh2931 deleted the pretty_print branch July 5, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SC: Reconstruct call hierarchy in console output using console_marker

3 participants