go-ethereum/rlp
Quentin McGaw 739ba847f6
feat(rlp/rlpgen): support alias types (#154)
## 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.

---------

Co-authored-by: Arran Schlosberg <me@arranschlosberg.com>
2025-02-27 11:13:11 +00:00
..
internal/rlpstruct all: fix docstrings 2022-10-04 09:18:02 +02:00
rlpgen feat(rlp/rlpgen): support alias types (#154) 2025-02-27 11:13:11 +00:00
decode.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
decode_tail_test.go all: update license information 2016-04-15 09:48:05 +02:00
decode_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
doc.go build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
encbuffer.go rlp: use identical receiver names for encBuffer methods (#27430) 2023-06-07 12:40:06 +02:00
encbuffer_example_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encode.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encode_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encoder_example_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
fields.libevm.go refactor(core/types): simplify Body RLP override (#120) 2025-02-07 15:42:25 +00:00
fields.libevm_test.go refactor(core/types): simplify Body RLP override (#120) 2025-02-07 15:42:25 +00:00
iterator.go all: add whitespace linter (#25312) 2022-07-25 13:14:03 +03:00
iterator_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
list.libevm.go feat(core/types): fine-grained Body RLP override (#109) 2025-02-05 10:52:28 +00:00
list.libevm_test.go feat(core/types): fine-grained Body RLP override (#109) 2025-02-05 10:52:28 +00:00
raw.go p2p/discover: improve discv5 NODES response packing (#26033) 2022-11-07 19:19:02 +01:00
raw_test.go rlp: improve tests for Split functions (#26200) 2022-11-17 14:19:03 +01:00
safe.go rlp: minor optimizations for slice/array encoding (#23467) 2021-08-25 19:01:10 +02:00
typecache.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
unsafe.go rlp: minor optimizations for slice/array encoding (#23467) 2021-08-25 19:01:10 +02:00