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

trace: Print gas and gasUsed in hex #592

Merged
merged 1 commit into from
Mar 24, 2023
Merged

trace: Print gas and gasUsed in hex #592

merged 1 commit into from
Mar 24, 2023

Conversation

rodiazet
Copy link
Contributor

No description provided.

@rodiazet rodiazet requested a review from chfast March 22, 2023 14:25
@axic axic changed the title Print gas and gasUsed in hex trace: Print gas and gasUsed in hex Mar 22, 2023
@rodiazet rodiazet force-pushed the tracing-in-hex branch 2 times, most recently from 021f51c to c6996ad Compare March 22, 2023 16:34
@axic
Copy link
Member

axic commented Mar 22, 2023

Is this a requirement of the tracing format?

@rodiazet rodiazet force-pushed the tracing-in-hex branch 2 times, most recently from 425f64c to d421915 Compare March 22, 2023 16:47
@rodiazet
Copy link
Contributor Author

Is this a requirement of the tracing format?

No. I just want to have it similar to geth to avoid unnecessary problems when comparing tests results.

@axic
Copy link
Member

axic commented Mar 22, 2023

Any chance to change geth instead? Decimal makes a lot more sense for gas usage.

Never mind, apparently it is in the tracing EIP:

Name Type Explanation
gas Hex-Number Gas left before executing this operation
gasCost Hex-Number Gas cost of this operation

m_out << R"(,"gasUsed":)" << (ctx.start_gas - result.gas_left);
m_out << R"(,"gas":)" << std::hex << "0x" << result.gas_left;
m_out << R"(,"gasUsed":)" << std::hex << "0x" << (ctx.start_gas - result.gas_left)
<< std::dec;
m_out << R"(,"output":")" << evmc::hex({result.output_data, result.output_size}) << '"';
Copy link
Member

Choose a reason for hiding this comment

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

Apparently this field is not an even listed as optional in the EIP, @chfast.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove it and check once again if we have it implemented according to spec, but let's first confirm with @chfast

Copy link
Member

Choose a reason for hiding this comment

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

It is useful for debugging. Let's keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chfast Approve please if no other comments.

Copy link
Member

@axic axic Mar 23, 2023

Choose a reason for hiding this comment

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

Can one of you open a PR to the EIP adding output as an optional field? Not blocking this PR, just as an addition.

lib/evmone/tracing.cpp Outdated Show resolved Hide resolved
@rodiazet rodiazet requested a review from chfast March 24, 2023 09:50
@rodiazet rodiazet merged commit b4ad41c into master Mar 24, 2023
@rodiazet rodiazet deleted the tracing-in-hex branch March 24, 2023 10:15
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.

3 participants