Code Refactoring
- Dominant language
- Python
- Stars
- 111
- Forks
- 54
- Avg merge
- 27m
- Merged PRs (30d)
- 1
Description
### What was wrong?
The whole code base is a bit hard to read and could be structured better.
### How can it be fixed?
The code base can be refactored with the following improvements
* Make seperate classes for `Leaf Nodes`, `Branch Nodes`, `Extension Nodes` which in turn inherit a common class `BaseNode`. The class `BaseNode` should contain the following
* Type of the Node (`Leaf` or `Branch` or `Extension`)
* List of all the keys contained in the Node - (List of size 1 for `Extension` and `Leaf` nodes. List of size 16 for `Branch` nodes).
* `value` contained in the node (If has nothing, then `Null`)
* `get_all_children` method
* Node `Encode` and `Decode` methods
* `parse_node` method
* Common `BaseTrie` class should be implemented from which the `BinaryTrie` and the `HexaryTrie` should be implemented.
* Changing the test cases correspondingly to the above changes
* Adding Benchmarks to compare the performance (benchmark architecture similar to `py-evm`)
Contributor guide
Assessment
This issue has not been assessed yet.