-
Notifications
You must be signed in to change notification settings - Fork 5
feat(rlp/rlpgen): support alias types #154
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
Conversation
|
types.Alias was only added in Go 1.22. |
Welp, we'll wait for next geth sync I suppose 🤷 Please keep this opened, and I changed it back to a draft PR. |
|
You could bump the Go version to 1.22. We're going to be built with 1.23 anyway because of |
## Why this should be merged `memsize` blocks usage of Go 1.23. We'll be building with 1.23 via `avalanchego` anyway (which doesn't transitively import `memsize`) so we want to run tests with the correct version. It will also unblock #154. ## How this works ✂️ We already cherry-pick the upstream commit (e467577) that removes `memsize` when on release branches so we instead do it ourselves and no longer cherry-pick. To avoid conflicts at the next `geth` sync, this PR should be reverted before performing the merge. See #128. ## How this was tested Existing tests.
|
Merged |
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.
Approved 👍 😄
Why this should be merged
To be able to generate RLP code using type aliases (defined e.g. in
coreth).This can and should be PR-ed upstream as well I think.
How this works
Call
types.Unalias()at the start ofbuildContext.makeOp(). The alternative of adding acaseto the switch statement adds unnecessary recursive calls whiletypes.Unalias()is a no-op if not an alias.How this was tested
New
rlpgenunit test with aliases of well-known types that have special handling—these make their proper handling easy to spot when inspecting generated code. A recursive alias in the same test also demonstrates full alias resolution.