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

fix(core): encode absent tx access_list correctly #1137

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

michaelsproul
Copy link
Contributor

@michaelsproul michaelsproul commented Apr 12, 2022

Motivation

The optional access list on Transaction was being incorrectly encoded as an empty string (0x80) when omitted, when it should be encoded as an empty list (0xc0).

Fixes #1134.

Solution

Add a new function rlp_opt_list for encoding optional RLP list structures. It encodes an empty list when its argument is None. The new test rlp_london_no_access_list ensures that the encoding of a transaction with a None access list matches the encoding of a transaction with an empty access list. The expected encoding is exactly the same as for the rlp_london test.

The transaction request types are unaffected as they have non-optional access lists.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

The optional access list on `Transaction` was being incorrectly encoded
as an empty string (0x80) when omitted, when it should be encoded as an
empty list (0xc0).

Fixes gakonst#1134.
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@gakonst gakonst merged commit 286f842 into gakonst:master Apr 13, 2022
@michaelsproul michaelsproul deleted the rlp-access-list-none branch April 13, 2022 21:45
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.

Transaction::access_list set to None is incorrectly RLP encoded
3 participants