Skip to content

Conversation

@JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Dec 15, 2025

Why this should be merged

This PR consolidates pointer creation helpers across the codebase by replacing the type-specific pointer calls such as utils.NewUint64 or newTrue() with a single generic utils.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

  • Adds generic utils.PointerTo[T any](x T) *T to the shared graft/evm/utils module
  • Replaces all old typed pointer calls with new PointerTo calls
  • Removes utilstest.PointerTo in favor of the utils version
  • Removes one-off pointer helpers (newTrue()) and replaces with utils.PointerTo

How this was tested

CI

Need to be documented in RELEASES.md?

No

@JonathanOppenheimer JonathanOppenheimer self-assigned this Dec 15, 2025
@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner December 15, 2025 22:59
@JonathanOppenheimer JonathanOppenheimer added DO NOT MERGE This PR must not be merged in its current state cleanup Code quality improvement evm Related to EVM functionality labels Dec 15, 2025
@JonathanOppenheimer JonathanOppenheimer marked this pull request as draft December 15, 2025 23:01
@JonathanOppenheimer JonathanOppenheimer changed the title refactor: align PointerTo functions refactor: align PointerTo functions Dec 15, 2025
Copy link
Contributor

@alarso16 alarso16 left a 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?

@JonathanOppenheimer
Copy link
Member Author

@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.

Copy link
Contributor

@alarso16 alarso16 left a 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

@JonathanOppenheimer
Copy link
Member Author

Btw you should just be able to rebase to fix the conflicts

I'll just merge in it's easier

Base automatically changed from alarso16/shared-utils to master January 6, 2026 15:58
@JonathanOppenheimer JonathanOppenheimer removed the DO NOT MERGE This PR must not be merged in its current state label Jan 6, 2026
@JonathanOppenheimer JonathanOppenheimer marked this pull request as ready for review January 6, 2026 17:01
@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner January 6, 2026 17:01
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
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this updated?

Copy link
Member Author

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.

Copy link
Contributor

@alarso16 alarso16 left a 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

@JonathanOppenheimer
Copy link
Member Author

Not totally sure why rpc is updated everywhere (definitely out of scope), but doesn't seem like the end of the world

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality improvement evm Related to EVM functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify pointer helpers

3 participants