Skip to content
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

feat: pseudo.Type RLP round-tripping #43

Merged
merged 15 commits into from
Oct 1, 2024
Merged

feat: pseudo.Type RLP round-tripping #43

merged 15 commits into from
Oct 1, 2024

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Sep 30, 2024

Why this should be merged

Prerequisite for #44, which introduces a pseudo.Type extra payload into types.StateAccount.

How this works

The new pseudo.Type.{Encode,Decode}RLP() methods plumb through to their concrete payload in the same way as JSON round-tripping was implemented.

Two minor methods Type.IsZero() and Equal(*pseudo.Type) are also introduced as prerequisites for #44.

How this was tested

Fuzzing a types.Header and confirming that it produces the identical RLP when encoded while carried inside a pseudo.Type. A round trip decoding of the RLP into a new pseudo.Type then tests decoding.

@ARR4N ARR4N changed the title feat: types.StateAccount pseudo-generic payload feat: pseudo.Type RLP round-tripping Oct 1, 2024
@ARR4N ARR4N marked this pull request as ready for review October 1, 2024 14:53
@ARR4N ARR4N requested review from a team, darioush, ceyonur and michaelkaplan13 and removed request for a team October 1, 2024 14:53
@ARR4N ARR4N enabled auto-merge (squash) October 1, 2024 15:04
@ARR4N ARR4N merged commit 336a289 into libevm Oct 1, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/pseudo-type-rlp branch October 1, 2024 15:23
ARR4N added a commit that referenced this pull request Oct 2, 2024
Some of the changes in the full commit history were merged into `libevm` as part of #43 in `336a289` and then merged back into this branch as `5b15698`. Cherry-picking commits was not possible as some touched both halves of the changes; the squash-merges will, however, make this convoluted history irrelevant.

* feat: `types.StateAccount` pseudo-generic payload

* feat: registration of `StateAccount` payload type

* chore: mark `eth/tracers/logger` flaky

* chore: copyright header + `gci`

* test: lock default `types.SlimAccount` RLP encoding

* feat: `vm.SlimAccount.Extra` from `StateAccount` equiv

* chore: placate the linter

* test: `pseudo.Type.EncodeRLP()`

* test: `pseudo.Type.DecodeRLP()`

* fix: `pseudo.Type.DecodeRLP()` with non-pointer type

* feat: `pseudo.Type.IsZero()` and `Type.Equal(*Type)`

* feat: `types.StateAccountExtra.DecodeRLP()`

* fix: remove unnecessary `StateAccountExtra.clone()`

* refactor: readability

* feat: `pseudo.Type.Format()` implements `fmt.Formatter`
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