Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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