ethereum / ethereum/execution-specs

Nodes in trie lib use Bytes as a type for Nibble

Open
#1,043 4 comments 0 reactions 0 assignees View on GitHub
A-spec-specs C-bug P-low stale
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 14h
Merged PRs (30d)
116

Description

### Metadata

* **Hardfork**: cancun

### What was wrong?

https://github.com/ethereum/execution-specs/blob/master/src/ethereum/cancun/trie.py#L80-L95

```
@slotted_freezable
@dataclass
class LeafNode:
"""Leaf node in the Merkle Trie"""

rest_of_key: Bytes
value: rlp.Extended

@slotted_freezable
@dataclass
class ExtensionNode:
"""Extension node in the Merkle Trie"""

key_segment: Bytes
subnode: rlp.Extended
```

`rest_of_key` and `key_segment` should be `Nibble` (type to create) instead of `Bytes`, as it's not true that _any bytes_. can be in (see for example `encode_internal_node` where it crashes in `nibble_list_to_compact(node.rest_of_key, True)`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.