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

core/tracing: stringer for gas and nonce change reasons #31234

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maoueh
Copy link
Contributor

@maoueh maoueh commented Feb 21, 2025

This follows the same pattern as for tracing.BalanceChangeReason.

This follows the same pattern as for `tracing.BalanceChangeReason`.
@maoueh maoueh requested a review from s1na as a code owner February 21, 2025 16:47
@s1na s1na self-assigned this Feb 21, 2025
@s1na
Copy link
Contributor

s1na commented Feb 21, 2025

While you're at it can you add nonce change reason too? :)

@@ -282,6 +282,8 @@ const (
// once per transaction, while those that start with `GasChangeCall` are emitted on a call basis.
type GasChangeReason byte

//go:generate go run golang.org/x/tools/cmd/stringer -type=GasChangeReason -output gen_gas_change_reason_stringer.go
Copy link
Contributor

@fjl fjl Feb 21, 2025

Choose a reason for hiding this comment

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

Consider using -trimprefix GasChange here. I think it will improve the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I apply to all others too (NonceChange & BalanceChange)?

@maoueh
Copy link
Contributor Author

maoueh commented Feb 21, 2025

While you're at it can you add nonce change reason too? :)

Sure thing @s1na

@maoueh
Copy link
Contributor Author

maoueh commented Feb 21, 2025

I've applied -trimprefix=<Prefix> everywhere, let me know if everything is right.

@Shippe
Copy link

Shippe commented Feb 23, 2025

Hello

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

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

LGTM

@s1na s1na changed the title Added generated stringer for tracing.GasChangeReason enum core/tracing: generated stringer for gas and nonce change reasons Feb 24, 2025
@s1na s1na added this to the 1.15.3 milestone Feb 24, 2025
@s1na s1na changed the title core/tracing: generated stringer for gas and nonce change reasons core/tracing: stringer for gas and nonce change reasons Feb 24, 2025
@s1na
Copy link
Contributor

s1na commented Feb 24, 2025

Note: this PR will change the string output for balance change reasons. But nobody should be using that for their logic code instead of the enum. I really hope nobody is actually doing that. This is giving me second thought about exposing a string version tbh.

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.

4 participants