Skip to content

rlp: add RawList for working with un-decoded lists#33755

Merged
fjl merged 1 commit intoethereum:masterfrom
fjl:rlp-rawlist
Feb 4, 2026
Merged

rlp: add RawList for working with un-decoded lists#33755
fjl merged 1 commit intoethereum:masterfrom
fjl:rlp-rawlist

Conversation

@fjl
Copy link
Copy Markdown
Contributor

@fjl fjl commented Feb 4, 2026

This adds a new type wrapper that decodes as a list, but does not actually decode the contents of the list. The type parameter exists as a marker, and enables decoding the elements lazily. RawList can also be used for building a list incrementally.

This adds a new type wrapper that decodes as a list, but does not actually decode the
contents of the list. The type parameter exists as a marker, and enables decoding the
elements lazily. RawList can also be used for building a list incrementally.
}

// EncodeRLP writes the encoded list to the writer.
func (r RawList[T]) EncodeRLP(w io.Writer) error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any particular reason to use struct instead of the pointer of struct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used non-pointer receiver because most uses are like this:

type packet struct{
     List rlp.RawList[item]
}

and there is a lot of code in tests that attempts to encode packet{}.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see

Copy link
Copy Markdown
Member

@rjl493456442 rjl493456442 left a comment

Choose a reason for hiding this comment

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

LGTM, one nitpick

@rjl493456442 rjl493456442 added this to the 1.17.0 milestone Feb 4, 2026
@fjl fjl merged commit 7b7be24 into ethereum:master Feb 4, 2026
7 of 8 checks passed
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Feb 10, 2026
This adds a new type wrapper that decodes as a list, but does not
actually decode the contents of the list. The type parameter exists as a
marker, and enables decoding the elements lazily. RawList can also be
used for building a list incrementally.
AnilChinchawale pushed a commit to XinFinOrg/XDPoSChain that referenced this pull request Feb 28, 2026
… (#2040)

This adds a new type wrapper that decodes as a list, but does not
actually decode the contents of the list. The type parameter exists as a
marker, and enables decoding the elements lazily. RawList can also be
used for building a list incrementally.

Co-authored-by: Felix Lange <fjl@twurst.com>
sduchesneau pushed a commit to streamingfast/go-ethereum that referenced this pull request Apr 7, 2026
This adds a new type wrapper that decodes as a list, but does not
actually decode the contents of the list. The type parameter exists as a
marker, and enables decoding the elements lazily. RawList can also be
used for building a list incrementally.
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