-
Notifications
You must be signed in to change notification settings - Fork 1k
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
payload electra cloning #14239
payload electra cloning #14239
Conversation
proto/engine/v1/execution_engine.go
Outdated
} | ||
|
||
// CopySlice copies the contents of a slice of pointers to a new slice. | ||
func CopySlice[T any, C Cloneable[T]](original []C) []T { |
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.
maybe I should move this to some util package?
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.
IMO should probably be unexported, as it's a trivial func and copying it around seems cleaner to me than making a util that all the proto packages need to import.
|
||
type Cloneable[T any] interface { | ||
Copy() T | ||
} |
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'm going to approve so you can move on, but my nitpick is that we should name the interface after the method (Cloneable
does not follow intuitively from Copy
- the reflexive naming here should be something more like Copyer
). If you want to address that now I'd appreciate it and give a fast follow-up approval, or you can do it in the follow-up PRs. Also, should the interface be exported?
What type of PR is this?
Other
What does this PR do? Why is it needed?
Attempting to make cloners more robust and more generic.
This PR only addresses for payload electra but other types can be taken cared of in subsequent PRs
Which issues(s) does this PR fix?
Fixes #
Other notes for review