-
Notifications
You must be signed in to change notification settings - Fork 844
refactor: align PointerTo functions
#4741
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
base: master
Are you sure you want to change the base?
Conversation
PointerTo functions
alarso16
left a comment
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.
Seems overall helpful. There's nothing "evm" about this function, so does it make sense to drop somewhere in avalanchego/utils?
…-ptr-to Signed-off-by: Jonathan Oppenheimer <[email protected]>
|
@alarso16 I had to retype some more things than just the function to get your suggestion working. I think it's a net improvement over all though now, and it's easy reviewable by commit. |
alarso16
left a comment
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.
Btw you should just be able to rebase to fix the conflicts
…thanOppenheimer/cleanup-ptr-to
I'll just merge in it's easier |
graft/evm/go.mod
Outdated
| github.com/ava-labs/firewood-go-ethhash/ffi v0.0.18 | ||
| github.com/ava-labs/libevm v1.13.15-0.20251210210615-b8e76562a300 | ||
| github.com/gorilla/rpc v1.2.0 | ||
| github.com/gorilla/rpc v1.2.1 |
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.
Why is this updated?
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.
Running go mod tidy automatically updates it.
alarso16
left a comment
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.
Not totally sure why rpc is updated everywhere (definitely out of scope), but doesn't seem like the end of the world
Fixed. |
Why this should be merged
This PR consolidates pointer creation helpers across the codebase by replacing the type-specific pointer calls such as
utils.NewUint64ornewTrue()with a single genericutils.PointerTo[T any]function. It also makes types more clear when required, or ensures lint will fail on unnecessary type casting.See ava-labs/coreth#1263 (comment) for the original context.
Closes #4567
How this works
utils.PointerTo[T any](x T) *Tto the sharedgraft/evm/utilsmodulePointerTocallsutilstest.PointerToin favor of the utils versionnewTrue()) and replaces withutils.PointerToHow this was tested
CI
Need to be documented in RELEASES.md?
No