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)
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
Leaf Nodes,Branch Nodes,Extension Nodeswhich in turn inherit a common classBaseNode. The classBaseNodeshould contain the followingLeaforBranchorExtension)ExtensionandLeafnodes. List of size 16 forBranchnodes).valuecontained in the node (If has nothing, thenNull)get_all_childrenmethodEncodeandDecodemethodsparse_nodemethodBaseTrieclass should be implemented from which theBinaryTrieand theHexaryTrieshould be implemented.py-evm)