-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
eth/gasprice: avoid modifying TestChainConfig #23204
Conversation
eth/gasprice/gasprice_test.go
Outdated
} else { | ||
gspec.Config.LondonBlock = nil | ||
} | ||
gspec.Config.LondonBlock = londonBlock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also found it non-obvious in the original PR where this conditional got introduced.
With your change, the assignment of signer
gets lost. This changes the outcome
because LatestSigner
may choose another signer type if London is enabled.
Both your version and the original version have another issue: params.TestChainConfig
is modified without copying it first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I didn't realize this. Would it make sense to copy the config, modify the LondonBlock, and then create the signer to remove the no-op here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be better.
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
This PR cleans up a no-op in the gasprice unit tests where a variable is overwritten in a conditional checking if it is nil or not, but the conditional is not necessary. In one branch, there is additionally a signer object that is overwritten, which will be identical to the one created and overwritten directly above it.