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(core/types): Block RLP overriding #133

Merged
merged 14 commits into from
Feb 13, 2025
Merged

feat(core/types): Block RLP overriding #133

merged 14 commits into from
Feb 13, 2025

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Feb 12, 2025

Why this should be merged

Support for configurable core/types.Block with RLP encoding, including interplay with Body.

How this works

Block doesn't export most of its fields so relies on an internal type, extblock, for RLP encoding. This type is modified to implement the rlp.Encoder and Decoder methods as a point to inject hooks using rlp.Fields (as in #120 for Body).

Block shares the same registered extra type as Body. Unlike Header, which has its own field in a Block, the fields in Body are promoted to be carried directly. This suggests that (at least for pure data payloads) the modifications might be equivalent (and ava-labs/coreth evidences this). Should different payloads be absolutely required in the future, we can split the types—the RegisterExtras signature is already too verbose though 😢.

How this was tested

Explicit inclusion of a backwards-compatibility test for NOOPBlockBodyHooks + implicit testing via the multiple upstream tests in block_test.go. Re implicit testing: default behaviour is now to use the noop hooks even when no registration is performed, but if we change this then the tests in block_test.go can still be called as subtests from a test that explicitly registers noops.

ARR4N added a commit that referenced this pull request Feb 13, 2025
@qdm12 qdm12 marked this pull request as ready for review February 13, 2025 11:25
@qdm12 qdm12 marked this pull request as draft February 13, 2025 11:26
qdm12 pushed a commit that referenced this pull request Feb 13, 2025
@ARR4N ARR4N marked this pull request as ready for review February 13, 2025 12:36
@ARR4N ARR4N requested a review from qdm12 February 13, 2025 12:36
core/types/backwards_compat.libevm_test.go Outdated Show resolved Hide resolved
core/types/backwards_compat.libevm_test.go Show resolved Hide resolved
core/types/backwards_compat.libevm_test.go Outdated Show resolved Hide resolved
core/types/backwards_compat.libevm_test.go Show resolved Hide resolved
core/types/backwards_compat.libevm_test.go Show resolved Hide resolved
core/types/block.go Show resolved Hide resolved
core/types/block.libevm_test.go Show resolved Hide resolved
core/types/block.libevm_test.go Outdated Show resolved Hide resolved
core/types/block.libevm_test.go Show resolved Hide resolved
core/types/rlp_payload.libevm.go Outdated Show resolved Hide resolved
ARR4N and others added 2 commits February 13, 2025 13:25
@ARR4N ARR4N requested a review from qdm12 February 13, 2025 13:36
@ARR4N ARR4N merged commit 3ab3cd2 into main Feb 13, 2025
5 checks passed
@ARR4N ARR4N deleted the arr4n/body-rlp-override branch February 13, 2025 16:20
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