Skip to content

Conversation

@qdm12
Copy link

@qdm12 qdm12 commented Feb 25, 2025

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 of buildContext.makeOp(). The alternative of adding a case to the switch statement adds unnecessary recursive calls while types.Unalias() is a no-op if not an alias.

How this was tested

New rlpgen unit 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.

@ARR4N
Copy link
Collaborator

ARR4N commented Feb 25, 2025

types.Alias was only added in Go 1.22.

@qdm12 qdm12 added Status: 🔒 After next release Will be done after the next release Status: 🔴 Blocked by Geth sync This needs to wait for the next fork sync with the geth repository 🍴 and removed Status: 🔒 After next release Will be done after the next release labels Feb 25, 2025
@qdm12 qdm12 marked this pull request as draft February 25, 2025 13:24
@qdm12
Copy link
Author

qdm12 commented Feb 25, 2025

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.

@ARR4N
Copy link
Collaborator

ARR4N commented Feb 25, 2025

You could bump the Go version to 1.22. We're going to be built with 1.23 anyway because of avalanchego so aren't wedded to 1.20 and the only reason we haven't done that locally is because it breaks memsize, which isn't transitively imported by a...go.

@ARR4N ARR4N mentioned this pull request Feb 25, 2025
@ARR4N
Copy link
Collaborator

ARR4N commented Feb 25, 2025

I've started the process in #155 to bump to Go 1.23. Please open a PR to geth to add the types.Alias case and, if you can, assign to fjl as they were open to your equivalent gencodec change.

Assuming geth accepts it, this PR should also be added to #128 to revert before merging their equivalent.

@ARR4N ARR4N mentioned this pull request Feb 25, 2025
ARR4N added a commit that referenced this pull request Feb 25, 2025
## 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.
@ARR4N ARR4N removed the Status: 🔴 Blocked by Geth sync This needs to wait for the next fork sync with the geth repository 🍴 label Feb 25, 2025
ARR4N added a commit that referenced this pull request Feb 25, 2025
## Why this should be merged

We'll be building with Go 1.23 via `avalanchego` so should align
versions. Also unblocks #154.

## How this works

Bump `go.mod` version and run `go mod tidy`.

## How this was tested

CI on existing tests.
@ARR4N
Copy link
Collaborator

ARR4N commented Feb 25, 2025

Merged main into this branch as discussed. This will now build + lint against 1.23 so there shouldn't be any problems.

@ARR4N ARR4N marked this pull request as ready for review February 25, 2025 18:42
Copy link
Author

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Approved 👍 😄

@ARR4N ARR4N merged commit 739ba84 into main Feb 27, 2025
11 checks passed
@ARR4N ARR4N deleted the qdm12/rlp/rlpgen/alias-support branch February 27, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants